Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ens fix 1210 #458

Merged
merged 8 commits into from
Dec 12, 2022
123 changes: 123 additions & 0 deletions jobs/JREGIONAL_SAVE_INPUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#!/bin/bash

#
#-----------------------------------------------------------------------
#
# This script runs the save_input to save DA analysis files to nwges
#
#-----------------------------------------------------------------------
#

#
#-----------------------------------------------------------------------
#
# Source the variable definitions file and the bash utility functions.
#
#-----------------------------------------------------------------------
#
. ${GLOBAL_VAR_DEFNS_FP}
. $USHDIR/source_util_funcs.sh
#
#-----------------------------------------------------------------------
#
# Save current shell options (in a global array). Then set new options
# for this script/function.
#
#-----------------------------------------------------------------------
#
{ save_shell_opts; set -u -x; } > /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 J-job script for the task that runs the post-processor (UPP)
on the output files corresponding to a specified forecast hour.
========================================================================"
#
#-----------------------------------------------------------------------
#
# Set the run directory.
#
#-----------------------------------------------------------------------
# CYCLE_TYPE is to indicate which type of cycle this job for:
# spinup: this job is for spin-up cycles
# others(prod): this job is for product cycle
#
# NWGES_DIR is the directory in which the model IC file (DA analysis) will be saved
#
CYCLE_TYPE=${CYCLE_TYPE:-prod}
CYCLE_SUBTYPE=${CYCLE_SUBTYPE:-empty}
if [ ${CYCLE_TYPE} == "spinup" ]; then
run_dir="${CYCLE_DIR}${SLASH_ENSMEM_SUBDIR}/fcst_fv3lam_spinup"
nwges_dir="${NWGES_DIR}${SLASH_ENSMEM_SUBDIR}/fcst_fv3lam_spinup"
if [ ${CYCLE_SUBTYPE} == "ensinit" ]; then
run_dir="${CYCLE_DIR}${SLASH_ENSMEM_SUBDIR}/fcst_fv3lam_ensinit"
nwges_dir="${NWGES_DIR}${SLASH_ENSMEM_SUBDIR}/fcst_fv3lam_ensinit"
fi
else
run_dir="${CYCLE_DIR}${SLASH_ENSMEM_SUBDIR}/fcst_fv3lam"
nwges_dir="${NWGES_DIR}${SLASH_ENSMEM_SUBDIR}/fcst_fv3lam"
fi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need so many checks? This only save INPUT from prod cycle.
It does need to generate a nwges directory that has different name from prod.


if [ "${RUN_ENVIR}" = "nco" ]; then
mkdir_vrfy -p "${nwges_dir}/DA_OUTPUT"
fi

#
#-----------------------------------------------------------------------
#
# Call the ex-script for this J-job and pass to it the necessary varia-
# bles.
#
#-----------------------------------------------------------------------
#
$SCRIPTSDIR/exregional_save_input.sh \
cdate="${CDATE}" \
run_dir="${run_dir}" \
nwges_dir="${nwges_dir}" \
cycle_type="${CYCLE_TYPE}" \
cycle_subtype="${CYCLE_SUBTYPE}" || \
print_err_msg_exit "\
Call to ex-script corresponding to J-job \"${scrfunc_fn}\" failed."
#
#-----------------------------------------------------------------------
#
# Print exit message.
#
#-----------------------------------------------------------------------
#
print_info_msg "
========================================================================
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

9 changes: 5 additions & 4 deletions scripts/exregional_run_analysis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ if [[ ${regional_ensemble_option:-1} -eq 5 ]]; then
ens_nstarthr=$( printf "%02d" ${DA_CYCLE_INTERV} )
imem=1
ifound=0
for hrs in ${CYCL_HRS_HYB_FV3LAM_ENS}; do
for hrs in ${CYCL_HRS_HYB_FV3LAM_ENS[@]}; do
if [ $HH == ${hrs} ]; then

while [[ $imem -le ${NUM_ENS_MEMBERS} ]];do
Expand All @@ -219,7 +219,7 @@ if [[ ${regional_ensemble_option:-1} -eq 5 ]]; then
slash_ensmem_subdir=$memchar
bkpathmem=${rrfse_fg_root}/${YYYYMMDDHHmInterv}/${slash_ensmem_subdir}/fcst_fv3lam/RESTART
if [ ${DO_SPINUP} == "TRUE" ]; then
for cycl_hrs in ${CYCL_HRS_PRODSTART_ENS}; do
for cycl_hrs in ${CYCL_HRS_PRODSTART_ENS[@]}; do
if [ $HH == ${cycl_hrs} ]; then
bkpathmem=${rrfse_fg_root}/${YYYYMMDDHHmInterv}/${slash_ensmem_subdir}/fcst_fv3lam_spinup/RESTART
fi
Expand Down Expand Up @@ -944,13 +944,14 @@ if [ $binary_diag = ".true." ]; then
fi

if [ $netcdf_diag = ".true." ]; then
nc_diag_cat="${EXECDIR}/nc_diag_cat.x"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed from the latest update after APP load ncidag module.

listall_cnv="conv_ps conv_q conv_t conv_uv conv_pw conv_rw conv_sst conv_dbz"
listall_rad="hirs2_n14 msu_n14 sndr_g08 sndr_g11 sndr_g11 sndr_g12 sndr_g13 sndr_g08_prep sndr_g11_prep sndr_g12_prep sndr_g13_prep sndrd1_g11 sndrd2_g11 sndrd3_g11 sndrd4_g11 sndrd1_g15 sndrd2_g15 sndrd3_g15 sndrd4_g15 sndrd1_g13 sndrd2_g13 sndrd3_g13 sndrd4_g13 hirs3_n15 hirs3_n16 hirs3_n17 amsua_n15 amsua_n16 amsua_n17 amsua_n18 amsua_n19 amsua_metop-a amsua_metop-b amsua_metop-c amsub_n15 amsub_n16 amsub_n17 hsb_aqua airs_aqua amsua_aqua imgr_g08 imgr_g11 imgr_g12 pcp_ssmi_dmsp pcp_tmi_trmm conv sbuv2_n16 sbuv2_n17 sbuv2_n18 omi_aura ssmi_f13 ssmi_f14 ssmi_f15 hirs4_n18 hirs4_metop-a mhs_n18 mhs_n19 mhs_metop-a mhs_metop-b mhs_metop-c amsre_low_aqua amsre_mid_aqua amsre_hig_aqua ssmis_las_f16 ssmis_uas_f16 ssmis_img_f16 ssmis_env_f16 iasi_metop-a iasi_metop-b iasi_metop-c seviri_m08 seviri_m09 seviri_m10 seviri_m11 cris_npp atms_npp ssmis_f17 cris-fsr_npp cris-fsr_n20 atms_n20 abi_g16"

for type in $listall_cnv; do
count=$(ls pe*.${type}_${loop}.nc4 | wc -l)
if [[ $count -gt 0 ]]; then
${APRUN} nc_diag_cat.x -o diag_${type}_${string}.${YYYYMMDDHH}.nc4 pe*.${type}_${loop}.nc4
${APRUN} ${nc_diag_cat} -o diag_${type}_${string}.${YYYYMMDDHH}.nc4 pe*.${type}_${loop}.nc4
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not change this one

cp diag_${type}_${string}.${YYYYMMDDHH}.nc4 $comout
echo "diag_${type}_${string}.${YYYYMMDDHH}.nc4*" >> listcnv
numfile_cnv=`expr ${numfile_cnv} + 1`
Expand All @@ -960,7 +961,7 @@ if [ $netcdf_diag = ".true." ]; then
for type in $listall_rad; do
count=$(ls pe*.${type}_${loop}.nc4 | wc -l)
if [[ $count -gt 0 ]]; then
${APRUN} nc_diag_cat.x -o diag_${type}_${string}.${YYYYMMDDHH}.nc4 pe*.${type}_${loop}.nc4
${APRUN} ${nc_diag_cat} -o diag_${type}_${string}.${YYYYMMDDHH}.nc4 pe*.${type}_${loop}.nc4
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not change this one

cp diag_${type}_${string}.${YYYYMMDDHH}.nc4 $comout
echo "diag_${type}_${string}.${YYYYMMDDHH}.nc4*" >> listrad
numfile_rad=`expr ${numfile_rad} + 1`
Expand Down
152 changes: 152 additions & 0 deletions scripts/exregional_save_input.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#!/bin/bash

#
#-----------------------------------------------------------------------
#
# Source the variable definitions file and the bash utility functions.
#
#-----------------------------------------------------------------------
#
. ${GLOBAL_VAR_DEFNS_FP}
. $USHDIR/source_util_funcs.sh
#
#-----------------------------------------------------------------------
#
# Save current shell options (in a global array). Then set new options
# for this script/function.
#
#-----------------------------------------------------------------------
#
{ save_shell_opts; set -u +x; } > /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 runs the post-processor (UPP) on
the output files corresponding to a specified forecast hour.
========================================================================"
#
#-----------------------------------------------------------------------
#
# Specify the set of valid argument names for this script/function.
# Then process the arguments provided to this script/function (which
# should consist of a set of name-value pairs of the form arg1="value1",
# etc).
#
#-----------------------------------------------------------------------
#
valid_args=( \
"cdate" \
"run_dir" \
"nwges_dir" \
"cycle_type" \
"cycle_subtype" \
)
process_args valid_args "$@"
#
#-----------------------------------------------------------------------
#
# For debugging purposes, print out values of arguments passed to this
# script. Note that these will be printed out only if VERBOSE is set to
# TRUE.
#
#-----------------------------------------------------------------------
#
print_input_args valid_args
#
#-----------------------------------------------------------------------
#
# Get the cycle date and hour (in formats of yyyymmdd and hh, respectively)
# from cdate.
#
#-----------------------------------------------------------------------
#
yyyymmdd=${cdate:0:8}
hh=${cdate:8:2}
cyc=$hh

#
#-----------------------------------------------------------------------
#
# Let's save the DA analysis files if needed before run fcst.
# This will copy the data assimilation analysis files from $run_dir/INPUT/
# to ${nwges_dir}/DA_OUTPUT/,
# this is to prepare for ensemble free forecast after the ensemble data assimilation
#
#-----------------------------------------------------------------------
#
filelist="fv_core.res.nc coupler.res"
filelistn="fv_core.res.tile1.nc fv_srf_wnd.res.tile1.nc fv_tracer.res.tile1.nc phy_data.nc sfc_data.nc"
filelistcold="gfs_data.tile7.halo0.nc sfc_data.tile7.halo0.nc"
n_iolayouty=$(($IO_LAYOUT_Y-1))
list_iolayout=$(seq 0 $n_iolayouty)

if [ ! -r ${nwges_dir}/DA_OUTPUT/gfs_ctrl.nc ]; then
cp_vrfy $run_dir/INPUT/gfs_ctrl.nc ${nwges_dir}/DA_OUTPUT/gfs_ctrl.nc
if [ -r ${run_dir}/INPUT/coupler.res ]; then # warm start
if [ "${IO_LAYOUT_Y}" == "1" ]; then
for file in ${filelistn}; do
cp_vrfy $run_dir/INPUT/${file} ${nwges_dir}/DA_OUTPUT/${file}
done
else
for file in ${filelistn}; do
for ii in ${list_iolayout}
do
iii=$(printf %4.4i $ii)
cp_vrfy $run_dir/INPUT/${file}.${iii} ${nwges_dir}/DA_OUTPUT/${file}.${iii}
done
done
fi
for file in ${filelist}; do
cp_vrfy $run_dir/INPUT/${file} ${nwges_dir}/DA_OUTPUT/${file}
done
else # cold start
for file in ${filelistcold}; do
cp_vrfy $run_dir/INPUT/${file} ${nwges_dir}/DA_OUTPUT/${file}
done
fi
fi
#
#-----------------------------------------------------------------------
#
# Print message indicating successful completion of script.
#
#-----------------------------------------------------------------------
#
print_info_msg "
========================================================================
save DA analysis completed 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

1 change: 0 additions & 1 deletion ush/config.sh.RRFS_CONUS_13km_ens
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ HALO_BLEND=20
IO_LAYOUT_Y=1
PPN_RUN_REF2TTEN=1
PPN_RUN_NONVARCLDANL=${IO_LAYOUT_Y}
regional_ensemble_option=5

MAXTRIES_GET_EXTRN_ICS="2"
MAXTRIES_GET_EXTRN_LBCS="2"
Expand Down
6 changes: 6 additions & 0 deletions ush/config_defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,7 @@ PROCESS_SMOKE_TN="process_smoke"
RADAR_REFL2TTEN_TN="radar_refl2tten"
CLDANL_NONVAR_TN="cldanl_nonvar"
SAVE_RESTART_TN="save_restart"
SAVE_INPUT_TN="save_input"
JEDI_ENVAR_IODA_TN="jedi_envar_ioda"
#
# Number of nodes.
Expand Down Expand Up @@ -1820,6 +1821,7 @@ MAXTRIES_PROCESS_SMOKE="1"
MAXTRIES_RADAR_REF2TTEN="1"
MAXTRIES_CLDANL_NONVAR="1"
MAXTRIES_SAVE_RESTART="1"
MAXTRIES_SAVE_INPUT="1"
MAXTRIES_JEDI_ENVAR_IODA="1"
#
#
Expand Down Expand Up @@ -1955,6 +1957,9 @@ TILE_SETS="full"
# DO_RECENTER:
# Decide whether or not to run recenter for the ensemble members
#
# DO_SAVE_INPUT:
# Decide whether or not to run save_input after the DA analysis
#
# DO_ENS_GRAPHICS:
# Flag to turn on/off ensemble graphics. Turns OFF deterministic
# graphics.
Expand Down Expand Up @@ -2000,6 +2005,7 @@ DO_RECENTER="FALSE"
DO_ENS_GRAPHICS="FALSE"
DO_ENSPOST="FALSE"
DO_ENSINIT="FALSE"
DO_SAVE_INPUT="FALSE"
#
#-----------------------------------------------------------------------
#
Expand Down
3 changes: 3 additions & 0 deletions ush/generate_FV3LAM_wflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ settings="\
'cldanl_nonvar': ${CLDANL_NONVAR_TN}
'run_bufrsnd_tn': ${RUN_BUFRSND_TN}
'save_restart': ${SAVE_RESTART_TN}
'save_input': ${SAVE_INPUT_TN}
'tag': ${TAG}
'jedi_envar_ioda': ${JEDI_ENVAR_IODA_TN}
#
Expand Down Expand Up @@ -368,6 +369,7 @@ settings="\
'maxtries_radar_ref2tten': ${MAXTRIES_RADAR_REF2TTEN}
'maxtries_cldanl_nonvar': ${MAXTRIES_CLDANL_NONVAR}
'maxtries_save_restart': ${MAXTRIES_SAVE_RESTART}
'maxtries_save_input': ${MAXTRIES_SAVE_INPUT}
'maxtries_jedi_envar_ioda': ${MAXTRIES_JEDI_ENVAR_IODA}
#
# Flags that specify whether to run the preprocessing tasks.
Expand Down Expand Up @@ -473,6 +475,7 @@ settings="\
'do_ens_graphics': ${DO_ENS_GRAPHICS}
'do_enspost': ${DO_ENSPOST}
'do_ensinit': ${DO_ENSINIT}
'do_save_input': ${DO_SAVE_INPUT}
#
# data assimilation related parameters.
#
Expand Down
Loading