From 2b36e921a482a73ae1125813c1ba9176bae7af1d Mon Sep 17 00:00:00 2001 From: Daniel Shawul Date: Mon, 25 Apr 2022 05:17:27 -0600 Subject: [PATCH 1/6] Add github actions for python unittests. --- .github/workflows/python_unittests.yaml | 32 +++++++++++++++++++++++++ ush/set_extrn_mdl_params.py | 6 ++--- 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/python_unittests.yaml diff --git a/.github/workflows/python_unittests.yaml b/.github/workflows/python_unittests.yaml new file mode 100644 index 000000000..45809c0a0 --- /dev/null +++ b/.github/workflows/python_unittests.yaml @@ -0,0 +1,32 @@ +name: Python unittests +on: [push, pull_request] +jobs: + + python_unittests: + name: Python unittests + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Install dependencies + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install python3 python3-pip netcdf-bin + sudo pip3 install pyyaml jinja2 f90nml + + # Run python unittests + - name: Run python unittests + run: | + cd ush + python3 -m unittest -b python_utils/test_python_utils.py + python3 -m unittest -b check_ruc_lsm.py create_diag_table_file.py \ + create_model_configure_file.py link_fix.py set_cycle_dates.py \ + set_extrn_mdl_params.py set_FV3nml_sfc_climo_filenames.py \ + set_FV3nml_ens_stoch_seeds.py set_gridparams_ESGgrid.py \ + set_gridparams_GFDLgrid.py set_ozone_param.py \ + set_predef_grid_params.py set_thompson_mp_fix_files.py \ + get_crontab_contents.py + diff --git a/ush/set_extrn_mdl_params.py b/ush/set_extrn_mdl_params.py index 1eea1f2ba..cc3b45422 100644 --- a/ush/set_extrn_mdl_params.py +++ b/ush/set_extrn_mdl_params.py @@ -65,8 +65,8 @@ class Testing(unittest.TestCase): def test_extrn_mdl_params(self): set_extrn_mdl_params() EXTRN_MDL_SYSBASEDIR_ICS = get_env_var("EXTRN_MDL_SYSBASEDIR_ICS") - COMINgfs = get_env_var("COMINgfs") - self.assertEqual(EXTRN_MDL_SYSBASEDIR_ICS,COMINgfs) + COMIN = get_env_var("COMIN") + self.assertEqual(EXTRN_MDL_SYSBASEDIR_ICS,COMIN) def setUp(self): set_env_var("MACHINE","HERA") @@ -76,4 +76,4 @@ def setUp(self): set_env_var("EXTRN_MDL_SYSBASEDIR_ICS",None) set_env_var("EXTRN_MDL_SYSBASEDIR_LBCS",None) set_env_var("EXTRN_MDL_LBCS_OFFSET_HRS",None) - set_env_var("COMINgfs","/base/path/of/directory/containing/gfs/input/files") + set_env_var("COMIN","/base/path/of/directory/containing/gfs/input/files") From 0c1a7b9a1dbd98e0fd18b9302dfb8583bf760736 Mon Sep 17 00:00:00 2001 From: Daniel Abdi Date: Sat, 30 Apr 2022 16:48:37 +0000 Subject: [PATCH 2/6] Include all python script in ush --- .github/workflows/python_unittests.yaml | 9 +- ush/mrms_pull_topofhour.py | 160 ++++++++++++------------ 2 files changed, 85 insertions(+), 84 deletions(-) diff --git a/.github/workflows/python_unittests.yaml b/.github/workflows/python_unittests.yaml index 45809c0a0..65688fd38 100644 --- a/.github/workflows/python_unittests.yaml +++ b/.github/workflows/python_unittests.yaml @@ -16,17 +16,12 @@ jobs: sudo apt-get update sudo apt-get install python3 python3-pip netcdf-bin sudo pip3 install pyyaml jinja2 f90nml + sudo pip3 install numpy matplotlib basemap # Run python unittests - name: Run python unittests run: | cd ush python3 -m unittest -b python_utils/test_python_utils.py - python3 -m unittest -b check_ruc_lsm.py create_diag_table_file.py \ - create_model_configure_file.py link_fix.py set_cycle_dates.py \ - set_extrn_mdl_params.py set_FV3nml_sfc_climo_filenames.py \ - set_FV3nml_ens_stoch_seeds.py set_gridparams_ESGgrid.py \ - set_gridparams_GFDLgrid.py set_ozone_param.py \ - set_predef_grid_params.py set_thompson_mp_fix_files.py \ - get_crontab_contents.py + python3 -m unittest -b *.py diff --git a/ush/mrms_pull_topofhour.py b/ush/mrms_pull_topofhour.py index bd98b2805..374424201 100644 --- a/ush/mrms_pull_topofhour.py +++ b/ush/mrms_pull_topofhour.py @@ -3,80 +3,86 @@ import re, csv, glob import bisect import numpy as np - -# Copy and unzip MRMS files that are closest to top of hour -# Done every hour on a 20-minute lag - -# Include option to define valid time on command line -# Used to backfill verification -#try: -valid_time = str(sys.argv[1]) - -YYYY = int(valid_time[0:4]) -MM = int(valid_time[4:6]) -DD = int(valid_time[6:8]) -HH = int(valid_time[8:19]) - -valid = datetime.datetime(YYYY,MM,DD,HH,0,0) - -#except IndexError: -# valid_time = None - -# Default to current hour if not defined on command line -#if valid_time is None: -# now = datetime.datetime.utcnow() -# YYYY = int(now.strftime('%Y')) -# MM = int(now.strftime('%m')) -# DD = int(now.strftime('%d')) -# HH = int(now.strftime('%H')) - -# valid = datetime.datetime(YYYY,MM,DD,HH,0,0) -# valid_time = valid.strftime('%Y%m%d%H') - -print('Pulling '+valid_time+' MRMS data') - -# Set up working directory -DATA_HEAD = str(sys.argv[2]) -MRMS_PROD_DIR = str(sys.argv[3]) -MRMS_PRODUCT = str(sys.argv[4]) -level = str(sys.argv[5]) - -VALID_DIR = os.path.join(DATA_HEAD,valid.strftime('%Y%m%d')) -if not os.path.exists(VALID_DIR): - os.makedirs(VALID_DIR) -os.chdir(DATA_HEAD) - -# Sort list of files for each MRMS product -print(valid.strftime('%Y%m%d')) -if valid.strftime('%Y%m%d') < '20200303': - search_path = MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/dcom/us007003/ldmdata/obs/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+MRMS_PRODUCT+'*.gz' -elif valid.strftime('%Y%m%d') >= '20200303': - search_path = MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+MRMS_PRODUCT+'*.gz' -file_list = [f for f in glob.glob(search_path)] -time_list = [file_list[x][-24:-9] for x in range(len(file_list))] -int_list = [int(time_list[x][0:8]+time_list[x][9:15]) for x in range(len(time_list))] -int_list.sort() -datetime_list = [datetime.datetime.strptime(str(x),"%Y%m%d%H%M%S") for x in int_list] - -# Find the MRMS file closest to the valid time -i = bisect.bisect_left(datetime_list,valid) -closest_timestamp = min(datetime_list[max(0, i-1): i+2], key=lambda date: abs(valid - date)) - -# Check to make sure closest file is within +/- 15 mins of top of the hour -# Copy and rename the file for future ease -difference = abs(closest_timestamp - valid) -if difference.total_seconds() <= 900: - filename1 = MRMS_PRODUCT+level+closest_timestamp.strftime('%Y%m%d-%H%M%S')+'.grib2.gz' - filename2 = MRMS_PRODUCT+level+valid.strftime('%Y%m%d-%H')+'0000.grib2.gz' - - if valid.strftime('%Y%m%d') < '20200303': - print('cp '+MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/dcom/us007003/ldmdata/obs/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+filename1+' '+VALID_DIR+'/'+filename2) - - os.system('cp '+MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/dcom/us007003/ldmdata/obs/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+filename1+' '+VALID_DIR+'/'+filename2) - os.system('gunzip '+VALID_DIR+'/'+filename2) - elif valid.strftime('%Y%m%d') >= '20200303': - print('cp '+MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+filename1+' '+VALID_DIR+'/'+filename2) - - os.system('cp '+MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+filename1+' '+VALID_DIR+'/'+filename2) - os.system('gunzip '+VALID_DIR+'/'+filename2) - +import unittest + +if __name__ == '__main__': + # Copy and unzip MRMS files that are closest to top of hour + # Done every hour on a 20-minute lag + + # Include option to define valid time on command line + # Used to backfill verification + #try: + valid_time = str(sys.argv[1]) + + YYYY = int(valid_time[0:4]) + MM = int(valid_time[4:6]) + DD = int(valid_time[6:8]) + HH = int(valid_time[8:19]) + + valid = datetime.datetime(YYYY,MM,DD,HH,0,0) + + #except IndexError: + # valid_time = None + + # Default to current hour if not defined on command line + #if valid_time is None: + # now = datetime.datetime.utcnow() + # YYYY = int(now.strftime('%Y')) + # MM = int(now.strftime('%m')) + # DD = int(now.strftime('%d')) + # HH = int(now.strftime('%H')) + + # valid = datetime.datetime(YYYY,MM,DD,HH,0,0) + # valid_time = valid.strftime('%Y%m%d%H') + + print('Pulling '+valid_time+' MRMS data') + + # Set up working directory + DATA_HEAD = str(sys.argv[2]) + MRMS_PROD_DIR = str(sys.argv[3]) + MRMS_PRODUCT = str(sys.argv[4]) + level = str(sys.argv[5]) + + VALID_DIR = os.path.join(DATA_HEAD,valid.strftime('%Y%m%d')) + if not os.path.exists(VALID_DIR): + os.makedirs(VALID_DIR) + os.chdir(DATA_HEAD) + + # Sort list of files for each MRMS product + print(valid.strftime('%Y%m%d')) + if valid.strftime('%Y%m%d') < '20200303': + search_path = MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/dcom/us007003/ldmdata/obs/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+MRMS_PRODUCT+'*.gz' + elif valid.strftime('%Y%m%d') >= '20200303': + search_path = MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+MRMS_PRODUCT+'*.gz' + file_list = [f for f in glob.glob(search_path)] + time_list = [file_list[x][-24:-9] for x in range(len(file_list))] + int_list = [int(time_list[x][0:8]+time_list[x][9:15]) for x in range(len(time_list))] + int_list.sort() + datetime_list = [datetime.datetime.strptime(str(x),"%Y%m%d%H%M%S") for x in int_list] + + # Find the MRMS file closest to the valid time + i = bisect.bisect_left(datetime_list,valid) + closest_timestamp = min(datetime_list[max(0, i-1): i+2], key=lambda date: abs(valid - date)) + + # Check to make sure closest file is within +/- 15 mins of top of the hour + # Copy and rename the file for future ease + difference = abs(closest_timestamp - valid) + if difference.total_seconds() <= 900: + filename1 = MRMS_PRODUCT+level+closest_timestamp.strftime('%Y%m%d-%H%M%S')+'.grib2.gz' + filename2 = MRMS_PRODUCT+level+valid.strftime('%Y%m%d-%H')+'0000.grib2.gz' + + if valid.strftime('%Y%m%d') < '20200303': + print('cp '+MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/dcom/us007003/ldmdata/obs/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+filename1+' '+VALID_DIR+'/'+filename2) + + os.system('cp '+MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/dcom/us007003/ldmdata/obs/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+filename1+' '+VALID_DIR+'/'+filename2) + os.system('gunzip '+VALID_DIR+'/'+filename2) + elif valid.strftime('%Y%m%d') >= '20200303': + print('cp '+MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+filename1+' '+VALID_DIR+'/'+filename2) + + os.system('cp '+MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+filename1+' '+VALID_DIR+'/'+filename2) + os.system('gunzip '+VALID_DIR+'/'+filename2) + +#dummy unittest +class Testing(unittest.TestCase): + def test_mrms_pull_topfhour(self): + pass From 53bad22c9ca551c39e30f9f5bd5a6fc609ca7cdf Mon Sep 17 00:00:00 2001 From: Daniel Abdi Date: Sun, 1 May 2022 21:07:58 +0000 Subject: [PATCH 3/6] Skip defining QUILTING params when it is set to False --- ush/set_predef_grid_params.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ush/set_predef_grid_params.py b/ush/set_predef_grid_params.py index e8f4e94ab..283851715 100644 --- a/ush/set_predef_grid_params.py +++ b/ush/set_predef_grid_params.py @@ -23,6 +23,11 @@ def set_predef_grid_params(): params_dict = load_config_file("predef_grid_params.yaml") params_dict = params_dict[PREDEF_GRID_NAME] + # if QUILTING = False, skip variables that start with "WRTCMP_" + if not QUILTING: + params_dict = {k: v for k,v in params_dict.items() \ + if not k.startswith("WRTCMP_") } + # take care of special vars special_vars = ['DT_ATMOS', 'LAYOUT_X', 'LAYOUT_Y', 'BLOCKSIZE'] for var in special_vars: @@ -55,5 +60,5 @@ def setUp(self): set_env_var('LAYOUT_X',18) set_env_var('LAYOUT_Y',36) set_env_var('BLOCKSIZE',28) - set_env_var('QUILTING',True) + set_env_var('QUILTING',False) From e75a5805dc8f5db372724dc06d258bd266b9e1d2 Mon Sep 17 00:00:00 2001 From: Daniel Abdi Date: Sun, 1 May 2022 20:48:59 +0000 Subject: [PATCH 4/6] Update py_workflow --- ush/config_defaults.yaml | 40 ++++++++++++++++++++++------------ ush/predef_grid_params.yaml | 43 +++++++++++++++++++++++++++++++++++++ ush/set_extrn_mdl_params.py | 20 ++--------------- ush/setup.py | 25 +++++++++++---------- ush/valid_param_vals.yaml | 3 ++- 5 files changed, 87 insertions(+), 44 deletions(-) diff --git a/ush/config_defaults.yaml b/ush/config_defaults.yaml index a2a218a7f..6dbd31110 100644 --- a/ush/config_defaults.yaml +++ b/ush/config_defaults.yaml @@ -238,19 +238,6 @@ EXEC_SUBDIR: "bin" # need in order to create initial and boundary condition files for a given # cycle on the native FV3-LAM grid. # -# FIXLAM_NCO_BASEDIR: -# The base directory containing pregenerated grid, orography, and surface -# climatology files. For the pregenerated grid specified by PREDEF_GRID_NAME, -# these "fixed" files are located in: -# -# ${FIXLAM_NCO_BASEDIR}/${PREDEF_GRID_NAME} -# -# The workflow scripts will create a symlink in the experiment directory -# that will point to a subdirectory (having the name of the grid being -# used) under this directory. This variable should be set to a null -# string in this file, but it can be specified in the user-specified -# workflow configuration file (EXPT_CONFIG_FN). -# # envir, NET, model_ver, RUN: # Standard environment variables defined in the NCEP Central Operations WCOSS # Implementation Standards document as follows: @@ -292,7 +279,6 @@ EXEC_SUBDIR: "bin" #----------------------------------------------------------------------- # COMIN: "/path/of/directory/containing/data/files/for/IC/LBCS" -FIXLAM_NCO_BASEDIR: "" envir: "para" NET: "rrfs" model_ver: "v1.0.0" @@ -711,6 +697,13 @@ EXTRN_MDL_SYSBASEDIR_LBCS: '' # EXTRN_MDL_FILES_LBCS: # Analogous to EXTRN_MDL_FILES_ICS but for LBCs instead of ICs. # +# EXTRN_MDL_DATA_STORES: +# A list of data stores where the scripts should look for external model +# data. The list is in priority order. If disk information is provided +# via USE_USER_STAGED_EXTRN_FILES or a known location on the platform, +# the disk location will be highest priority. Options are disk, hpss, +# aws, and nomads. +# #----------------------------------------------------------------------- # USE_USER_STAGED_EXTRN_FILES: "FALSE" @@ -718,6 +711,7 @@ EXTRN_MDL_SOURCE_BASEDIR_ICS: "" EXTRN_MDL_FILES_ICS: "" EXTRN_MDL_SOURCE_BASEDIR_LBCS: "" EXTRN_MDL_FILES_LBCS: "" +EXTRN_MDL_DATA_STORES: "" # #----------------------------------------------------------------------- # @@ -1305,6 +1299,22 @@ VX_ENSPOINT_PROB_TN: "run_enspointvx_prob" # SFC_CLIMO_DIR: # Same as GRID_DIR but for the MAKE_SFC_CLIMO_TN task. # +# DOMAIN_PREGEN_BASEDIR: +# The base directory containing pregenerated grid, orography, and surface +# climatology files. This is an alternative for setting GRID_DIR, +# OROG_DIR, and SFC_CLIMO_DIR individually +# +# For the pregenerated grid specified by PREDEF_GRID_NAME, +# these "fixed" files are located in: +# +# ${DOMAIN_PREGEN_BASEDIR}/${PREDEF_GRID_NAME} +# +# The workflow scripts will create a symlink in the experiment directory +# that will point to a subdirectory (having the name of the grid being +# used) under this directory. This variable should be set to a null +# string in this file, but it can be specified in the user-specified +# workflow configuration file (EXPT_CONFIG_FN). +# # RUN_TASK_GET_EXTRN_ICS: # Flag that determines whether the GET_EXTRN_ICS_TN task is to be run. # @@ -1351,6 +1361,8 @@ OROG_DIR: "/path/to/pregenerated/orog/files" RUN_TASK_MAKE_SFC_CLIMO: "TRUE" SFC_CLIMO_DIR: "/path/to/pregenerated/surface/climo/files" +DOMAIN_PREGEN_BASEDIR: "" + RUN_TASK_GET_EXTRN_ICS: "TRUE" RUN_TASK_GET_EXTRN_LBCS: "TRUE" RUN_TASK_MAKE_ICS: "TRUE" diff --git a/ush/predef_grid_params.yaml b/ush/predef_grid_params.yaml index 39701ca62..24aae749c 100644 --- a/ush/predef_grid_params.yaml +++ b/ush/predef_grid_params.yaml @@ -440,6 +440,49 @@ # #----------------------------------------------------------------------- # +# The WoFS domain with ~3km cells. +# +# Note: +# The WoFS domain will generate a 301 x 301 output grid (WRITE COMPONENT) and +# will eventually be movable (ESGgrid_LON_CTR/ESGgrid_LAT_CTR). A python script +# python_utils/fv3write_parms_lambert will be useful to determine +# WRTCMP_lon_lwr_left and WRTCMP_lat_lwr_left locations (only for Lambert map +# projection currently) of the quilting output when the domain location is +# moved. Later, it should be integrated into the workflow. +# +#----------------------------------------------------------------------- +# +"WoFS_3km": + GRID_GEN_METHOD: "ESGgrid" + ESGgrid_LON_CTR: -97.5 + ESGgrid_LAT_CTR: 38.5 + ESGgrid_DELX: 3000.0 + ESGgrid_DELY: 3000.0 + ESGgrid_NX: 361 + ESGgrid_NY: 361 + ESGgrid_PAZI: 0.0 + ESGgrid_WIDE_HALO_WIDTH: 6 + DT_ATMOS: 20 + LAYOUT_X: 18 + LAYOUT_Y: 12 + BLOCKSIZE: 30 + # if QUILTING = True + WRTCMP_write_groups: "1" + WRTCMP_write_tasks_per_group: 12 + WRTCMP_output_grid: "lambert_conformal" + WRTCMP_cen_lon: -97.5 + WRTCMP_cen_lat: 38.5 + WRTCMP_stdlat1: 38.5 + WRTCMP_stdlat2: 38.5 + WRTCMP_nx: 301 + WRTCMP_ny: 301 + WRTCMP_lon_lwr_left: -102.3802487 + WRTCMP_lat_lwr_left: 34.3407918 + WRTCMP_dx: 3000.0 + WRTCMP_dy: 3000.0 +# +#----------------------------------------------------------------------- +# # A CONUS domain of GFDLgrid type with ~25km cells. # # Note: diff --git a/ush/set_extrn_mdl_params.py b/ush/set_extrn_mdl_params.py index cc3b45422..f7e07afea 100644 --- a/ush/set_extrn_mdl_params.py +++ b/ush/set_extrn_mdl_params.py @@ -16,24 +16,8 @@ def set_extrn_mdl_params(): #import all env variables import_vars() - global EXTRN_MDL_SYSBASEDIR_ICS, EXTRN_MDL_SYSBASEDIR_LBCS, EXTRN_MDL_LBCS_OFFSET_HRS + global EXTRN_MDL_LBCS_OFFSET_HRS - # - #----------------------------------------------------------------------- - # - # Use known locations or COMIN as default, depending on RUN_ENVIR - # - #----------------------------------------------------------------------- - # - if RUN_ENVIR == "nco": - EXTRN_MDL_SYSBASEDIR_ICS=EXTRN_MDL_SYSBASEDIR_ICS or COMIN - EXTRN_MDL_SYSBASEDIR_LBCS=EXTRN_MDL_SYSBASEDIR_LBCS or COMIN - else: - ics_dir=EXTRN_MDL_NAME_ICS - lbcs_dir=EXTRN_MDL_NAME_LBCS - EXTRN_MDL_SYSBASEDIR_ICS=EXTRN_MDL_SYSBASEDIR_ICS or ics_dir - EXTRN_MDL_SYSBASEDIR_LBCS=EXTRN_MDL_SYSBASEDIR_LBCS or lbcs_dir - # #----------------------------------------------------------------------- # @@ -49,7 +33,7 @@ def set_extrn_mdl_params(): EXTRN_MDL_LBCS_OFFSET_HRS=EXTRN_MDL_LBCS_OFFSET_HRS or "0" # export values we set above - env_vars = ["EXTRN_MDL_SYSBASEDIR_ICS", "EXTRN_MDL_SYSBASEDIR_LBCS", "EXTRN_MDL_LBCS_OFFSET_HRS"] + env_vars = ["EXTRN_MDL_LBCS_OFFSET_HRS"] export_vars(env_vars=env_vars) # #----------------------------------------------------------------------- diff --git a/ush/setup.py b/ush/setup.py index 261f0e26a..ee3f3b72e 100644 --- a/ush/setup.py +++ b/ush/setup.py @@ -337,7 +337,7 @@ def setup(): # global MACHINE global MACHINE_FILE - global FIXgsm, FIXaer, FIXlut, TOPO_DIR, SFC_CLIMO_INPUT_DIR, FIXLAM_NCO_BASEDIR, \ + global FIXgsm, FIXaer, FIXlut, TOPO_DIR, SFC_CLIMO_INPUT_DIR, DOMAIN_PREGEN_BASEDIR, \ RELATIVE_LINK_FLAG, WORKFLOW_MANAGER, NCORES_PER_NODE, SCHED, \ QUEUE_DEFAULT, QUEUE_HPSS, QUEUE_FCST, \ PARTITION_DEFAULT, PARTITION_HPSS, PARTITION_FCST @@ -362,7 +362,7 @@ def setup(): FIXlut = \"{FIXlut or ""} TOPO_DIR = \"{TOPO_DIR or ""} SFC_CLIMO_INPUT_DIR = \"{SFC_CLIMO_INPUT_DIR or ""} - FIXLAM_NCO_BASEDIR = \"{FIXLAM_NCO_BASEDIR or ""} + DOMAIN_PREGEN_BASEDIR = \"{DOMAIN_PREGEN_BASEDIR or ""} You can specify the missing location(s) in config.sh''') # @@ -1041,13 +1041,16 @@ def setup(): # if USE_USER_STAGED_EXTRN_FILES: - if not os.path.exists(EXTRN_MDL_SOURCE_BASEDIR_ICS): + # Check for the base directory up to the first templated field. + idx = EXTRN_MDL_SOURCE_BASEDIR_ICS.find("$") + if not os.path.exists(EXTRN_MDL_SOURCE_BASEDIR_ICS[:idx]): print_err_msg_exit(f''' The directory (EXTRN_MDL_SOURCE_BASEDIR_ICS) in which the user-staged external model files for generating ICs should be located does not exist: EXTRN_MDL_SOURCE_BASEDIR_ICS = \"{EXTRN_MDL_SOURCE_BASEDIR_ICS}\"''') - if not os.path.exists(EXTRN_MDL_SOURCE_BASEDIR_LBCS): + idx = EXTRN_MDL_SOURCE_BASEDIR_LBCS.find("$") + if not os.path.exists(EXTRN_MDL_SOURCE_BASEDIR_LBCS[:idx]): print_err_msg_exit(f''' The directory (EXTRN_MDL_SOURCE_BASEDIR_LBCS) in which the user-staged external model files for generating LBCs should be located does not exist: @@ -1153,7 +1156,7 @@ def setup(): if RUN_ENVIR == "nco": - nco_fix_dir = os.path.join(FIXLAM_NCO_BASEDIR, PREDEF_GRID_NAME) + nco_fix_dir = os.path.join(DOMAIN_PREGEN_BASEDIR, PREDEF_GRID_NAME) if not os.path.exists(nco_fix_dir): print_err_msg_exit(f''' The directory (nco_fix_dir) that should contain the pregenerated grid, @@ -1168,11 +1171,11 @@ def setup(): When RUN_ENVIR is set to \"nco\", the workflow assumes that pregenerated grid files already exist in the directory - {FIXLAM_NCO_BASEDIR}/{PREDEF_GRID_NAME} + {DOMAIN_PREGEN_BASEDIR}/{PREDEF_GRID_NAME} where - FIXLAM_NCO_BASEDIR = \"{FIXLAM_NCO_BASEDIR}\" + DOMAIN_PREGEN_BASEDIR = \"{DOMAIN_PREGEN_BASEDIR}\" PREDEF_GRID_NAME = \"{PREDEF_GRID_NAME}\" Thus, the MAKE_GRID_TN task must not be run (i.e. RUN_TASK_MAKE_GRID must @@ -1205,11 +1208,11 @@ def setup(): msg=f''' When RUN_ENVIR is set to \"nco\", the workflow assumes that pregenerated orography files already exist in the directory - {FIXLAM_NCO_BASEDIR}/{PREDEF_GRID_NAME} + {DOMAIN_PREGEN_BASEDIR}/{PREDEF_GRID_NAME} where - FIXLAM_NCO_BASEDIR = \"{FIXLAM_NCO_BASEDIR}\" + DOMAIN_PREGEN_BASEDIR = \"{DOMAIN_PREGEN_BASEDIR}\" PREDEF_GRID_NAME = \"{PREDEF_GRID_NAME}\" Thus, the MAKE_OROG_TN task must not be run (i.e. RUN_TASK_MAKE_OROG must @@ -1243,11 +1246,11 @@ def setup(): When RUN_ENVIR is set to \"nco\", the workflow assumes that pregenerated surface climatology files already exist in the directory - {FIXLAM_NCO_BASEDIR}/{PREDEF_GRID_NAME} + {DOMAIN_PREGEN_BASEDIR}/{PREDEF_GRID_NAME} where - FIXLAM_NCO_BASEDIR = \"{FIXLAM_NCO_BASEDIR}\" + DOMAIN_PREGEN_BASEDIR = \"{DOMAIN_PREGEN_BASEDIR}\" PREDEF_GRID_NAME = \"{PREDEF_GRID_NAME}\" Thus, the MAKE_SFC_CLIMO_TN task must not be run (i.e. RUN_TASK_MAKE_SFC_CLIMO diff --git a/ush/valid_param_vals.yaml b/ush/valid_param_vals.yaml index f9a00e95b..efadce608 100644 --- a/ush/valid_param_vals.yaml +++ b/ush/valid_param_vals.yaml @@ -30,7 +30,8 @@ valid_vals_PREDEF_GRID_NAME: [ "GSD_HRRR_AK_50km", "RRFS_NA_13km", "RRFS_NA_3km", -"SUBCONUS_Ind_3km" +"SUBCONUS_Ind_3km", +"WoFS_3km" ] valid_vals_CCPP_PHYS_SUITE: [ "FV3_GFS_2017_gfdlmp", From 650ae642cb28ad7636e61fe6194868651f8dad7f Mon Sep 17 00:00:00 2001 From: Daniel Abdi Date: Tue, 3 May 2022 23:08:32 +0000 Subject: [PATCH 5/6] Update unittest for set_extrn_mdl_params. --- ush/set_extrn_mdl_params.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/ush/set_extrn_mdl_params.py b/ush/set_extrn_mdl_params.py index f7e07afea..f4fffc590 100644 --- a/ush/set_extrn_mdl_params.py +++ b/ush/set_extrn_mdl_params.py @@ -48,16 +48,9 @@ def set_extrn_mdl_params(): class Testing(unittest.TestCase): def test_extrn_mdl_params(self): set_extrn_mdl_params() - EXTRN_MDL_SYSBASEDIR_ICS = get_env_var("EXTRN_MDL_SYSBASEDIR_ICS") - COMIN = get_env_var("COMIN") - self.assertEqual(EXTRN_MDL_SYSBASEDIR_ICS,COMIN) + EXTRN_MDL_LBCS_OFFSET_HRS = get_env_var("EXTRN_MDL_LBCS_OFFSET_HRS") + self.assertEqual(EXTRN_MDL_LBCS_OFFSET_HRS,3) def setUp(self): - set_env_var("MACHINE","HERA") - set_env_var("RUN_ENVIR","nco") - set_env_var("EXTRN_MDL_NAME_ICS","FV3GFS") - set_env_var("EXTRN_MDL_NAME_LBCS","FV3GFS") - set_env_var("EXTRN_MDL_SYSBASEDIR_ICS",None) - set_env_var("EXTRN_MDL_SYSBASEDIR_LBCS",None) + set_env_var("EXTRN_MDL_NAME_LBCS","RAP") set_env_var("EXTRN_MDL_LBCS_OFFSET_HRS",None) - set_env_var("COMIN","/base/path/of/directory/containing/gfs/input/files") From 84ab40702dcda01cc0059cbf855d021643c13fc2 Mon Sep 17 00:00:00 2001 From: Daniel Abdi Date: Thu, 5 May 2022 22:14:32 +0000 Subject: [PATCH 6/6] Updates from develop. --- ush/predef_grid_params.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ush/predef_grid_params.yaml b/ush/predef_grid_params.yaml index 24aae749c..330a9a647 100644 --- a/ush/predef_grid_params.yaml +++ b/ush/predef_grid_params.yaml @@ -356,7 +356,7 @@ WRTCMP_stdlat1: 39.77 WRTCMP_stdlat2: 39.77 WRTCMP_nx: 197 - WRTCMP_ny: 195 + WRTCMP_ny: 197 WRTCMP_lon_lwr_left: -89.47120417 WRTCMP_lat_lwr_left: 37.07809642 WRTCMP_dx: 3000.0