Skip to content

Commit

Permalink
Add a flag for MERRA2 (ufs-community#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
chan-hoo authored Jan 5, 2022
1 parent 01f1c53 commit c810e61
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 18 deletions.
28 changes: 15 additions & 13 deletions scripts/exregional_run_fcst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -410,20 +410,22 @@ done
#
#-----------------------------------------------------------------------
#
for f_nm_path in ${FIXclim}/*; do
f_nm=$( basename "${f_nm_path}" )
pre_f="${f_nm%%.*}"

if [ "${pre_f}" = "merra2" ]; then
mnth=$( printf "%s\n" "${f_nm}" | grep -o -P '(?<=2014.m).*(?=.nc)' )
symlink="${run_dir}/aeroclim.m${mnth}.nc"
else
symlink="${run_dir}/${pre_f}.dat"
fi
target="${f_nm_path}"
create_symlink_to_file target="$target" symlink="$symlink" \
if [ "${USE_MERRA_CLIMO}" = "TRUE" ]; then
for f_nm_path in ${FIXclim}/*; do
f_nm=$( basename "${f_nm_path}" )
pre_f="${f_nm%%.*}"

if [ "${pre_f}" = "merra2" ]; then
mnth=$( printf "%s\n" "${f_nm}" | grep -o -P '(?<=2014.m).*(?=.nc)' )
symlink="${run_dir}/aeroclim.m${mnth}.nc"
else
symlink="${run_dir}/${pre_f}.dat"
fi
target="${f_nm_path}"
create_symlink_to_file target="$target" symlink="$symlink" \
relative="${relative_link_flag}"
done
done
fi
#
#-----------------------------------------------------------------------
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ PREEXISTING_DIR_METHOD="rename"
PREDEF_GRID_NAME="RRFS_CONUS_3km"
CCPP_PHYS_SUITE="FV3_GFS_v15_thompson_mynn_lam3km"

USE_MERRA_CLIMO="TRUE"

EXTRN_MDL_NAME_ICS="FV3GFS"
EXTRN_MDL_NAME_LBCS="FV3GFS"
USE_USER_STAGED_EXTRN_FILES="TRUE"
Expand Down
9 changes: 9 additions & 0 deletions ush/config_defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,15 @@ RUN_TASK_VX_ENSPOINT="FALSE"
#
#-----------------------------------------------------------------------
#
# Flag that determines whether MERRA2 aerosol climatology data and
# lookup tables for optics properties are obtained
#
#-----------------------------------------------------------------------
#
USE_MERRA_CLIMO="FALSE"
#
#-----------------------------------------------------------------------
#
# Set the array parameter containing the names of all the fields that the
# MAKE_SFC_CLIMO_TN task generates on the native FV3-LAM grid.
#
Expand Down
12 changes: 7 additions & 5 deletions ush/generate_FV3LAM_wflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -618,18 +618,20 @@ fi
#
#-----------------------------------------------------------------------
#
print_info_msg "$VERBOSE" "
if [ "${USE_MERRA_CLIMO}" = "TRUE" ]; then
print_info_msg "$VERBOSE" "
Copying MERRA2 aerosol climatology data files from system directory
(FIXaer/FIXlut) to a subdirectory (FIXclim) in the experiment directory:
FIXaer = \"${FIXaer}\"
FIXlut = \"${FIXlut}\"
FIXclim = \"${FIXclim}\""

check_for_preexist_dir_file "${FIXclim}" "delete"
mkdir_vrfy -p "${FIXclim}"
check_for_preexist_dir_file "${FIXclim}" "delete"
mkdir_vrfy -p "${FIXclim}"

cp_vrfy "${FIXaer}/merra2.aerclim"*".nc" "${FIXclim}/"
cp_vrfy "${FIXlut}/optics"*".dat" "${FIXclim}/"
cp_vrfy "${FIXaer}/merra2.aerclim"*".nc" "${FIXclim}/"
cp_vrfy "${FIXlut}/optics"*".dat" "${FIXclim}/"
fi
#
#-----------------------------------------------------------------------
#
Expand Down
24 changes: 24 additions & 0 deletions ush/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,30 @@ check_var_valid_value \
#
#-----------------------------------------------------------------------
#
# Make sure that USE_MERRA_CLIMO is set to a valid value.
#
#-----------------------------------------------------------------------
#
check_var_valid_value "USE_MERRA_CLIMO" "valid_vals_USE_MERRA_CLIMO"
#
# Set USE_MERRA_CLIMO to either "TRUE" or "FALSE" so we don't
# have to consider other valid values later on.
#
USE_MERRA_CLIMO=$(echo_uppercase $USE_MERRA_CLIMO)
if [ "${USE_MERRA_CLIMO}" = "TRUE" ] || \
[ "${USE_MERRA_CLIMO}" = "YES" ]; then
USE_MERRA_CLIMO="TRUE"
elif [ "${USE_MERRA_CLIMO}" = "FALSE" ] || \
[ "${USE_MERRA_CLIMO}" = "NO" ]; then
USE_MERRA_CLIMO="FALSE"
fi
# Force to "TRUE" in case of FV3_GFS_v15_thompson_mynn_lam3km:
if [ "${CCPP_PHYS_SUITE}" = "FV3_GFS_v15_thompson_mynn_lam3km" ]; then
USE_MERRA_CLIMO="TRUE"
fi
#
#-----------------------------------------------------------------------
#
# Make sure that FCST_MODEL is set to a valid value.
#
#-----------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions ush/valid_param_vals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ valid_vals_FVCOM_WCSTART=("warm" "WARM" "cold" "COLD")
valid_vals_COMPILER=("intel" "gnu")
valid_vals_SUB_HOURLY_POST=("TRUE" "true" "YES" "yes" "FALSE" "false" "NO" "no")
valid_vals_DT_SUBHOURLY_POST_MNTS=("1" "01" "2" "02" "3" "03" "4" "04" "5" "05" "6" "06" "10" "12" "15" "20" "30")
valid_vals_USE_MERRA_CLIMO=("TRUE" "true" "YES" "yes" "FALSE" "false" "NO" "no")

0 comments on commit c810e61

Please sign in to comment.