Skip to content

Commit

Permalink
Move COM declares inside MEMDIR loop
Browse files Browse the repository at this point in the history
  • Loading branch information
KateFriedman-NOAA committed May 31, 2024
1 parent cb4e4d4 commit b7301f0
Showing 1 changed file with 26 additions and 28 deletions.
54 changes: 26 additions & 28 deletions jobs/JGLOBAL_STAGE_IC
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,6 @@ GDATE=$(date --utc -d "${PDY} ${cyc} - ${assim_freq} hours" +%Y%m%d%H)
gPDY="${GDATE:0:8}"
gcyc="${GDATE:8:2}"

# Declare COMs
if [[ ${EXP_WARM_START:-".false."} = ".true." ]]; then
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_MED_RESTART_PREV:COM_MED_RESTART_TMPL
export COM_ATMOS_RESTART_PREV COM_MED_RESTART_PREV
else
YMD=${PDY} HH=${cyc} declare_from_tmpl COM_ATMOS_INPUT
export COM_ATMOS_INPUT
fi
if [[ "${DO_OCN:-}" = "YES" ]]; then
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_OCEAN_RESTART_PREV:COM_OCEAN_RESTART_TMPL
export COM_OCEAN_RESTART_PREV
fi
if [[ "${DO_ICE:-}" = "YES" ]]; then
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_ICE_RESTART_PREV:COM_ICE_RESTART_TMPL
export COM_ICE_RESTART_PREV
fi
if [[ "${DO_WAVE:-}" = "YES" ]]; then
YMD=${PDY} HH=${cyc} declare_from_tmpl COM_WAVE_RESTART
export COM_WAVE_RESTART
fi

# Define MEMDIR_ARRAY
MEMDIR_ARRAY=()
if [[ "${RUN:-}" = "gefs" ]]; then
Expand All @@ -51,23 +29,43 @@ fi
# Initialize return code
err=0

error_message() {
echo "FATAL ERROR: Unable to copy ${1} to ${2} (Error code ${3})"
}

###############################################################
for MEMDIR in "${MEMDIR_ARRAY[@]}"; do

# Export MEMDIR; need even if empty
export MEMDIR=${MEMDIR:-}
# Execute the Script

# Declare COMs
if [[ ${EXP_WARM_START:-".false."} = ".true." ]]; then
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_MED_RESTART_PREV:COM_MED_RESTART_TMPL
export COM_ATMOS_RESTART_PREV COM_MED_RESTART_PREV
else
YMD=${PDY} HH=${cyc} declare_from_tmpl COM_ATMOS_INPUT
export COM_ATMOS_INPUT
fi
if [[ "${DO_OCN:-}" = "YES" ]]; then
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_OCEAN_RESTART_PREV:COM_OCEAN_RESTART_TMPL
export COM_OCEAN_RESTART_PREV
fi
if [[ "${DO_ICE:-}" = "YES" ]]; then
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_ICE_RESTART_PREV:COM_ICE_RESTART_TMPL
export COM_ICE_RESTART_PREV
fi
if [[ "${DO_WAVE:-}" = "YES" ]]; then
YMD=${PDY} HH=${cyc} declare_from_tmpl COM_WAVE_RESTART
export COM_WAVE_RESTART
fi

# Execute staging
"${SCRgfs}/exglobal_stage_ic.py"

done # for MEMDIR in "${MEMDIR_ARRAY[@]}"; do

###############################################################
# Check for errors and exit if any of the above failed
if [[ "${err}" -ne 0 ]]; then
echo "FATAL ERROR: Unable to copy ICs from ${BASE_CPLIC} to ${ROTDIR}; ABORT!"
echo "FATAL ERROR: Unable to copy ICs to ${ROTDIR}; ABORT!"
exit "${err}"
fi

Expand Down

0 comments on commit b7301f0

Please sign in to comment.