diff --git a/.github/workflows/python_tests.yaml b/.github/workflows/python_tests.yaml index fb0de16910..4a454c871a 100644 --- a/.github/workflows/python_tests.yaml +++ b/.github/workflows/python_tests.yaml @@ -4,6 +4,7 @@ on: branches: - develop - 'release/*' + - uwtools_integration pull_request: branches: - develop @@ -43,6 +44,7 @@ jobs: pylint ush/generate_FV3LAM_wflow.py pylint ush/set_fv3nml*.py pylint ush/update_input_nml.py + pylint scripts/*.py - name: Run python unittests run: | diff --git a/parm/wflow/coldstart.yaml b/parm/wflow/coldstart.yaml index 7620cbf107..99ed689666 100644 --- a/parm/wflow/coldstart.yaml +++ b/parm/wflow/coldstart.yaml @@ -104,7 +104,7 @@ metatask_run_ensemble: <<: *default_task command: cyclestr: - value: 'source &USHdir;/load_modules_wflow.sh {{ user.MACHINE }} ; &SCRIPTSdir;/chgres_cube.py + value: 'source &USHdir;/load_modules_wflow.sh {{ user.MACHINE }} && &SCRIPTSdir;/chgres_cube.py -c &GLOBAL_VAR_DEFNS_FP; --cycle @Y-@m-@dT@H:@M:@S --key-path task_make_ics @@ -155,7 +155,7 @@ metatask_run_ensemble: <<: *default_task command: cyclestr: - value: 'source &USHdir;/load_modules_wflow.sh {{ user.MACHINE }} ; &SCRIPTSdir;/chgres_cube.py + value: 'source &USHdir;/load_modules_wflow.sh {{ user.MACHINE }} && &SCRIPTSdir;/chgres_cube.py -c &GLOBAL_VAR_DEFNS_FP; --cycle @Y-@m-@dT@H:@M:@S --key-path task_make_lbcs diff --git a/parm/wflow/post.yaml b/parm/wflow/post.yaml index b528341d1e..318f288852 100644 --- a/parm/wflow/post.yaml +++ b/parm/wflow/post.yaml @@ -12,7 +12,7 @@ metatask_run_ens_post: maxtries: '2' command: cyclestr: - value: 'source &USHdir;/load_modules_wflow.sh {{ user.MACHINE }} ; &SCRIPTSdir;/upp.py + value: 'source &USHdir;/load_modules_wflow.sh {{ user.MACHINE }} && &SCRIPTSdir;/upp.py -c &GLOBAL_VAR_DEFNS_FP; --cycle @Y-@m-@dT@H:@M:@S --leadtime #fhr#:00:00 diff --git a/parm/wflow/prep.yaml b/parm/wflow/prep.yaml index e2c9a130b0..cf6b60fd2a 100644 --- a/parm/wflow/prep.yaml +++ b/parm/wflow/prep.yaml @@ -28,7 +28,7 @@ task_make_grid: task_make_orog: <<: *default_task - command: 'source &USHdir;/load_modules_wflow.sh {{ user.MACHINE }} ; &SCRIPTSdir;/make_orog.py + command: 'source &USHdir;/load_modules_wflow.sh {{ user.MACHINE }} && &SCRIPTSdir;/make_orog.py -c &GLOBAL_VAR_DEFNS_FP; --key-path task_make_orog' join: @@ -52,7 +52,7 @@ task_make_orog: task_make_sfc_climo: <<: *default_task - command: 'source &USHdir;/load_modules_wflow.sh {{ user.MACHINE }}; &SCRIPTSdir;/make_sfc_climo.py + command: 'source &USHdir;/load_modules_wflow.sh {{ user.MACHINE }} && &SCRIPTSdir;/make_sfc_climo.py -c &GLOBAL_VAR_DEFNS_FP; --key-path task_make_sfc_climo' join: diff --git a/scripts/exregional_integration_test.py b/scripts/exregional_integration_test.py index 996cf6320e..69f84795a5 100755 --- a/scripts/exregional_integration_test.py +++ b/scripts/exregional_integration_test.py @@ -1,56 +1,61 @@ #!/usr/bin/env python3 -################################################################################ -#### Python Script Documentation Block -# -# Script name: exregional_integration_test.py -# Script description: Ensures the correct number of netcdf files are generated -# for each experiment -# -# Author: Eddie Snyder Org: NOAA EPIC Date: 2024-02-05 -# -# Instructions: 1. Pass the appropriate info for the required arguments: -# --fcst_dir=/path/to/forecast/files -# --fcst_len= -# 2. Run script with arguments -# -# Notes/future work: - Currently SRW App only accepts netcdf as the UFS WM -# output file format. If that changes, then additional -# logic is needed to address the other file formats. -# - SRW App doesn't have a variable that updates the -# forecast increment. The UFS WM does with the -# output_fh variable, which can be found in the -# model_configure file. If it becomes available with -# the SRW App, then logic is needed to account for the -# forecast increment variable. -# -################################################################################ +""" +Python Script Documentation Block + + Script name: exregional_integration_test.py + Script description: Ensures the correct number of netcdf files are generated + for each experiment + + Author: Eddie Snyder Org: NOAA EPIC Date: 2024-02-05 + + Instructions: 1. Pass the appropriate info for the required arguments: + --fcst_dir=/path/to/forecast/files + --fcst_len= + 2. Run script with arguments + + Notes/future work: - Currently SRW App only accepts netcdf as the UFS WM + output file format. If that changes, then additional + logic is needed to address the other file formats. + - SRW App doesn't have a variable that updates the + forecast increment. The UFS WM does with the + output_fh variable, which can be found in the + model_configure file. If it becomes available with + the SRW App, then logic is needed to account for the + forecast increment variable. + +""" # -------------Import modules --------------------------# -import os -import sys -import logging import argparse +import logging +import sys import unittest +from pathlib import Path # --------------Define some functions ------------------# class TestExptFiles(unittest.TestCase): - fcst_dir = '' - filename_list = '' + """ + Set up the test for expected output files. + """ + + fcst_dir = "" + filename_list = "" def test_fcst_files(self): - + """ + Test that expected files exist. + """ for filename in self.filename_list: - filename_fp = "{0}/{1}".format(self.fcst_dir, filename) + filename_fp = self.fcst_dir / filename + logging.info(f"Checking existence of: {str(filename_fp)}") + err_msg = f"Missing file: {str(filename_fp)}" + self.assertTrue(filename_fp.exists(), err_msg) - logging.info("Checking existence of: {0}".format(filename_fp)) - err_msg = "Missing file: {0}".format(filename_fp) - self.assertTrue(os.path.exists(filename_fp), err_msg) def setup_logging(debug=False): - """Calls initialization functions for logging package, and sets the user-defined level for logging in the script.""" @@ -71,11 +76,13 @@ def setup_logging(debug=False): "--fcst_dir", help="Directory to forecast files.", required=True, + type=Path, ) parser.add_argument( "--fcst_len", help="Forecast length.", required=True, + type=int, ) parser.add_argument( "--fcst_inc", @@ -89,46 +96,39 @@ def setup_logging(debug=False): help="Print debug messages.", required=False, ) - parser.add_argument('unittest_args', nargs='*') + parser.add_argument("unittest_args", nargs="*") args = parser.parse_args() sys.argv[1:] = args.unittest_args - - fcst_dir = str(args.fcst_dir) - fcst_len = int(args.fcst_len) - fcst_inc = int(args.fcst_inc) # Start logger setup_logging() # Check if model_configure exists - model_configure_fp = "{0}/model_configure".format(fcst_dir) + MODEL_CONFIGURE_FP = args.fcst_dir / "model_configure" - if not os.path.isfile(model_configure_fp): - logging.error("Experiments model_configure file is missing! Exiting!") + if not MODEL_CONFIGURE_FP.is_file(): + logging.error("Experiment's model_configure file is missing! Exiting!") sys.exit(1) # Loop through model_configure file to find the netcdf base names - f = open(model_configure_fp, 'r') - - for line in f: - if line.startswith("filename_base"): - filename_base_1 = line.split("'")[1] - filename_base_2 = line.split("'")[3] - break - f.close() + with open(MODEL_CONFIGURE_FP, "r", encoding="utf-8") as f: + for line in f: + if line.startswith("filename_base"): + filename_base_1 = line.split("'")[1] + filename_base_2 = line.split("'")[3] + break # Create list of expected filenames from the experiment - fcst_len = fcst_len + 1 filename_list = [] - for x in range(0, fcst_len, fcst_inc): + for x in range(0, args.fcst_len + 1, args.fcst_inc): fhour = str(x).zfill(3) - filename_1 = "{0}f{1}.nc".format(filename_base_1, fhour) - filename_2 = "{0}f{1}.nc".format(filename_base_2, fhour) + filename_1 = f"{filename_base_1}f{fhour}.nc" + filename_2 = f"{filename_base_2}f{fhour}.nc" filename_list.append(filename_1) filename_list.append(filename_2) - # Call unittest class - TestExptFiles.fcst_dir = fcst_dir + # Call unittest class + TestExptFiles.fcst_dir = args.fcst_dir TestExptFiles.filename_list = filename_list unittest.main() diff --git a/scripts/exregional_make_ics.sh b/scripts/exregional_make_ics.sh deleted file mode 100755 index f9c7a063da..0000000000 --- a/scripts/exregional_make_ics.sh +++ /dev/null @@ -1,838 +0,0 @@ -#!/usr/bin/env bash - -# -#----------------------------------------------------------------------- -# -# The ex-scrtipt that sets up and runs chgres_cube for preparing initial -# conditions for the FV3 forecast -# -# Run-time environment variables: -# -# COMIN -# COMOUT -# COMROOT -# DATA -# DATAROOT -# DATA_SHARE -# EXTRN_MDL_CDATE -# GLOBAL_VAR_DEFNS_FP -# INPUT_DATA -# NET -# PDY -# REDIRECT_OUT_ERR -# SLASH_ENSMEM_SUBDIR -# -# Experiment variables -# -# user: -# EXECdir -# MACHINE -# PARMdir -# RUN_ENVIR -# USHdir -# -# platform: -# FIXgsm -# PRE_TASK_CMDS -# RUN_CMD_UTILS -# -# workflow: -# CCPP_PHYS_SUITE -# COLDSTART -# CRES -# DATE_FIRST_CYCL -# DOT_OR_USCORE -# EXTRN_MDL_VAR_DEFNS_FN -# FIXlam -# SDF_USES_RUC_LSM -# SDF_USES_THOMPSON_MP -# THOMPSON_MP_CLIMO_FP -# VERBOSE -# -# task_make_ics: -# FVCOM_DIR -# FVCOM_FILE -# FVCOM_WCSTART -# KMP_AFFINITY_MAKE_ICS -# OMP_NUM_THREADS_MAKE_ICS -# OMP_STACKSIZE_MAKE_ICS -# USE_FVCOM -# VCOORD_FILE -# -# task_get_extrn_ics: -# EXTRN_MDL_NAME_ICS -# FV3GFS_FILE_FMT_ICS -# -# global: -# HALO_BLEND -# -# cpl_aqm_parm: -# CPL_AQM -# -# constants: -# NH0 -# NH4 -# TILE_RGNL -# -#----------------------------------------------------------------------- -# - - -# -#----------------------------------------------------------------------- -# -# Source the variable definitions file and the bash utility functions. -# -#----------------------------------------------------------------------- -# -. $USHdir/source_util_funcs.sh -sections=( - user - nco - platform - workflow - global - cpl_aqm_parm - constants - task_get_extrn_ics.envvars - task_make_ics.envvars -) -for sect in ${sections[*]} ; do - source_yaml ${GLOBAL_VAR_DEFNS_FP} ${sect} -done -# -#----------------------------------------------------------------------- -# -# Save current shell options (in a global array). Then set new options -# for this script/function. -# -#----------------------------------------------------------------------- -# -{ save_shell_opts; . $USHdir/preamble.sh; } > /dev/null 2>&1 -# -#----------------------------------------------------------------------- -# -# Get the full path to the file in which this script/function is located -# (scrfunc_fp), the name of that file (scrfunc_fn), and the directory in -# which the file is located (scrfunc_dir). -# -#----------------------------------------------------------------------- -# -scrfunc_fp=$( $READLINK -f "${BASH_SOURCE[0]}" ) -scrfunc_fn=$( basename "${scrfunc_fp}" ) -scrfunc_dir=$( dirname "${scrfunc_fp}" ) -# -#----------------------------------------------------------------------- -# -# Print message indicating entry into script. -# -#----------------------------------------------------------------------- -# -print_info_msg " -======================================================================== -Entering script: \"${scrfunc_fn}\" -In directory: \"${scrfunc_dir}\" - -This is the ex-script for the task that generates initial condition -(IC), surface, and zeroth hour lateral boundary condition (LBC0) files -(in NetCDF format) for the FV3-LAM. -========================================================================" -# -#----------------------------------------------------------------------- -# -# Set OpenMP variables. -# -#----------------------------------------------------------------------- -# -export KMP_AFFINITY=${KMP_AFFINITY_MAKE_ICS} -export OMP_NUM_THREADS=${OMP_NUM_THREADS_MAKE_ICS} -export OMP_STACKSIZE=${OMP_STACKSIZE_MAKE_ICS} -# -#----------------------------------------------------------------------- -# -# Set machine-dependent parameters. -# -#----------------------------------------------------------------------- -# -eval ${PRE_TASK_CMDS} - -if [ -z "${RUN_CMD_UTILS:-}" ] ; then - print_err_msg_exit "\ - Run command was not set in machine file. \ - Please set RUN_CMD_UTILS for your platform" -else - print_info_msg "$VERBOSE" " - All executables will be submitted with command \'${RUN_CMD_UTILS}\'." -fi - - -# -#----------------------------------------------------------------------- -# -# Source the file containing definitions of variables associated with the -# external model for ICs. -# -#----------------------------------------------------------------------- -# -if [ $RUN_ENVIR = "nco" ]; then - extrn_mdl_staging_dir="${DATAROOT}/get_extrn_ics.${share_pid}${SLASH_ENSMEM_SUBDIR}" - extrn_mdl_var_defns_fp="${extrn_mdl_staging_dir}/${NET}.${cycle}.${EXTRN_MDL_NAME_ICS}.ICS.${EXTRN_MDL_VAR_DEFNS_FN}.sh" -else - extrn_mdl_staging_dir="${COMIN}/${EXTRN_MDL_NAME_ICS}/for_ICS${SLASH_ENSMEM_SUBDIR}" - extrn_mdl_var_defns_fp="${extrn_mdl_staging_dir}/${EXTRN_MDL_VAR_DEFNS_FN}.sh" -fi -. ${extrn_mdl_var_defns_fp} -# -#----------------------------------------------------------------------- -# -# Set physics-suite-dependent variable mapping table needed in the FORTRAN -# namelist file that the chgres_cube executable will read in. -# -#----------------------------------------------------------------------- -# -varmap_file="" - -case "${CCPP_PHYS_SUITE}" in -# - "FV3_GFS_2017_gfdlmp" | \ - "FV3_GFS_2017_gfdlmp_regional" | \ - "FV3_GFS_v16" | \ - "FV3_GFS_v15p2" ) - varmap_file="GFSphys_var_map.txt" - ;; -# - "FV3_RRFS_v1beta" | \ - "FV3_GFS_v15_thompson_mynn_lam3km" | \ - "FV3_GFS_v17_p8" | \ - "FV3_WoFS_v0" | \ - "FV3_HRRR" | \ - "FV3_RAP" ) - if [ "${EXTRN_MDL_NAME_ICS}" = "RAP" ] || \ - [ "${EXTRN_MDL_NAME_ICS}" = "RRFS" ] || \ - [ "${EXTRN_MDL_NAME_ICS}" = "HRRR" ]; then - varmap_file="GSDphys_var_map.txt" - elif [ "${EXTRN_MDL_NAME_ICS}" = "NAM" ] || \ - [ "${EXTRN_MDL_NAME_ICS}" = "FV3GFS" ] || \ - [ "${EXTRN_MDL_NAME_ICS}" = "UFS-CASE-STUDY" ] || \ - [ "${EXTRN_MDL_NAME_ICS}" = "GEFS" ] || \ - [ "${EXTRN_MDL_NAME_ICS}" = "GDAS" ] || \ - [ "${EXTRN_MDL_NAME_ICS}" = "GSMGFS" ]; then - varmap_file="GFSphys_var_map.txt" - fi - ;; -# - *) - message_txt="The variable \"varmap_file\" has not yet been specified for -this physics suite (CCPP_PHYS_SUITE): - CCPP_PHYS_SUITE = \"${CCPP_PHYS_SUITE}\"" - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_exit "${message_txt}" - else - print_err_msg_exit "${message_txt}" - fi - ;; -# -esac -# -#----------------------------------------------------------------------- -# -# Set external-model-dependent variables that are needed in the FORTRAN -# namelist file that the chgres_cube executable will read in. These are de- -# scribed below. Note that for a given external model, usually only a -# subset of these all variables are set (since some may be irrelevant). -# -# external_model: -# Name of the external model from which we are obtaining the fields -# needed to generate the ICs. -# -# fn_atm: -# Name (not including path) of the nemsio or netcdf file generated by the -# external model that contains the atmospheric fields. Currently used for -# GSMGFS and FV3GFS external model data. -# -# fn_sfc: -# Name (not including path) of the nemsio or netcdf file generated by the -# external model that contains the surface fields. Currently used for -# GSMGFS and FV3GFS external model data. -# -# fn_grib2: -# Name (not including path) of the grib2 file generated by the external -# model. Currently used for NAM, RAP, and HRRR/RRFS external model data. -# -# input_type: -# The "type" of input being provided to chgres_cube. This contains a combi- -# nation of information on the external model, external model file for- -# mat, and maybe other parameters. For clarity, it would be best to -# eliminate this variable in chgres_cube and replace with with 2 or 3 others -# (e.g. extrn_mdl, extrn_mdl_file_format, etc). -# -# tracers_input: -# List of atmospheric tracers to read in from the external model file -# containing these tracers. -# -# tracers: -# Names to use in the output NetCDF file for the atmospheric tracers -# specified in tracers_input. With the possible exception of GSD phys- -# ics, the elements of this array should have a one-to-one correspond- -# ence with the elements in tracers_input, e.g. if the third element of -# tracers_input is the name of the O3 mixing ratio, then the third ele- -# ment of tracers should be the name to use for the O3 mixing ratio in -# the output file. For GSD physics, three additional tracers -- ice, -# rain, and water number concentrations -- may be specified at the end -# of tracers, and these will be calculated by chgres_cube. -# -# nsoill_out: -# The number of soil layers to include in the output NetCDF file. -# -# FIELD_from_climo, where FIELD = "vgtyp", "sotyp", "vgfrc", "lai", or -# "minmax_vgfrc": -# Logical variable indicating whether or not to obtain the field in -# question from climatology instead of the external model. The field in -# question is one of vegetation type (FIELD="vgtyp"), soil type (FIELD= -# "sotyp"), vegetation fraction (FIELD="vgfrc"), leaf area index -# (FIELD="lai"), or min/max areal fractional coverage of annual green -# vegetation (FIELD="minmax_vfrr"). If FIELD_from_climo is set to -# ".true.", then the field is obtained from climatology (regardless of -# whether or not it exists in an external model file). If it is set -# to ".false.", then the field is obtained from the external model. -# If "false" is chosen and the external model file does not provide -# this field, then chgres_cube prints out an error message and stops. -# -# tg3_from_soil: -# Logical variable indicating whether or not to set the tg3 soil tempe- # Needs to be verified. -# rature field to the temperature of the deepest soil layer. -# -#----------------------------------------------------------------------- -# - -# GSK comments about chgres: -# -# The following are the three atmsopheric tracers that are in the atmo- -# spheric analysis (atmanl) nemsio file for CDATE=2017100700: -# -# "spfh","o3mr","clwmr" -# -# Note also that these are hardcoded in the code (file input_data.F90, -# subroutine read_input_atm_gfs_spectral_file), so that subroutine will -# break if tracers_input(:) is not specified as above. -# -# Note that there are other fields too ["hgt" (surface height (togography?)), -# pres (surface pressure), ugrd, vgrd, and tmp (temperature)] in the atmanl file, but those -# are not considered tracers (they're categorized as dynamics variables, -# I guess). -# -# Another note: The way things are set up now, tracers_input(:) and -# tracers(:) are assumed to have the same number of elements (just the -# atmospheric tracer names in the input and output files may be differ- -# ent). There needs to be a check for this in the chgres_cube code!! -# If there was a varmap table that specifies how to handle missing -# fields, that would solve this problem. -# -# Also, it seems like the order of tracers in tracers_input(:) and -# tracers(:) must match, e.g. if ozone mixing ratio is 3rd in -# tracers_input(:), it must also be 3rd in tracers(:). How can this be checked? -# -# NOTE: Really should use a varmap table for GFS, just like we do for -# RAP/HRRR/RRFS. -# -# A non-prognostic variable that appears in the field_table for GSD physics -# is cld_amt. Why is that in the field_table at all (since it is a non- -# prognostic field), and how should we handle it here?? -# I guess this works for FV3GFS but not for the spectral GFS since these -# variables won't exist in the spectral GFS atmanl files. -# tracers_input="\"sphum\",\"liq_wat\",\"ice_wat\",\"rainwat\",\"snowwat\",\"graupel\",\"o3mr\"" -# -# Not sure if tracers(:) should include "cld_amt" since that is also in -# the field_table for CDATE=2017100700 but is a non-prognostic variable. - -external_model="" -fn_atm="" -fn_sfc="" -fn_grib2="" -input_type="" -tracers_input="\"\"" -tracers="\"\"" -nsoill_out="" -geogrid_file_input_grid="\"\"" -vgtyp_from_climo="" -sotyp_from_climo="" -vgfrc_from_climo="" -minmax_vgfrc_from_climo="" -lai_from_climo="" -tg3_from_soil="" -convert_nst="" -# -#----------------------------------------------------------------------- -# -# If the external model is not one that uses the RUC land surface model -# (LSM) -- which currently includes all valid external models except the -# HRRR/RRFS and the RAP -- then we set the number of soil levels to include -# in the output NetCDF file that chgres_cube generates (nsoill_out; this -# is a variable in the namelist that chgres_cube reads in) to 4. This -# is because FV3 can handle this regardless of the LSM that it is using -# (which is specified in the suite definition file, or SDF), as follows. -# If the SDF does not use the RUC LSM (i.e. it uses the Noah or Noah MP -# LSM), then it will expect to see 4 soil layers; and if the SDF uses -# the RUC LSM, then the RUC LSM itself has the capability to regrid from -# 4 soil layers to the 9 layers that it uses. -# -# On the other hand, if the external model is one that uses the RUC LSM -# (currently meaning that it is either the HRRR/RRFS or the RAP), then what -# we set nsoill_out to depends on whether the RUC or the Noah/Noah MP -# LSM is used in the SDF. If the SDF uses RUC, then both the external -# model and FV3 use RUC (which expects 9 soil levels), so we simply set -# nsoill_out to 9. In this case, chgres_cube does not need to do any -# regridding of soil levels (because the number of levels in is the same -# as the number out). If the SDF uses the Noah or Noah MP LSM, then the -# output from chgres_cube must contain 4 soil levels because that is what -# these LSMs expect, and the code in FV3 does not have the capability to -# regrid from the 9 levels in the external model to the 4 levels expected -# by Noah/Noah MP. In this case, chgres_cube does the regridding from -# 9 to 4 levels. -# -# In summary, we can set nsoill_out to 4 unless the external model is -# the HRRR/RRFS or RAP AND the forecast model is using the RUC LSM. -# -#----------------------------------------------------------------------- -# -nsoill_out="4" -if [ "${EXTRN_MDL_NAME_ICS}" = "HRRR" -o \ - "${EXTRN_MDL_NAME_ICS}" = "RRFS" -o \ - "${EXTRN_MDL_NAME_ICS}" = "RAP" ] && \ - [ $(boolify "${SDF_USES_RUC_LSM}") = "TRUE" ]; then - nsoill_out="9" -fi -# -#----------------------------------------------------------------------- -# -# If the external model for ICs is one that does not provide the aerosol -# fields needed by Thompson microphysics (currently only the HRRR/RRFS and -# RAP provide aerosol data) and if the physics suite uses Thompson -# microphysics, set the variable thomp_mp_climo_file in the chgres_cube -# namelist to the full path of the file containing aerosol climatology -# data. In this case, this file will be used to generate approximate -# aerosol fields in the ICs that Thompson MP can use. Otherwise, set -# thomp_mp_climo_file to a null string. -# -#----------------------------------------------------------------------- -# -thomp_mp_climo_file="" -if [ "${EXTRN_MDL_NAME_ICS}" != "HRRR" -a \ - "${EXTRN_MDL_NAME_ICS}" != "RRFS" -a \ - "${EXTRN_MDL_NAME_ICS}" != "RAP" ] && \ - [ $(boolify "${SDF_USES_THOMPSON_MP}") = "TRUE" ]; then - thomp_mp_climo_file="${THOMPSON_MP_CLIMO_FP}" -fi -# -#----------------------------------------------------------------------- -# -# Set other chgres_cube namelist variables depending on the external -# model used. -# -#----------------------------------------------------------------------- -# -case "${EXTRN_MDL_NAME_ICS}" in - -"GSMGFS") - external_model="GSMGFS" - fn_atm="${EXTRN_MDL_FNS[0]}" - fn_sfc="${EXTRN_MDL_FNS[1]}" - input_type="gfs_gaussian_nemsio" # For spectral GFS Gaussian grid in nemsio format. - convert_nst=False - tracers_input="[\"spfh\",\"clwmr\",\"o3mr\"]" - tracers="[\"sphum\",\"liq_wat\",\"o3mr\"]" - vgtyp_from_climo=True - sotyp_from_climo=True - vgfrc_from_climo=True - minmax_vgfrc_from_climo=True - lai_from_climo=True - tg3_from_soil=False - ;; - -"FV3GFS") - if [ "${FV3GFS_FILE_FMT_ICS}" = "nemsio" ]; then - external_model="FV3GFS" - input_type="gaussian_nemsio" # For FV3GFS data on a Gaussian grid in nemsio format. - tracers_input="[\"spfh\",\"clwmr\",\"o3mr\",\"icmr\",\"rwmr\",\"snmr\",\"grle\"]" - tracers="[\"sphum\",\"liq_wat\",\"o3mr\",\"ice_wat\",\"rainwat\",\"snowwat\",\"graupel\"]" - fn_atm="${EXTRN_MDL_FNS[0]}" - fn_sfc="${EXTRN_MDL_FNS[1]}" - convert_nst=True - elif [ "${FV3GFS_FILE_FMT_ICS}" = "grib2" ]; then - external_model="GFS" - fn_grib2="${EXTRN_MDL_FNS[0]}" - input_type="grib2" - convert_nst=False - elif [ "${FV3GFS_FILE_FMT_ICS}" = "netcdf" ]; then - external_model="FV3GFS" - input_type="gaussian_netcdf" # For FV3GFS data on a Gaussian grid in netcdf format. - tracers_input="[\"spfh\",\"clwmr\",\"o3mr\",\"icmr\",\"rwmr\",\"snmr\",\"grle\"]" - tracers="[\"sphum\",\"liq_wat\",\"o3mr\",\"ice_wat\",\"rainwat\",\"snowwat\",\"graupel\"]" - fn_atm="${EXTRN_MDL_FNS[0]}" - fn_sfc="${EXTRN_MDL_FNS[1]}" - convert_nst=True - fi - vgtyp_from_climo=True - sotyp_from_climo=True - vgfrc_from_climo=True - minmax_vgfrc_from_climo=True - lai_from_climo=True - tg3_from_soil=False - ;; - -"UFS-CASE-STUDY") - hh="${EXTRN_MDL_CDATE:8:2}" - if [ "${FV3GFS_FILE_FMT_ICS}" = "nemsio" ]; then - external_model="UFS-CASE-STUDY" - input_type="gaussian_nemsio" - tracers_input="[\"spfh\",\"clwmr\",\"o3mr\",\"icmr\",\"rwmr\",\"snmr\",\"grle\"]" - tracers="[\"sphum\",\"liq_wat\",\"o3mr\",\"ice_wat\",\"rainwat\",\"snowwat\",\"graupel\"]" - fn_atm="gfs.t${hh}z.atmanl.nemsio" - fn_sfc="gfs.t${hh}z.sfcanl.nemsio" - convert_nst=True - fi - vgtyp_from_climo=True - sotyp_from_climo=True - vgfrc_from_climo=True - minmax_vgfrc_from_climo=True - lai_from_climo=True - tg3_from_soil=False - unset hh - ;; - -"GDAS") - if [ "${FV3GFS_FILE_FMT_ICS}" = "nemsio" ]; then - input_type="gaussian_nemsio" - elif [ "${FV3GFS_FILE_FMT_ICS}" = "netcdf" ]; then - input_type="gaussian_netcdf" - fi - external_model="GFS" - tracers_input="[\"spfh\",\"clwmr\",\"o3mr\",\"icmr\",\"rwmr\",\"snmr\",\"grle\"]" - tracers="[\"sphum\",\"liq_wat\",\"o3mr\",\"ice_wat\",\"rainwat\",\"snowwat\",\"graupel\"]" - convert_nst=False - fn_atm="${EXTRN_MDL_FNS[0]}" - fn_sfc="${EXTRN_MDL_FNS[1]}" - vgtyp_from_climo=True - sotyp_from_climo=True - vgfrc_from_climo=True - minmax_vgfrc_from_climo=True - lai_from_climo=True - tg3_from_soil=True - ;; - -"GEFS") - external_model="GFS" - fn_grib2="${EXTRN_MDL_FNS[0]}" - input_type="grib2" - convert_nst=False - vgtyp_from_climo=True - sotyp_from_climo=True - vgfrc_from_climo=True - minmax_vgfrc_from_climo=True - lai_from_climo=True - tg3_from_soil=False - ;; - -"HRRR"|"RRFS") - external_model="HRRR" - - fn_grib2="${EXTRN_MDL_FNS[0]}" - input_type="grib2" -# -# Path to the HRRRX geogrid file. -# - geogrid_file_input_grid="${FIXgsm}/geo_em.d01.nc_HRRRX" -# Note that vgfrc, shdmin/shdmax (minmax_vgfrc), and lai fields are only available in HRRRX -# files after mid-July 2019, and only so long as the record order didn't change afterward - vgtyp_from_climo=True - sotyp_from_climo=True - vgfrc_from_climo=True - minmax_vgfrc_from_climo=True - lai_from_climo=True - tg3_from_soil=True - convert_nst=False - ;; - -"RAP") - external_model="RAP" - fn_grib2="${EXTRN_MDL_FNS[0]}" - input_type="grib2" -# -# Path to the RAPX geogrid file. -# - geogrid_file_input_grid="${FIXgsm}/geo_em.d01.nc_RAPX" - vgtyp_from_climo=True - sotyp_from_climo=True - vgfrc_from_climo=True - minmax_vgfrc_from_climo=True - lai_from_climo=True - tg3_from_soil=True - convert_nst=False - ;; - -"NAM") - external_model="NAM" - fn_grib2="${EXTRN_MDL_FNS[0]}" - input_type="grib2" - vgtyp_from_climo=True - sotyp_from_climo=True - vgfrc_from_climo=True - minmax_vgfrc_from_climo=True - lai_from_climo=True - tg3_from_soil=False - convert_nst=False - ;; - -*) - message_txt="External-model-dependent namelist variables have not yet been specified -for this external IC model (EXTRN_MDL_NAME_ICS): - EXTRN_MDL_NAME_ICS = \"${EXTRN_MDL_NAME_ICS}\"" - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_exit "${message_txt}" - else - print_err_msg_exit "${message_txt}" - fi - ;; - -esac -# -#----------------------------------------------------------------------- -# -# Get the starting month, day, and hour of the the external model forecast. -# -#----------------------------------------------------------------------- -# -mm="${EXTRN_MDL_CDATE:4:2}" -dd="${EXTRN_MDL_CDATE:6:2}" -hh="${EXTRN_MDL_CDATE:8:2}" -# -#----------------------------------------------------------------------- -# -# Check that the executable that generates the ICs exists. -# -#----------------------------------------------------------------------- -# -exec_fn="chgres_cube" -exec_fp="$EXECdir/${exec_fn}" -if [ ! -f "${exec_fp}" ]; then - message_txt="The executable (exec_fp) for generating initial conditions -on the FV3-LAM native grid does not exist: - exec_fp = \"${exec_fp}\" -Please ensure that you've built this executable." - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_exit "${message_txt}" - else - print_err_msg_exit "${message_txt}" - fi -fi -# -#----------------------------------------------------------------------- -# -# Build the FORTRAN namelist file that chgres_cube will read in. -# -#----------------------------------------------------------------------- -# -# Create a multiline variable that consists of a yaml-compliant string -# specifying the values that the namelist variables need to be set to -# (one namelist variable per line, plus a header and footer). Below, -# this variable will be passed to a python script that will create the -# namelist file. -# -# IMPORTANT: -# If we want a namelist variable to be removed from the namelist file, -# in the "settings" variable below, we need to set its value to the -# string "null". -# -settings=" -'config': - 'fix_dir_target_grid': ${FIXlam} - 'mosaic_file_target_grid': ${FIXlam}/${CRES}${DOT_OR_USCORE}mosaic.halo$((10#${NH4})).nc - 'orog_dir_target_grid': ${FIXlam} - 'orog_files_target_grid': ${CRES}${DOT_OR_USCORE}oro_data.tile${TILE_RGNL}.halo$((10#${NH4})).nc - 'vcoord_file_target_grid': ${VCOORD_FILE} - 'varmap_file': ${PARMdir}/ufs_utils/varmap_tables/${varmap_file} - 'data_dir_input_grid': ${extrn_mdl_staging_dir} - 'atm_files_input_grid': ${fn_atm} - 'sfc_files_input_grid': ${fn_sfc} - 'grib2_file_input_grid': \"${fn_grib2}\" - 'cycle_mon': $((10#${mm})) - 'cycle_day': $((10#${dd})) - 'cycle_hour': $((10#${hh})) - 'convert_atm': True - 'convert_sfc': True - 'convert_nst': ${convert_nst} - 'regional': 1 - 'halo_bndy': $((10#${NH4})) - 'halo_blend': $((10#${HALO_BLEND})) - 'input_type': ${input_type} - 'external_model': ${external_model} - 'tracers_input': ${tracers_input} - 'tracers': ${tracers} - 'nsoill_out': $((10#${nsoill_out})) - 'geogrid_file_input_grid': ${geogrid_file_input_grid} - 'vgtyp_from_climo': ${vgtyp_from_climo} - 'sotyp_from_climo': ${sotyp_from_climo} - 'vgfrc_from_climo': ${vgfrc_from_climo} - 'minmax_vgfrc_from_climo': ${minmax_vgfrc_from_climo} - 'lai_from_climo': ${lai_from_climo} - 'tg3_from_soil': ${tg3_from_soil} - 'thomp_mp_climo_file': ${thomp_mp_climo_file} -" - - -nml_fn="fort.41" - -(cat << EOF -$settings -EOF -) | uw config realize \ - --input-format yaml \ - -o ${nml_fn} \ - --output-format nml\ - -v \ - -err=$? -if [ $err -ne 0 ]; then - message_txt="Error creating namelist read by ${exec_fn} failed. - Settings for input are: -$settings" - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_exit "${message_txt}" - else - print_err_msg_exit "${message_txt}" - fi -fi - -# -#----------------------------------------------------------------------- -# -# Run chgres_cube. -# -#----------------------------------------------------------------------- -# -# NOTE: -# Often when the chgres_cube.exe run fails, it still returns a zero -# return code, so the failure isn't picked up the the logical OR (||) -# below. That should be fixed. This might be due to the RUN_CMD_UTILS -# command - maybe that is returning a zero exit code even though the -# exit code of chgres_cube is nonzero. A similar thing happens in the -# forecast task. -# -PREP_STEP -eval ${RUN_CMD_UTILS} ${exec_fp} ${REDIRECT_OUT_ERR} || \ - print_err_msg_exit "\ -Call to executable (exec_fp) to generate surface and initial conditions -(ICs) files for the FV3-LAM failed: - exec_fp = \"${exec_fp}\" -The external model from which the ICs files are to be generated is: - EXTRN_MDL_NAME_ICS = \"${EXTRN_MDL_NAME_ICS}\" -The external model files that are inputs to the executable (exec_fp) are -located in the following directory: - extrn_mdl_staging_dir = \"${extrn_mdl_staging_dir}\"" -POST_STEP -# -#----------------------------------------------------------------------- -# -# Move initial condition, surface, control, and 0-th hour lateral bound- -# ary files to ICs_BCs directory. -# -#----------------------------------------------------------------------- -# -if [ $(boolify "${CPL_AQM}") = "TRUE" ]; then - COMOUT="${COMROOT}/${NET}/${model_ver}/${RUN}.${PDY}/${cyc}${SLASH_ENSMEM_SUBDIR}" #temporary path, should be removed later - if [ $(boolify "${COLDSTART}") = "TRUE" ] && [ "${PDY}${cyc}" = "${DATE_FIRST_CYCL:0:10}" ]; then - data_trans_path="${COMOUT}" - else - data_trans_path="${DATA_SHARE}" - fi - cp -p out.atm.tile${TILE_RGNL}.nc "${data_trans_path}/${NET}.${cycle}${dot_ensmem}.gfs_data.tile${TILE_RGNL}.halo${NH0}.nc" - cp -p out.sfc.tile${TILE_RGNL}.nc "${COMOUT}/${NET}.${cycle}${dot_ensmem}.sfc_data.tile${TILE_RGNL}.halo${NH0}.nc" - cp -p gfs_ctrl.nc "${COMOUT}/${NET}.${cycle}${dot_ensmem}.gfs_ctrl.nc" - cp -p gfs.bndy.nc "${DATA_SHARE}/${NET}.${cycle}${dot_ensmem}.gfs_bndy.tile${TILE_RGNL}.f000.nc" -else - mv out.atm.tile${TILE_RGNL}.nc ${INPUT_DATA}/${NET}.${cycle}${dot_ensmem}.gfs_data.tile${TILE_RGNL}.halo${NH0}.nc - mv out.sfc.tile${TILE_RGNL}.nc ${INPUT_DATA}/${NET}.${cycle}${dot_ensmem}.sfc_data.tile${TILE_RGNL}.halo${NH0}.nc - mv gfs_ctrl.nc ${INPUT_DATA}/${NET}.${cycle}${dot_ensmem}.gfs_ctrl.nc - mv gfs.bndy.nc ${INPUT_DATA}/${NET}.${cycle}${dot_ensmem}.gfs_bndy.tile${TILE_RGNL}.f000.nc -fi -# -#----------------------------------------------------------------------- -# -# Process FVCOM Data -# -#----------------------------------------------------------------------- -# -if [ $(boolify "${USE_FVCOM}") = "TRUE" ]; then - -#Format for fvcom_time: YYYY-MM-DDTHH:00:00.000000 - fvcom_exec_fn="fvcom_to_FV3" - fvcom_exec_fp="$EXECdir/${fvcom_exec_fn}" - fvcom_time="${DATE_FIRST_CYCL:0:4}-${DATE_FIRST_CYCL:4:2}-${DATE_FIRST_CYCL:6:2}T${DATE_FIRST_CYCL:8:2}:00:00.000000" - if [ ! -f "${fvcom_exec_fp}" ]; then - message_txt="The executable (fvcom_exec_fp) for processing FVCOM data -onto FV3-LAM native grid does not exist: - fvcom_exec_fp = \"${fvcom_exec_fp}\" -Please ensure that you've built this executable." - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_exit "${message_txt}"\ - else - print_err_msg_exit "${message_txt}" - fi - fi - cp ${fvcom_exec_fp} ${INPUT_DATA}/. - fvcom_data_fp="${FVCOM_DIR}/${FVCOM_FILE}" - if [ ! -f "${fvcom_data_fp}" ]; then - message_txt="The file or path (fvcom_data_fp) does not exist: - fvcom_data_fp = \"${fvcom_data_fp}\" -Please check the following user defined variables: - FVCOM_DIR = \"${FVCOM_DIR}\" - FVCOM_FILE= \"${FVCOM_FILE}\" " - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_exit "${message_txt}" - else - print_err_msg_exit "${message_txt}" - fi - fi - - cp ${fvcom_data_fp} ${INPUT_DATA}/fvcom.nc - cd ${INPUT_DATA} - PREP_STEP - eval ${RUN_CMD_UTILS} ${fvcom_exec_fn} \ - ${NET}.${cycle}${dot_ensmem}.sfc_data.tile${TILE_RGNL}.halo${NH0}.nc fvcom.nc ${FVCOM_WCSTART} ${fvcom_time} \ - ${REDIRECT_OUT_ERR} || print_err_msg_exit "\ -Call to executable (fvcom_exe) to modify sfc fields for FV3-LAM failed: - fvcom_exe = \"${fvcom_exe}\" -The following variables were being used: - FVCOM_DIR = \"${FVCOM_DIR}\" - FVCOM_FILE = \"${FVCOM_FILE}\" - fvcom_time = \"${fvcom_time}\" - FVCOM_WCSTART = \"${FVCOM_WCSTART}\" - INPUT_DATA = \"${INPUT_DATA}\" - fvcom_exe_dir = \"${fvcom_exe_dir}\" - fvcom_exe = \"${fvcom_exe}\"" - POST_STEP -fi -# -#----------------------------------------------------------------------- -# -# Print message indicating successful completion of script. -# -#----------------------------------------------------------------------- -# -print_info_msg " -======================================================================== -Initial condition, surface, and zeroth hour lateral boundary condition -files (in NetCDF format) for FV3 generated successfully!!! - -Exiting script: \"${scrfunc_fn}\" -In directory: \"${scrfunc_dir}\" -========================================================================" -# -#----------------------------------------------------------------------- -# -# Restore the shell options saved at the beginning of this script/func- -# tion. -# -#----------------------------------------------------------------------- -# -{ restore_shell_opts; } > /dev/null 2>&1 diff --git a/scripts/exregional_make_lbcs.sh b/scripts/exregional_make_lbcs.sh deleted file mode 100755 index 63a81cfdae..0000000000 --- a/scripts/exregional_make_lbcs.sh +++ /dev/null @@ -1,687 +0,0 @@ -#!/usr/bin/env bash - -# -#----------------------------------------------------------------------- -# -# The ex-scrtipt that sets up and runs chgres_cube for preparing lateral -# boundary conditions for the FV3 forecast -# -# Run-time environment variables: -# -# COMIN -# COMOUT -# COMROOT -# DATA -# DATAROOT -# DATA_SHARE -# EXTRN_MDL_CDATE -# INPUT_DATA -# GLOBAL_VAR_DEFNS_FP -# NET -# PDY -# REDIRECT_OUT_ERR -# SLASH_ENSMEM_SUBDIR -# -# Experiment variables -# -# user: -# EXECdir -# MACHINE -# PARMdir -# RUN_ENVIR -# USHdir -# -# platform: -# FIXgsm -# PRE_TASK_CMDS -# RUN_CMD_UTILS -# -# workflow: -# CCPP_PHYS_SUITE -# COLDSTART -# CRES -# DATE_FIRST_CYCL -# DOT_OR_USCORE -# EXTRN_MDL_VAR_DEFNS_FN -# FIXlam -# SDF_USES_RUC_LSM -# SDF_USES_THOMPSON_MP -# THOMPSON_MP_CLIMO_FP -# VERBOSE -# -# task_get_extrn_lbcs: -# EXTRN_MDL_NAME_LBCS -# FV3GFS_FILE_FMT_LBCS -# -# task_make_lbcs: -# KMP_AFFINITY_MAKE_LBCS -# OMP_NUM_THREADS_MAKE_LBCS -# OMP_STACKSIZE_MAKE_LBCS -# VCOORD_FILE -# -# global: -# HALO_BLEND -# -# cpl_aqm_parm: -# CPL_AQM -# -# constants: -# NH0 -# NH4 -# TILE_RGNL -# -#----------------------------------------------------------------------- -# - - -# -#----------------------------------------------------------------------- -# -# Source the variable definitions file and the bash utility functions. -# -#----------------------------------------------------------------------- -# -. $USHdir/source_util_funcs.sh -set -x -sections=( - user - nco - platform - workflow - global - cpl_aqm_parm - constants - task_get_extrn_lbcs.envvars - task_make_lbcs.envvars -) -for sect in ${sections[*]} ; do - source_yaml ${GLOBAL_VAR_DEFNS_FP} ${sect} -done -# -#----------------------------------------------------------------------- -# -# Save current shell options (in a global array). Then set new options -# for this script/function. -# -#----------------------------------------------------------------------- -# -{ save_shell_opts; . $USHdir/preamble.sh; } > /dev/null 2>&1 -# -#----------------------------------------------------------------------- -# -# Get the full path to the file in which this script/function is located -# (scrfunc_fp), the name of that file (scrfunc_fn), and the directory in -# which the file is located (scrfunc_dir). -# -#----------------------------------------------------------------------- -# -scrfunc_fp=$( $READLINK -f "${BASH_SOURCE[0]}" ) -scrfunc_fn=$( basename "${scrfunc_fp}" ) -scrfunc_dir=$( dirname "${scrfunc_fp}" ) -# -#----------------------------------------------------------------------- -# -# Print message indicating entry into script. -# -#----------------------------------------------------------------------- -# -print_info_msg " -======================================================================== -Entering script: \"${scrfunc_fn}\" -In directory: \"${scrfunc_dir}\" - -This is the ex-script for the task that generates lateral boundary con- -dition (LBC) files (in NetCDF format) for all LBC update hours (except -hour zero). -========================================================================" -# -#----------------------------------------------------------------------- -# -# Set OpenMP variables. -# -#----------------------------------------------------------------------- -# -export KMP_AFFINITY=${KMP_AFFINITY_MAKE_LBCS} -export OMP_NUM_THREADS=${OMP_NUM_THREADS_MAKE_LBCS} -export OMP_STACKSIZE=${OMP_STACKSIZE_MAKE_LBCS} -# -#----------------------------------------------------------------------- -# -# Set machine-dependent parameters. -# -#----------------------------------------------------------------------- -# -eval ${PRE_TASK_CMDS} - -if [ -z "${RUN_CMD_UTILS:-}" ] ; then - print_err_msg_exit "\ - Run command was not set in machine file. \ - Please set RUN_CMD_UTILS for your platform" -else - print_info_msg "$VERBOSE" " - All executables will be submitted with command \'${RUN_CMD_UTILS}\'." -fi -# -#----------------------------------------------------------------------- -# -# Source the file containing definitions of variables associated with the -# external model for LBCs. -# -#----------------------------------------------------------------------- -# -if [ $RUN_ENVIR = "nco" ]; then - extrn_mdl_staging_dir="${DATAROOT}/get_extrn_lbcs.${share_pid}${SLASH_ENSMEM_SUBDIR}" - extrn_mdl_var_defns_fp="${extrn_mdl_staging_dir}/${NET}.${cycle}.${EXTRN_MDL_NAME_LBCS}.LBCS.${EXTRN_MDL_VAR_DEFNS_FN}.sh" -else - extrn_mdl_staging_dir="${COMIN}/${EXTRN_MDL_NAME_LBCS}/for_LBCS${SLASH_ENSMEM_SUBDIR}" - extrn_mdl_var_defns_fp="${extrn_mdl_staging_dir}/${EXTRN_MDL_VAR_DEFNS_FN}.sh" -fi -. ${extrn_mdl_var_defns_fp} -# -#----------------------------------------------------------------------- -# -# Set physics-suite-dependent variable mapping table needed in the FORTRAN -# namelist file that the chgres_cube executable will read in. -# -#----------------------------------------------------------------------- -# -varmap_file="" - -case "${CCPP_PHYS_SUITE}" in -# - "FV3_GFS_2017_gfdlmp" | \ - "FV3_GFS_2017_gfdlmp_regional" | \ - "FV3_GFS_v16" | \ - "FV3_GFS_v15p2" ) - varmap_file="GFSphys_var_map.txt" - ;; -# - "FV3_RRFS_v1beta" | \ - "FV3_GFS_v15_thompson_mynn_lam3km" | \ - "FV3_GFS_v17_p8" | \ - "FV3_WoFS_v0" | \ - "FV3_HRRR" | \ - "FV3_RAP") - if [ "${EXTRN_MDL_NAME_LBCS}" = "RAP" ] || \ - [ "${EXTRN_MDL_NAME_LBCS}" = "RRFS" ] || \ - [ "${EXTRN_MDL_NAME_LBCS}" = "HRRR" ]; then - varmap_file="GSDphys_var_map.txt" - elif [ "${EXTRN_MDL_NAME_LBCS}" = "NAM" ] || \ - [ "${EXTRN_MDL_NAME_LBCS}" = "FV3GFS" ] || \ - [ "${EXTRN_MDL_NAME_LBCS}" = "UFS-CASE-STUDY" ] || \ - [ "${EXTRN_MDL_NAME_LBCS}" = "GEFS" ] || \ - [ "${EXTRN_MDL_NAME_LBCS}" = "GDAS" ] || \ - [ "${EXTRN_MDL_NAME_LBCS}" = "GSMGFS" ]; then - varmap_file="GFSphys_var_map.txt" - fi - ;; -# - *) - message_txt="The variable \"varmap_file\" has not yet been specified -for this physics suite (CCPP_PHYS_SUITE): - CCPP_PHYS_SUITE = \"${CCPP_PHYS_SUITE}\"" - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_exit "${message_txt}" - else - print_err_msg_exit "${message_txt}" - fi - ;; -# -esac -# -#----------------------------------------------------------------------- -# -# Set external-model-dependent variables that are needed in the FORTRAN -# namelist file that the chgres_cube executable will read in. These are de- -# scribed below. Note that for a given external model, usually only a -# subset of these all variables are set (since some may be irrelevant). -# -# external_model: -# Name of the external model from which we are obtaining the fields -# needed to generate the LBCs. -# -# fn_atm: -# Name (not including path) of the nemsio or netcdf file generated by the -# external model that contains the atmospheric fields. Currently used for -# GSMGFS and FV3GFS external model data. -# -# fn_grib2: -# Name (not including path) of the grib2 file generated by the external -# model. Currently used for NAM, RAP, and HRRR/RRFS external model data. -# -# input_type: -# The "type" of input being provided to chgres_cube. This contains a combi- -# nation of information on the external model, external model file for- -# mat, and maybe other parameters. For clarity, it would be best to -# eliminate this variable in chgres_cube and replace with with 2 or 3 others -# (e.g. extrn_mdl, extrn_mdl_file_format, etc). -# -# tracers_input: -# List of atmospheric tracers to read in from the external model file -# containing these tracers. -# -# tracers: -# Names to use in the output NetCDF file for the atmospheric tracers -# specified in tracers_input. With the possible exception of GSD phys- -# ics, the elements of this array should have a one-to-one correspond- -# ence with the elements in tracers_input, e.g. if the third element of -# tracers_input is the name of the O3 mixing ratio, then the third ele- -# ment of tracers should be the name to use for the O3 mixing ratio in -# the output file. For GSD physics, three additional tracers -- ice, -# rain, and water number concentrations -- may be specified at the end -# of tracers, and these will be calculated by chgres_cube. -# -#----------------------------------------------------------------------- -# - -# GSK comments about chgres_cube: -# -# The following are the three atmsopheric tracers that are in the atmo- -# spheric analysis (atmanl) nemsio file for CDATE=2017100700: -# -# "spfh","o3mr","clwmr" -# -# Note also that these are hardcoded in the code (file input_data.F90, -# subroutine read_input_atm_gfs_spectral_file), so that subroutine will -# break if tracers_input(:) is not specified as above. -# -# Note that there are other fields too ["hgt" (surface height (togography?)), -# pres (surface pressure), ugrd, vgrd, and tmp (temperature)] in the atmanl file, but those -# are not considered tracers (they're categorized as dynamics variables, -# I guess). -# -# Another note: The way things are set up now, tracers_input(:) and -# tracers(:) are assumed to have the same number of elements (just the -# atmospheric tracer names in the input and output files may be differ- -# ent). There needs to be a check for this in the chgres_cube code!! -# If there was a varmap table that specifies how to handle missing -# fields, that would solve this problem. -# -# Also, it seems like the order of tracers in tracers_input(:) and -# tracers(:) must match, e.g. if ozone mixing ratio is 3rd in -# tracers_input(:), it must also be 3rd in tracers(:). How can this be checked? -# -# NOTE: Really should use a varmap table for GFS, just like we do for -# RAP/HRRR/RRFS. -# - -# A non-prognostic variable that appears in the field_table for GSD physics -# is cld_amt. Why is that in the field_table at all (since it is a non- -# prognostic field), and how should we handle it here?? - -# I guess this works for FV3GFS but not for the spectral GFS since these -# variables won't exist in the spectral GFS atmanl files. -# tracers_input="\"sphum\",\"liq_wat\",\"ice_wat\",\"rainwat\",\"snowwat\",\"graupel\",\"o3mr\"" -# -# Not sure if tracers(:) should include "cld_amt" since that is also in -# the field_table for CDATE=2017100700 but is a non-prognostic variable. - -external_model="" -fn_atm="" -fn_grib2="" -input_type="" -tracers_input="\"\"" -tracers="\"\"" -# -#----------------------------------------------------------------------- -# -# If the external model for LBCs is one that does not provide the aerosol -# fields needed by Thompson microphysics (currently only the HRRR/RRFS and -# RAP provide aerosol data) and if the physics suite uses Thompson -# microphysics, set the variable thomp_mp_climo_file in the chgres_cube -# namelist to the full path of the file containing aerosol climatology -# data. In this case, this file will be used to generate approximate -# aerosol fields in the LBCs that Thompson MP can use. Otherwise, set -# thomp_mp_climo_file to a null string. -# -#----------------------------------------------------------------------- -# -thomp_mp_climo_file="" -if [ "${EXTRN_MDL_NAME_LBCS}" != "HRRR" -a \ - "${EXTRN_MDL_NAME_LBCS}" != "RRFS" -a \ - "${EXTRN_MDL_NAME_LBCS}" != "RAP" ] && \ - [ $(boolify "${SDF_USES_THOMPSON_MP}") = "TRUE" ]; then - thomp_mp_climo_file="${THOMPSON_MP_CLIMO_FP}" -fi -# -#----------------------------------------------------------------------- -# -# Set other chgres_cube namelist variables depending on the external -# model used. -# -#----------------------------------------------------------------------- -# -case "${EXTRN_MDL_NAME_LBCS}" in - -"GSMGFS") - external_model="GSMGFS" - input_type="gfs_gaussian_nemsio" # For spectral GFS Gaussian grid in nemsio format. - tracers_input="[\"spfh\",\"clwmr\",\"o3mr\"]" - tracers="[\"sphum\",\"liq_wat\",\"o3mr\"]" - ;; - -"FV3GFS") - if [ "${FV3GFS_FILE_FMT_LBCS}" = "nemsio" ]; then - external_model="FV3GFS" - input_type="gaussian_nemsio" # For FV3GFS data on a Gaussian grid in nemsio format. - tracers_input="[\"spfh\",\"clwmr\",\"o3mr\",\"icmr\",\"rwmr\",\"snmr\",\"grle\"]" - tracers="[\"sphum\",\"liq_wat\",\"o3mr\",\"ice_wat\",\"rainwat\",\"snowwat\",\"graupel\"]" - elif [ "${FV3GFS_FILE_FMT_LBCS}" = "grib2" ]; then - external_model="GFS" - fn_grib2="${EXTRN_MDL_FNS[0]}" - input_type="grib2" - elif [ "${FV3GFS_FILE_FMT_LBCS}" = "netcdf" ]; then - external_model="FV3GFS" - input_type="gaussian_netcdf" # For FV3GFS data on a Gaussian grid in netcdf format. - tracers_input="[\"spfh\",\"clwmr\",\"o3mr\",\"icmr\",\"rwmr\",\"snmr\",\"grle\"]" - tracers="[\"sphum\",\"liq_wat\",\"o3mr\",\"ice_wat\",\"rainwat\",\"snowwat\",\"graupel\"]" - fi - ;; - -"UFS-CASE-STUDY") - if [ "${FV3GFS_FILE_FMT_LBCS}" = "nemsio" ]; then - external_model="UFS-CASE-STUDY" - input_type="gaussian_nemsio" # For FV3GFS data on a Gaussian grid in nemsio format. - tracers_input="[\"spfh\",\"clwmr\",\"o3mr\",\"icmr\",\"rwmr\",\"snmr\",\"grle\"]" - tracers="[\"sphum\",\"liq_wat\",\"o3mr\",\"ice_wat\",\"rainwat\",\"snowwat\",\"graupel\"]" - fi - ;; - -"GDAS") - if [ "${FV3GFS_FILE_FMT_LBCS}" = "nemsio" ]; then - input_type="gaussian_nemsio" - elif [ "${FV3GFS_FILE_FMT_LBCS}" = "netcdf" ]; then - input_type="gaussian_netcdf" - fi - external_model="GFS" - tracers_input="[\"spfh\",\"clwmr\",\"o3mr\",\"icmr\",\"rwmr\",\"snmr\",\"grle\"]" - tracers="[\"sphum\",\"liq_wat\",\"o3mr\",\"ice_wat\",\"rainwat\",\"snowwat\",\"graupel\"]" - fn_atm="${EXTRN_MDL_FNS[0]}" - ;; - -"GEFS") - external_model="GFS" - fn_grib2="${EXTRN_MDL_FNS[0]}" - input_type="grib2" - ;; - -"RAP") - external_model="RAP" - input_type="grib2" - ;; - -"HRRR"|"RRFS") - external_model="HRRR" - input_type="grib2" - ;; - -"NAM") - external_model="NAM" - input_type="grib2" - ;; - -*) - message_txt="External-model-dependent namelist variables have not yet been -specified for this external LBC model (EXTRN_MDL_NAME_LBCS): - EXTRN_MDL_NAME_LBCS = \"${EXTRN_MDL_NAME_LBCS}\"" - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_exit "${message_txt}" - else - print_err_msg_exit "${message_txt}" - fi - ;; - -esac -# -#----------------------------------------------------------------------- -# -# Check that the executable that generates the LBCs exists. -# -#----------------------------------------------------------------------- -# -exec_fn="chgres_cube" -exec_fp="$EXECdir/${exec_fn}" -if [ ! -f "${exec_fp}" ]; then - message_txt="The executable (exec_fp) for generating initial conditions -on the FV3-LAM native grid does not exist: - exec_fp = \"${exec_fp}\" -Please ensure that you've built this executable." - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_exit "${message_txt}" - else - print_err_msg_exit "${message_txt}" - fi -fi -# -#----------------------------------------------------------------------- -# -# Loop through the LBC update times and run chgres_cube for each such time to -# obtain an LBC file for each that can be used as input to the FV3-LAM. -# -#----------------------------------------------------------------------- -# -num_fhrs="${#EXTRN_MDL_FHRS[@]}" -bcgrp10=${bcgrp#0} -bcgrpnum10=${bcgrpnum#0} -for (( ii=0; ii<${num_fhrs}; ii=ii+bcgrpnum10 )); do - i=$(( ii + bcgrp10 )) - if [ ${i} -lt ${num_fhrs} ]; then - echo " group ${bcgrp10} processes member ${i}" -# -# Get the forecast hour of the external model. -# - fhr="${EXTRN_MDL_FHRS[$i]}" -# -# Set external model output file name and file type/format. Note that -# these are now inputs into chgres_cube. -# - fn_atm="" - fn_grib2="" - - case "${EXTRN_MDL_NAME_LBCS}" in - "GSMGFS") - fn_atm="${EXTRN_MDL_FNS[$i]}" - ;; - "FV3GFS") - if [ "${FV3GFS_FILE_FMT_LBCS}" = "nemsio" ]; then - fn_atm="${EXTRN_MDL_FNS[$i]}" - elif [ "${FV3GFS_FILE_FMT_LBCS}" = "grib2" ]; then - fn_grib2="${EXTRN_MDL_FNS[$i]}" - elif [ "${FV3GFS_FILE_FMT_LBCS}" = "netcdf" ]; then - fn_atm="${EXTRN_MDL_FNS[$i]}" - fi - ;; - "UFS-CASE-STUDY") - if [ "${FV3GFS_FILE_FMT_LBCS}" = "nemsio" ]; then - hh="${EXTRN_MDL_CDATE:8:2}" - fhr_str=$(printf "%03d" ${fhr}) - fn_atm="gfs.t${hh}z.atmf${fhr_str}.nemsio" - unset hh fhr_str - fi - ;; - "GDAS") - fn_atm="${EXTRN_MDL_FNS[$i]}" - ;; - "GEFS") - fn_grib2="${EXTRN_MDL_FNS[$i]}" - ;; - "RAP") - fn_grib2="${EXTRN_MDL_FNS[$i]}" - ;; - "HRRR") - fn_grib2="${EXTRN_MDL_FNS[$i]}" - ;; - "RRFS") - fn_grib2="${EXTRN_MDL_FNS[$i]}" - ;; - "NAM") - fn_grib2="${EXTRN_MDL_FNS[$i]}" - ;; - *) - message_txt="The external model output file name to use in the chgres_cube -FORTRAN namelist file has not specified for this external LBC model (EXTRN_MDL_NAME_LBCS): - EXTRN_MDL_NAME_LBCS = \"${EXTRN_MDL_NAME_LBCS}\"" - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_exit "${message_txt}" - else - print_err_msg_exit "${message_txt}" - fi - ;; - esac -# -# Get the starting date (year, month, and day together), month, day, and -# hour of the the external model forecast. Then add the forecast hour -# to it to get a date and time corresponding to the current forecast time. -# - yyyymmdd="${EXTRN_MDL_CDATE:0:8}" - mm="${EXTRN_MDL_CDATE:4:2}" - dd="${EXTRN_MDL_CDATE:6:2}" - hh="${EXTRN_MDL_CDATE:8:2}" - - cdate_crnt_fhr=$( $DATE_UTIL --utc --date "${yyyymmdd} ${hh} UTC + ${fhr} hours" "+%Y%m%d%H" ) -# -# Get the month, day, and hour corresponding to the current forecast time -# of the the external model. -# - mm="${cdate_crnt_fhr:4:2}" - dd="${cdate_crnt_fhr:6:2}" - hh="${cdate_crnt_fhr:8:2}" -# -# Build the FORTRAN namelist file that chgres_cube will read in. -# - -# -# Create a multiline variable that consists of a yaml-compliant string -# specifying the values that the namelist variables need to be set to -# (one namelist variable per line, plus a header and footer). Below, -# this variable will be passed to a python script that will create the -# namelist file. -# -# IMPORTANT: -# If we want a namelist variable to be removed from the namelist file, -# in the "settings" variable below, we need to set its value to the -# string "null". -# - settings=" -'config': - 'fix_dir_target_grid': ${FIXlam} - 'mosaic_file_target_grid': ${FIXlam}/${CRES}${DOT_OR_USCORE}mosaic.halo$((10#${NH4})).nc - 'orog_dir_target_grid': ${FIXlam} - 'orog_files_target_grid': ${CRES}${DOT_OR_USCORE}oro_data.tile${TILE_RGNL}.halo$((10#${NH4})).nc - 'vcoord_file_target_grid': ${VCOORD_FILE} - 'varmap_file': ${PARMdir}/ufs_utils/varmap_tables/${varmap_file} - 'data_dir_input_grid': ${extrn_mdl_staging_dir} - 'atm_files_input_grid': ${fn_atm} - 'grib2_file_input_grid': \"${fn_grib2}\" - 'cycle_mon': $((10#${mm})) - 'cycle_day': $((10#${dd})) - 'cycle_hour': $((10#${hh})) - 'convert_atm': True - 'regional': 2 - 'halo_bndy': $((10#${NH4})) - 'halo_blend': $((10#${HALO_BLEND})) - 'input_type': ${input_type} - 'external_model': ${external_model} - 'tracers_input': ${tracers_input} - 'tracers': ${tracers} - 'thomp_mp_climo_file': ${thomp_mp_climo_file} -" - - nml_fn="fort.41" - # UW takes input from stdin when no -i/--input-config flag is provided - (cat << EOF -$settings -EOF -) | uw config realize \ - --input-format yaml \ - -o ${nml_fn} \ - --output-format nml \ - -v \ - - export err=$? - if [ $err -ne 0 ]; then - message_txt="Error creating namelist read by ${exec_fn} failed. - Settings for input are: -$settings" - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_exit "${message_txt}" - else - print_err_msg_exit "${message_txt}" - fi - fi -# -#----------------------------------------------------------------------- -# -# Run chgres_cube. -# -#----------------------------------------------------------------------- -# -# NOTE: -# Often when the chgres_cube.exe run fails, it still returns a zero -# return code, so the failure isn't picked up the the logical OR (||) -# below. That should be fixed. This might be due to the RUN_CMD_UTILS -# command - maybe that is returning a zero exit code even though the -# exit code of chgres_cube is nonzero. A similar thing happens in the -# forecast task. -# - PREP_STEP - eval ${RUN_CMD_UTILS} ${exec_fp} ${REDIRECT_OUT_ERR} - export err=$? - if [ "${RUN_ENVIR}" = "nco" ] && [ "${MACHINE}" = "WCOSS2" ]; then - err_chk - else - if [ $err -ne 0 ]; then - print_err_msg_exit "\ -Call to executable (exec_fp) to generate lateral boundary conditions (LBCs) -file for the FV3-LAM for forecast hour fhr failed: - exec_fp = \"${exec_fp}\" - fhr = \"$fhr\" -The external model from which the LBCs files are to be generated is: - EXTRN_MDL_NAME_LBCS = \"${EXTRN_MDL_NAME_LBCS}\" -The external model files that are inputs to the executable (exec_fp) are -located in the following directory: - extrn_mdl_staging_dir = \"${extrn_mdl_staging_dir}\"" - fi - fi - POST_STEP -# -# Move LBCs file for the current lateral boundary update time to the LBCs -# work directory. Note that we rename the file by including in its name -# the forecast hour of the FV3-LAM (which is not necessarily the same as -# that of the external model since their start times may be offset). -# - lbc_spec_fhrs=( "${EXTRN_MDL_FHRS[$i]}" ) - fcst_hhh=$(( ${lbc_spec_fhrs} - ${EXTRN_MDL_LBCS_OFFSET_HRS} )) - fcst_hhh_FV3LAM=$( printf "%03d" "$fcst_hhh" ) - if [ $(boolify "${CPL_AQM}") = "TRUE" ]; then - cp -p gfs.bndy.nc ${DATA_SHARE}/${NET}.${cycle}${dot_ensmem}.gfs_bndy.tile7.f${fcst_hhh_FV3LAM}.nc - else - mv gfs.bndy.nc ${INPUT_DATA}/${NET}.${cycle}${dot_ensmem}.gfs_bndy.tile7.f${fcst_hhh_FV3LAM}.nc - fi - - fi -done -# -#----------------------------------------------------------------------- -# -# Print message indicating successful completion of script. -# -#----------------------------------------------------------------------- -# -print_info_msg " -======================================================================== -Lateral boundary condition (LBC) files (in NetCDF format) generated suc- -cessfully for all LBC update hours (except hour zero)!!! - -Exiting script: \"${scrfunc_fn}\" -In directory: \"${scrfunc_dir}\" -========================================================================" -# -#----------------------------------------------------------------------- -# -# Restore the shell options saved at the beginning of this script/func- -# tion. -# -#----------------------------------------------------------------------- -# -{ restore_shell_opts; } > /dev/null 2>&1 diff --git a/scripts/exregional_plot_allvars.py b/scripts/exregional_plot_allvars.py index 0362c3f3bd..a69f23eaaf 100755 --- a/scripts/exregional_plot_allvars.py +++ b/scripts/exregional_plot_allvars.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +#pylint: disable=all ################################################################################ #### Python Script Documentation Block diff --git a/scripts/exregional_plot_allvars_diff.py b/scripts/exregional_plot_allvars_diff.py index c493f68f65..f466e5127e 100755 --- a/scripts/exregional_plot_allvars_diff.py +++ b/scripts/exregional_plot_allvars_diff.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +#pylint: disable=all ################################################################################ #### Python Script Documentation Block diff --git a/scripts/exregional_run_fcst.sh b/scripts/exregional_run_fcst.sh index 2756994f90..ce6032bae9 100755 --- a/scripts/exregional_run_fcst.sh +++ b/scripts/exregional_run_fcst.sh @@ -516,7 +516,7 @@ create_symlink_to_file ${FIELD_DICT_FP} ${DATA}/${FIELD_DICT_FN} ${relative_link set -x if [ $(boolify ${WRITE_DOPOST}) = "TRUE" ]; then cycle="${PDY:0:4}-${PDY:4:2}-${PDY:6:2}T$cyc" - for task in files_copied files_linked namelist_file ; do + for task in control_file files_copied files_linked namelist_file ; do uw upp $task -c ${GLOBAL_VAR_DEFNS_FP} --leadtime 999 --cycle $cycle --key-path task_run_post done mv $DATA/postprd/999/* . diff --git a/scripts/make_orog.py b/scripts/make_orog.py index 2b9849c051..2608d574d8 100755 --- a/scripts/make_orog.py +++ b/scripts/make_orog.py @@ -11,7 +11,6 @@ from pathlib import Path from uwtools.api.config import get_yaml_config -from uwtools.api.driver import Driver from uwtools.api.filter_topo import FilterTopo from uwtools.api.logging import use_uwtools_logger from uwtools.api.orog import Orog @@ -104,7 +103,7 @@ def make_orog(config_file, key_path): # Run shave for 0- and 4-cell-wide halo for sub_path in ["shave0", "shave4"]: - driver = run_driver( + run_driver( driver_class=Shave, config_file=config_file, key_path=[*key_path, sub_path], diff --git a/scripts/make_sfc_climo.py b/scripts/make_sfc_climo.py index 95b840d236..44ca67b1b8 100755 --- a/scripts/make_sfc_climo.py +++ b/scripts/make_sfc_climo.py @@ -10,9 +10,8 @@ from pathlib import Path from uwtools.api.config import get_yaml_config -from uwtools.api.fs import link as uwlink from uwtools.api.logging import use_uwtools_logger -from uwtools.api.sfc_climo_gen import SfcClimoGen +from uwtools.api.sfc_climo_gen import SfcClimoGen def _link_files(dest_dir, files, cres): @@ -22,8 +21,10 @@ def _link_files(dest_dir, files, cres): for fpath in files: path = Path(fpath) fn = Path(fpath).name - + if "halo" in fn: + # The output files with "halo" in the name map to the "halo4" files in the destination + # directory. fn = f"{cres}.{(fn.replace('halo', 'halo4'))}" no_halo_fn = fn.replace("halo4.", "") for link in (fn, no_halo_fn): @@ -31,8 +32,10 @@ def _link_files(dest_dir, files, cres): if (linkname := dest_dir / link.name).is_symlink(): linkname.unlink() linkname.symlink_to(path) - + else: + # The files without halo in the name map to two sets of files in the destination + # directory: one with tile1 in the name, another with halo0 in the name. basename = path.stem halo0_fn = f"{cres}.{basename}.halo0.nc" tile1_fn = halo0_fn.replace("tile7.halo0", "tile1") @@ -42,7 +45,11 @@ def _link_files(dest_dir, files, cres): linkname.unlink() linkname.symlink_to(path) + def parse_args(argv): + """ + Parse command line arguments from script. + """ parser = ArgumentParser( description="Script that runs sfc_climo_gen via uwtools API.", ) @@ -61,7 +68,7 @@ def parse_args(argv): required=True, type=lambda s: s.split("."), ) - + return parser.parse_args(argv) @@ -70,11 +77,11 @@ def make_sfc_climo(config_file, key_path): Run the sfc_climo_gen driver. """ expt_config = get_yaml_config(config_file) - - # The experiment config will have {{ CRES | env }} expressions in it that need to be - # dereferenced during driver initialization + + # The experiment config will have {{ "CRES" | env }} expressions in it that need to be + # dereferenced during driver initialization. cres = expt_config["workflow"]["CRES"] - os.environ["CRES"] = cres + os.environ["CRES"] = cres expt_config.dereference( context={ **os.environ, @@ -84,25 +91,24 @@ def make_sfc_climo(config_file, key_path): sfc_climo_gen_driver = SfcClimoGen( config=config_file, key_path=key_path, - ) + ) rundir = Path(sfc_climo_gen_driver.config["rundir"]) print(f"Will run sfc_climo_gen in {rundir}") sfc_climo_gen_driver.run() - + if not (rundir / "runscript.sfc_climo_gen.done").is_file(): print("Error occurred running sfc_climo_gen. Please see component error logs.") sys.exit(1) - - + # Destination of important files from this process fix_lam_path = Path(expt_config["workflow"]["FIXlam"]) # Link sfc_climo_gen output data to fix directory _link_files( dest_dir=fix_lam_path, - files=glob.glob(str(rundir / f"*.nc")), + files=glob.glob(str(rundir / "*.nc")), cres=cres, ) - + # Mark the successful completion of the script on disk Path(rundir / "make_sfc_climo_task_complete.txt").touch() diff --git a/scripts/upp.py b/scripts/upp.py index 2e012629b9..7df8f0af74 100755 --- a/scripts/upp.py +++ b/scripts/upp.py @@ -1,6 +1,6 @@ #!/usr/bin/env python """ -The run script for UPP +The run script for UPP. """ import datetime as dt @@ -31,6 +31,7 @@ def _timedelta_from_str(tds): logging.error(msg) sys.exit(1) + def _walk_key_path(config, key_path): """ Navigate to the sub-config at the end of the path of given keys. @@ -51,6 +52,7 @@ def _walk_key_path(config, key_path): config = subconfig return config + def parse_args(argv): """ Parse arguments for the script. @@ -98,7 +100,7 @@ def run_upp(config_file, cycle, leadtime, key_path, member): Setup and run the UPP Driver. """ - # The experiment config will have {{ MEMBER | env }} expressions in it that need to be + # The experiment config will have {{ "MEMBER" | env }} expressions in it that need to be # dereferenced during driver initialization. os.environ["MEMBER"] = member @@ -136,8 +138,7 @@ def run_upp(config_file, cycle, leadtime, key_path, member): upp_block = _walk_key_path(expt_config_cp, key_path) desired_output_fn = upp_block["desired_output_name"] upp_output_fn = ( - rundir - / f"{label.upper()}.GrbF{int(leadtime.total_seconds() // 3600):02d}" + rundir / f"{label.upper()}.GrbF{int(leadtime.total_seconds() // 3600):02d}" ) links[desired_output_fn] = str(upp_output_fn) diff --git a/ush/config_defaults.yaml b/ush/config_defaults.yaml index df5b198f17..92334eb2e5 100644 --- a/ush/config_defaults.yaml +++ b/ush/config_defaults.yaml @@ -1384,7 +1384,11 @@ task_make_grid: # MAKE OROG config parameters #----------------------------- task_make_orog: + # The top-level run direcotry for the whole task. All UW drivers will be run in subdirectories. rundir: '{{ workflow.EXPTDIR }}/orog' + + # The entries in orog: section follow along with the UW YAML, documented by uwtools: + # https://uwtools.readthedocs.io/en/main/sections/user_guide/yaml/components/orog.html orog: execution: batchargs: @@ -1413,6 +1417,8 @@ task_make_orog: grid_file: "{{ workflow.FIXlam }}/{{ 'CRES' | env }}_grid.tile7.halo{{ grid_params.NHW }}.nc" orog_file: "none" rundir: "{{ task_make_orog.rundir }}/orog" + # The entries in filter_topo: section follow along with the UW YAML, documented by uwtools: + # https://uwtools.readthedocs.io/en/main/sections/user_guide/yaml/components/filter_topo.html filter_topo: config: filtered_orog: "{{ 'CRES' | env }}_filtered_orog.tile{{ constants.TILE_RGNL }}.nc" @@ -1437,6 +1443,9 @@ task_make_orog: stretch_fac: !float "{{ grid_params.STRETCH_FAC }}" res: !int "{{ ('CRES' | env)[1:] }}" rundir: "{{ task_make_orog.rundir }}/filtered_topo" + # The entries in shave: sections follow along with the UW YAML, documented by uwtools: + # https://uwtools.readthedocs.io/en/main/sections/user_guide/yaml/components/shave.html + # There are two shave sections here with slightly different configurations. shave0: shave: execution: &shave_execution @@ -1464,8 +1473,14 @@ task_make_orog: nhalo: !int "{{ constants.NH4 }}" output_grid_file: "{{ task_make_orog.rundir }}/{{ 'CRES' | env }}_oro_data.tile{{ constants.TILE_RGNL }}.halo{{ constants.NH4 }}.nc" rundir: "{{ task_make_orog.rundir }}/shave4" + + # Describes the location and name of the output from filtered orog as a helper entry for SRW since + # it is needed in the downstream shave tasks. filtered_output: "{{ task_make_orog.filter_topo.rundir }}/{{ task_make_orog.filter_topo.config.filtered_orog }}" + task_make_sfc_climo: + # The entries in sfc_climo_gen: sections follow along with the UW YAML, documented by uwtools: + # https://uwtools.readthedocs.io/en/main/sections/user_guide/yaml/components/sfc_climo_gen.html sfc_climo_gen: execution: batchargs: @@ -1688,60 +1703,9 @@ task_get_extrn_lbcs: # MAKE ICS config parameters #----------------------------- task_make_ics: - #----------------------------------------------------------------------- - # KMP_AFFINITY_MAKE_ICS: - # Intel Thread Affinity Interface for the make_ics task. - # - # OMP_NUM_THREADS_MAKE_ICS: - # The number of OpenMP threads to use for parallel regions. - # - # OMP_STACKSIZE_MAKE_ICS: - # Controls the size of the stack for threads created by the OpenMP - # implementation. - #----------------------------------------------------------------------- - envvars: - KMP_AFFINITY_MAKE_ICS: "scatter" - OMP_NUM_THREADS_MAKE_ICS: 1 - OMP_STACKSIZE_MAKE_ICS: "1024m" - # - #----------------------------------------------------------------------- - # - # USE_FVCOM: - # Flag set to update surface conditions in FV3-LAM with fields generated - # from the Finite Volume Community Ocean Model (FVCOM). This will - # replace lake/sea surface temperature, ice surface temperature, and ice - # placement. This flag will be used in make_ics to modify sfc_data.nc - # after chgres_cube is run by running the routine process_FVCOM.exe - # FVCOM data must already be interpolated to the desired FV3-LAM grid. - # - # FVCOM_WCSTART: - # Define whether this is a "warm" start or a "cold" start. Setting this to - # "warm" will read in the sfc_data.nc file generated in a RESTART directory. - # Setting this to "cold" will read in the sfc_data.nc file generated from - # chgres_cube in the make_ics portion of the workflow. - # - # FVCOM_DIR: - # User defined directory where FVCOM data already interpolated to FV3-LAM - # grid is located. The file in this directory must be named fvcom.nc - # - # FVCOM_FILE: - # Name of file located in FVCOM_DIR that has FVCOM data interpolated to - # FV3-LAM grid. This file will be copied later to a new location and name - # changed to fvcom.nc - # - # VCOORD_FILE: - # Full path to the file used to set the vertical coordinate in FV3. - # This file should be the same in both make_ics and make_lbcs. - # - #------------------------------------------------------------------------ - # - USE_FVCOM: false - FVCOM_WCSTART: "cold" - FVCOM_DIR: "" - FVCOM_FILE: "fvcom.nc" - VCOORD_FILE: "{{ workflow.FIXam }}/global_hyblev.l65.txt" - #------------------------------------------------------------------------ - input_files_metadata_path: '{{ task_get_extrn_ics.envvars.rundir }}/{{ workflow.EXTRN_MDL_VAR_DEFNS_FN }}.yaml' + + # The entries in the chgres_cube: section follow along with the UW YAML, documented by uwtools: + # https://uwtools.readthedocs.io/en/main/sections/user_guide/yaml/components/chgres_cube.html chgres_cube: execution: &chgres_cube_execution batchargs: @@ -1782,6 +1746,12 @@ task_make_ics: vgtyp_from_climo: true vgfrc_from_climo: true rundir: '{{ task_run_fcst.rundir }}/tmp_MAKE_ICS' + + # The location of the metadata path created by retrieve_data.py + input_files_metadata_path: '{{ task_get_extrn_ics.envvars.rundir }}/{{ workflow.EXTRN_MDL_VAR_DEFNS_FN }}.yaml' + + # This section is used with uwcopy or uwlink and maps the output from chgres_cube to SRW-specific + # file paths. output_file_links: '{{ nco.NET_default }}.t{{ timevars.hh }}z.sfc_data.tile{{ constants.TILE_RGNL }}.halo{{ constants.NH0 }}.nc': out.sfc.tile{{ constants.TILE_RGNL }}.nc '{{ nco.NET_default }}.t{{ timevars.hh }}z.gfs_data.tile{{ constants.TILE_RGNL }}.halo{{ constants.NH0 }}.nc': out.atm.tile{{ constants.TILE_RGNL }}.nc @@ -1792,29 +1762,8 @@ task_make_ics: # MAKE LBCS config parameters #----------------------------- task_make_lbcs: - #------------------------------------------------------------------------ - # - # KMP_AFFINITY_MAKE_LBCS: - # Intel Thread Affinity Interface for the make_lbcs task. - # - # OMP_NUM_THREADS_MAKE_LBCS: - # The number of OpenMP threads to use for parallel regions. - # - # OMP_STACKSIZE_MAKE_LBCS: - # Controls the size of the stack for threads created by the OpenMP implementation. - # - # VCOORD_FILE: - # Full path to the file used to set the vertical coordinates in FV3. - # This file should be the same in both make_ics and make_lbcs. - # - #------------------------------------------------------------------------ - envvars: - KMP_AFFINITY_MAKE_LBCS: "scatter" - OMP_NUM_THREADS_MAKE_LBCS: 1 - OMP_STACKSIZE_MAKE_LBCS: "1024m" - VCOORD_FILE: "{{ workflow.FIXam }}/global_hyblev.l65.txt" - #------------------------------------------------------------------------ - input_files_metadata_path: '{{ task_get_extrn_lbcs.envvars.rundir }}/{{ workflow.EXTRN_MDL_VAR_DEFNS_FN }}.yaml' + # The entries in the chgres_cube: section follow along with the UW YAML, documented by uwtools: + # https://uwtools.readthedocs.io/en/main/sections/user_guide/yaml/components/chgres_cube.html chgres_cube: execution: <<: *chgres_cube_execution @@ -1838,6 +1787,12 @@ task_make_lbcs: varmap_file: "{{ user.PARMdir }}/ufs_utils/varmap_tables/GFSphys_var_map.txt" vcoord_file_target_grid: "{{ workflow.FIXam }}/global_hyblev.l65.txt" rundir: '{{ task_run_fcst.rundir}}/tmp_MAKE_LBCS_{{ timevars.yyyymmddhh }}' + + # The location of the metadata path created by retrieve_data.py + input_files_metadata_path: '{{ task_get_extrn_lbcs.envvars.rundir }}/{{ workflow.EXTRN_MDL_VAR_DEFNS_FN }}.yaml' + + # This section is used with uwcopy or uwlink and maps the output from chgres_cube to SRW-specific + # file paths. output_file_links: '{{ nco.NET_default }}.t{{ timevars.hh }}z.gfs_bndy.tile7.f{{ "%03d" % (leadtime.total_seconds() // 3600) }}.nc': gfs.bndy.nc @@ -2147,6 +2102,8 @@ task_run_fcst: # POST config parameters #----------------------------- task_run_post: + # The entries in the upp: section follow along with the UW YAML, documented by uwtools: + # https://uwtools.readthedocs.io/en/main/sections/user_guide/yaml/components/upp.html upp: &det_upp execution: batchargs: @@ -2158,11 +2115,11 @@ task_run_post: - module load build_{{ user.MACHINE|lower }}_{{ workflow.COMPILER }} executable: '{{ user.EXECdir }}/upp.x' mpicmd: '{{ platform.BATCH_RUN_CMD }}' + control_file: '{{ user.UFS_WTHR_MDL_DIR }}/tests/parm/postxconfig-NT-fv3lam.txt' files_to_copy: eta_micro_lookup.dat: '{{ user.PARMdir }}/upp/nam_micro_lookup.dat' params_grib2_tbl_new: '{{ user.PARMdir }}/upp/params_grib2_tbl_new' - postxconfig-NT.txt: '{{ user.UFS_WTHR_MDL_DIR }}/tests/parm/postxconfig-NT-fv3lam.txt' - postxconfig-NT_FH00.txt: '{{ task_run_post.upp.files_to_copy["postxconfig-NT.txt"] }}' + postxconfig-NT_FH00.txt: '{{ task_run_post.upp.control_file }}' namelist: update_values: model_inputs: @@ -2179,12 +2136,20 @@ task_run_post: platform: account: '{{ user.ACCOUNT }}' scheduler: '{{ platform.SCHED }}' + + # The output domain used when renaming UPP native output. This is also used by verification tasks. post_output_domain_name: '{{ workflow.PREDEF_GRID_NAME }}' + + # The desired output file name of the UPP native output. desired_output_name: '{{ nco.NET_default }}.t{{ timevars.hh }}z.{{ file_label }}.f{{ timevars.fff }}.{{ task_run_post.post_output_domain_name }}.grib2' + + # The expected prefixes for the output files from UPP. output_file_labels: - prslev - natlev +# This is a helper section to help alleviate repetitive and/or tedious syntax for working with +# datetime objects. Keys map to commonly used variable names. timevars: yyyymmddhh: '{{ cycle.strftime("%Y%m%d%H") }}' hh: '{{ cycle.strftime("%H") }}' diff --git a/ush/create_model_configure_file.py b/ush/create_model_configure_file.py index f646e98ded..7fe960e411 100644 --- a/ush/create_model_configure_file.py +++ b/ush/create_model_configure_file.py @@ -9,7 +9,6 @@ from python_utils import ( cfg_to_yaml_str, - flatten_dict, import_vars, lowercase, print_info_msg, diff --git a/ush/generate_FV3LAM_wflow.py b/ush/generate_FV3LAM_wflow.py index edfb810da6..3f039af335 100755 --- a/ush/generate_FV3LAM_wflow.py +++ b/ush/generate_FV3LAM_wflow.py @@ -37,7 +37,6 @@ from set_fv3nml_sfc_climo_filenames import set_fv3nml_sfc_climo_filenames from uwtools.api.config import get_nml_config, get_yaml_config, realize -from uwtools.api.template import render from uwtools.api import rocoto as uwrocoto diff --git a/ush/machine/derecho.yaml b/ush/machine/derecho.yaml index 8bc768732f..8dcdbb3531 100644 --- a/ush/machine/derecho.yaml +++ b/ush/machine/derecho.yaml @@ -23,7 +23,7 @@ platform: TEST_PREGEN_BASEDIR: /glade/work/epicufsrt/contrib/UFS_SRW_data/develop/FV3LAM_pregen TEST_ALT_EXTRN_MDL_SYSBASEDIR_ICS: /glade/work/epicufsrt/contrib/UFS_SRW_data/develop/dummy_FV3GFS_sys_dir TEST_ALT_EXTRN_MDL_SYSBASEDIR_LBCS: /glade/work/epicufsrt/contrib/UFS_SRW_data/develop/dummy_FV3GFS_sys_dir - TEST_VX_FCST_INPUT_BASEDIR: '{{ "/glade/work/epicufsrt/contrib/UFS_SRW_data/develop/output_data/fcst_" }}{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}{{ "/{{workflow.PREDEF_GRID_NAME}}" }}{% raw %}{% endraw %}' + TEST_VX_FCST_INPUT_BASEDIR: /glade/work/epicufsrt/contrib/UFS_SRW_data/develop/output_data/fcst_{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}/{{ workflow.PREDEF_GRID_NAME }} FIXaer: /glade/work/epicufsrt/contrib/UFS_SRW_data/develop/fix/fix_aer FIXgsi: /glade/work/epicufsrt/contrib/UFS_SRW_data/develop/fix/fix_gsi FIXgsm: /glade/work/epicufsrt/contrib/UFS_SRW_data/develop/fix/fix_am diff --git a/ush/machine/gaea.yaml b/ush/machine/gaea.yaml index 92d33d7ad2..5e0d0e54e4 100644 --- a/ush/machine/gaea.yaml +++ b/ush/machine/gaea.yaml @@ -24,7 +24,7 @@ platform: TEST_PREGEN_BASEDIR: /gpfs/f5/epic/world-shared/UFS_SRW_data/develop/FV3LAM_pregen TEST_ALT_EXTRN_MDL_SYSBASEDIR_ICS: /gpfs/f5/epic/world-shared/UFS_SRW_data/develop/dummy_FV3GFS_sys_dir TEST_ALT_EXTRN_MDL_SYSBASEDIR_LBCS: /gpfs/f5/epic/world-shared/UFS_SRW_data/develop/dummy_FV3GFS_sys_dir - TEST_VX_FCST_INPUT_BASEDIR: '{{ "/gpfs/f5/epic/world-shared/UFS_SRW_data/develop/output_data/fcst_" }}{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}{{ "/{{workflow.PREDEF_GRID_NAME}}" }}{% raw %}{% endraw %}' + TEST_VX_FCST_INPUT_BASEDIR: /gpfs/f5/epic/world-shared/UFS_SRW_data/develop/output_data/fcst_{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}/{{ workflow.PREDEF_GRID_NAME }} FIXaer: /gpfs/f5/epic/world-shared/UFS_SRW_data/develop/fix/fix_aer FIXgsi: /gpfs/f5/epic/world-shared/UFS_SRW_data/develop/fix/fix_gsi FIXgsm: /gpfs/f5/epic/world-shared/UFS_SRW_data/develop/fix/fix_am @@ -47,9 +47,6 @@ rocoto: tasks: metatask_run_ensemble: task_run_fcst_mem#mem#: - cores: + cores: !remove native: '--cpus-per-task {{ task_run_fcst.OMP_NUM_THREADS_RUN_FCST|int }} --exclusive {{ platform.SCHED_NATIVE_CMD }}' nodes: '{{ task_run_fcst.NNODES_RUN_FCST // 1 }}:ppn={{ task_run_fcst.PPN_RUN_FCST // 1 }}' - nnodes: - nodesize: - ppn: diff --git a/ush/machine/hera.yaml b/ush/machine/hera.yaml index a400169a46..edf852606b 100644 --- a/ush/machine/hera.yaml +++ b/ush/machine/hera.yaml @@ -29,7 +29,7 @@ platform: TEST_PREGEN_BASEDIR: /scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/FV3LAM_pregen TEST_ALT_EXTRN_MDL_SYSBASEDIR_ICS: /scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/dummy_FV3GFS_sys_dir TEST_ALT_EXTRN_MDL_SYSBASEDIR_LBCS: /scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/dummy_FV3GFS_sys_dir - TEST_VX_FCST_INPUT_BASEDIR: '{{ "/scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/output_data/fcst_" }}{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}{{ "/{{workflow.PREDEF_GRID_NAME}}" }}{% raw %}{% endraw %}' + TEST_VX_FCST_INPUT_BASEDIR: /scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/output_data/fcst_{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}/{{ workflow.PREDEF_GRID_NAME }} FIXaer: /scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_aer FIXgsm: /scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am FIXlut: /scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_lut diff --git a/ush/machine/hercules.yaml b/ush/machine/hercules.yaml index 6a325094da..f0e47c594f 100644 --- a/ush/machine/hercules.yaml +++ b/ush/machine/hercules.yaml @@ -25,7 +25,7 @@ platform: TEST_EXTRN_MDL_SOURCE_BASEDIR: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/input_model_data TEST_AQM_INPUT_BASEDIR: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/aqm_data TEST_PREGEN_BASEDIR: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/FV3LAM_pregen - TEST_VX_FCST_INPUT_BASEDIR: '{{ "/work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/output_data/fcst_" }}{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}{{ "/{{workflow.PREDEF_GRID_NAME}}" }}{% raw %}{% endraw %}' + TEST_VX_FCST_INPUT_BASEDIR: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/output_data/fcst_{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}/{{ workflow.PREDEF_GRID_NAME }} FIXaer: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/fix/fix_aer FIXgsi: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/fix/fix_gsi FIXgsm: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/fix/fix_am @@ -56,9 +56,6 @@ rocoto: tasks: metatask_run_ensemble: task_run_fcst_mem#mem#: - cores: + cores: !remove native: '--cpus-per-task {{ task_run_fcst.OMP_NUM_THREADS_RUN_FCST|int }} --exclusive {{ platform.SCHED_NATIVE_CMD }}' nodes: '{{ task_run_fcst.NNODES_RUN_FCST // 1 }}:ppn={{ task_run_fcst.PPN_RUN_FCST // 1 }}' - nnodes: - nodesize: - ppn: diff --git a/ush/machine/jet.yaml b/ush/machine/jet.yaml index 847530e4eb..1a2d67784b 100644 --- a/ush/machine/jet.yaml +++ b/ush/machine/jet.yaml @@ -25,7 +25,7 @@ platform: TEST_PREGEN_BASEDIR: /mnt/lfs5/HFIP/hfv3gfs/role.epic/UFS_SRW_data/develop/FV3LAM_pregen TEST_ALT_EXTRN_MDL_SYSBASEDIR_ICS: /mnt/lfs5/HFIP/hfv3gfs/role.epic/UFS_SRW_data/develop/dummy_FV3GFS_sys_dir TEST_ALT_EXTRN_MDL_SYSBASEDIR_LBCS: /mnt/lfs5/HFIP/hfv3gfs/role.epic/UFS_SRW_data/develop/dummy_FV3GFS_sys_dir - TEST_VX_FCST_INPUT_BASEDIR: '{{ "/mnt/lfs5/HFIP/hfv3gfs/role.epic/UFS_SRW_data/develop/output_data/fcst_" }}{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}{{ "/{{workflow.PREDEF_GRID_NAME}}" }}{% raw %}{% endraw %}' + TEST_VX_FCST_INPUT_BASEDIR: /mnt/lfs5/HFIP/hfv3gfs/role.epic/UFS_SRW_data/develop/output_data/fcst_{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}{{ workflow.PREDEF_GRID_NAME }} FIXaer: /mnt/lfs5/HFIP/hfv3gfs/role.epic/UFS_SRW_data/develop/fix/fix_aer FIXgsm: /mnt/lfs5/HFIP/hfv3gfs/role.epic/UFS_SRW_data/develop/fix/fix_am FIXlut: /mnt/lfs5/HFIP/hfv3gfs/role.epic/UFS_SRW_data/develop/fix/fix_lut @@ -49,10 +49,7 @@ rocoto: tasks: metatask_run_ensemble: task_run_fcst_mem#mem#: - cores: + cores: !remove native: '--cpus-per-task {{ task_run_fcst.OMP_NUM_THREADS_RUN_FCST|int }} --exclusive {{ platform.SCHED_NATIVE_CMD }}' nodes: '{{ task_run_fcst.NNODES_RUN_FCST // 1 }}:ppn={{ task_run_fcst.PPN_RUN_FCST // 1 }}' - nnodes: - nodesize: - ppn: diff --git a/ush/machine/linux.yaml b/ush/machine/linux.yaml index e2e67ffffc..9058f1d494 100644 --- a/ush/machine/linux.yaml +++ b/ush/machine/linux.yaml @@ -33,9 +33,6 @@ rocoto: tasks: metatask_run_ensemble: task_run_fcst_mem#mem#: - cores: '{{ task_run_fcst.PE_MEMBER01 // 1 }}' + cores: !int '{{ task_run_fcst.PE_MEMBER01 // 1 }}' native: '--cpus-per-task {{ task_run_fcst.OMP_NUM_THREADS_RUN_FCST|int }} --exclusive' - nodes: - nnodes: - nodesize: - ppn: + nodes: !remove diff --git a/ush/machine/noaacloud.yaml b/ush/machine/noaacloud.yaml index 50de28e751..86b2647ba7 100644 --- a/ush/machine/noaacloud.yaml +++ b/ush/machine/noaacloud.yaml @@ -19,7 +19,7 @@ platform: TEST_PREGEN_BASEDIR: /contrib/EPIC/UFS_SRW_data/develop/FV3LAM_pregen TEST_ALT_EXTRN_MDL_SYSBASEDIR_ICS: /contrib/EPIC/UFS_SRW_data/develop/dummy_FV3GFS_sys_dir TEST_ALT_EXTRN_MDL_SYSBASEDIR_LBCS: /contrib/EPIC/UFS_SRW_data/develop/dummy_FV3GFS_sys_dir - TEST_VX_FCST_INPUT_BASEDIR: '{{ "/contrib/EPIC/UFS_SRW_data/develop/output_data/fcst_" }}{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}{{ "/{{workflow.PREDEF_GRID_NAME}}" }}{% raw %}{% endraw %}' + TEST_VX_FCST_INPUT_BASEDIR: /contrib/EPIC/UFS_SRW_data/develop/output_data/fcst_{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}/{{ workflow.PREDEF_GRID_NAME }} FIXaer: /contrib/EPIC/UFS_SRW_data/develop/fix/fix_aer FIXgsm: /contrib/EPIC/UFS_SRW_data/develop/fix/fix_am FIXlut: /contrib/EPIC/UFS_SRW_data/develop/fix/fix_lut diff --git a/ush/machine/orion.yaml b/ush/machine/orion.yaml index 5467160167..65feccfacb 100644 --- a/ush/machine/orion.yaml +++ b/ush/machine/orion.yaml @@ -25,7 +25,7 @@ platform: TEST_EXTRN_MDL_SOURCE_BASEDIR: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/input_model_data TEST_AQM_INPUT_BASEDIR: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/aqm_data TEST_PREGEN_BASEDIR: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/FV3LAM_pregen - TEST_VX_FCST_INPUT_BASEDIR: '{{ "/work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/output_data/fcst_" }}{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}{{ "/{{workflow.PREDEF_GRID_NAME}}" }}{% raw %}{% endraw %}' + TEST_VX_FCST_INPUT_BASEDIR: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/output_data/fcst_{{ "ens" if (global.NUM_ENS_MEMBERS > 0) else "det" }}/{{ workflow.PREDEF_GRID_NAME }} FIXaer: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/fix/fix_aer FIXgsm: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/fix/fix_am FIXlut: /work/noaa/epic/role-epic/contrib/UFS_SRW_data/develop/fix/fix_lut @@ -55,9 +55,6 @@ rocoto: tasks: metatask_run_ensemble: task_run_fcst_mem#mem#: - cores: + cores: !remove native: '--cpus-per-task {{ task_run_fcst.OMP_NUM_THREADS_RUN_FCST|int }} --exclusive {{ platform.SCHED_NATIVE_CMD }}' nodes: '{{ task_run_fcst.NNODES_RUN_FCST // 1 }}:ppn={{ task_run_fcst.PPN_RUN_FCST // 1 }}' - nnodes: - nodesize: - ppn: diff --git a/ush/machine/wcoss2.yaml b/ush/machine/wcoss2.yaml index b8c3625dff..849562e3b0 100644 --- a/ush/machine/wcoss2.yaml +++ b/ush/machine/wcoss2.yaml @@ -45,14 +45,14 @@ data: rocoto: tasks: task_get_extrn_ics: - native: + native: !remove task_get_extrn_lbcs: - native: + native: !remove task_plot_allvars: - native: + native: !remove metatask_run_ensemble: task_run_fcst_mem#mem#: - cores: + cores: !remove native: '{{ platform.SCHED_NATIVE_CMD }}' nodes: '{{ nnodes }}:ppn={{ ppn }}:tpp={{ task_run_fcst.OMP_NUM_THREADS_RUN_FCST }}' nodesize: '{{ platform.NCORES_PER_NODE }}' diff --git a/ush/setup.py b/ush/setup.py index d9ca5f6cde..616e0d4492 100644 --- a/ush/setup.py +++ b/ush/setup.py @@ -608,21 +608,24 @@ def _get_location(xcs, fmt, expt_cfg): # Make sure the vertical coordinate file for both make_lbcs and # make_ics is the same. - if ics_vcoord := expt_config.get("task_make_ics", {}).get("envvars").get("VCOORD_FILE") != \ - (lbcs_vcoord := expt_config.get("task_make_lbcs", {}).get("envvars").get("VCOORD_FILE")): - raise ValueError( - f""" - The VCOORD_FILE must be set to the same value for both the - make_ics task and the make_lbcs task. They are currently - set to: - - make_ics: - VCOORD_FILE: {ics_vcoord} - - make_lbcs: - VCOORD_FILE: {lbcs_vcoord} - """ - ) + vcoord_files = {} + for bcs_task in ("task_make_ics", "task_make_lbcs"): + vcoord_files[bcs_task] = ( + expt_config[bcs_task]["chgres_cube"]["namelist"] + .get("config", {}) + .get("vcoord_file_target_grid") + ) + + if not all(x == list(vcoord_files.values())[0] for x in vcoord_files.values()): + raise ValueError( + f""" + The VCOORD_FILE must be set to the same value for both the + make_ics task and the make_lbcs task. They are currently + set to: + + {json.dumps(vcoord_files)} + """ + ) # # -----------------------------------------------------------------------