Skip to content

Commit

Permalink
[develop] Add ufs-case-study data options (#736)
Browse files Browse the repository at this point in the history
Added capabilities to retrieve IC/BC files for UFS-CASE-STUDIES in retrieve_data.py and associated unit tests in test_retrieve_data.py.
  • Loading branch information
clouden90 authored Apr 25, 2023
1 parent 9e52b33 commit 0f19530
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
11 changes: 11 additions & 0 deletions parm/data_locations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,17 @@ NAM:
fcst:
- nam.t{hh}z.awphys{fcst_hr:02d}.tm00.grib2

UFS-CASE-STUDY:
aws:
protocol: download
url: "https://ufs-case-studies.s3.amazonaws.com/"
file_names: &ufs_file_names
nemsio:
anl:
- "{yyyymmddhh}.gfs.nemsio.tar.gz"
fcst:
- "{yyyymmddhh}_bc.atmf{fcst_hr:03d}.nemsio.tar.gz"

##########################
##########################
### Observation Data ###
Expand Down
1 change: 1 addition & 0 deletions ush/retrieve_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,7 @@ def parse_args(argv):
"RAP_obs",
"HRRRx",
"GSI-FIX",
"UFS-CASE-STUDY"
),
help="External model label. This input is case-sensitive",
required=True,
Expand Down
58 changes: 58 additions & 0 deletions ush/test_retrieve_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,3 +344,61 @@ def test_rap_lbcs_from_aws(self):
path = os.path.join(tmp_dir, "*")
files_on_disk = glob.glob(path)
self.assertEqual(len(files_on_disk), 5)

def test_ufs_ics_from_aws(self):

"""Get UFS-CASE-STUDY ICS from aws"""

with tempfile.TemporaryDirectory(dir=".") as tmp_dir:

# fmt: off
args = [
'--file_set', 'anl',
'--config', self.config,
'--cycle_date', '2020072300',
'--data_stores', 'aws',
'--external_model', 'UFS-CASE-STUDY',
'--fcst_hrs', '0',
'--output_path', tmp_dir,
'--ics_or_lbcs', 'ICS',
'--debug',
'--file_type', 'nemsio',
]
# fmt: on

retrieve_data.main(args)

# Verify files exist in temp dir

path = os.path.join(tmp_dir, "*")
files_on_disk = glob.glob(path)
self.assertEqual(len(files_on_disk), 1)

def test_ufs_lbcs_from_aws(self):

"""Get UFS-CASE-STUDY LBCS from aws for 3 hour boundary conditions"""

with tempfile.TemporaryDirectory(dir=".") as tmp_dir:

# fmt: off
args = [
'--file_set', 'fcst',
'--config', self.config,
'--cycle_date', '2020072300',
'--data_stores', 'aws',
'--external_model', 'UFS-CASE-STUDY',
'--fcst_hrs', '3', '6', '3',
'--output_path', tmp_dir,
'--ics_or_lbcs', 'LBCS',
'--debug',
'--file_type', 'nemsio',
]
# fmt: on

retrieve_data.main(args)

# Verify files exist in temp dir

path = os.path.join(tmp_dir, "*")
files_on_disk = glob.glob(path)
self.assertEqual(len(files_on_disk), 2)

0 comments on commit 0f19530

Please sign in to comment.