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

Copy FV3 restarts and bugfix on COM_MED_RESTART_PREV #2534

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion jobs/JGLOBAL_FORECAST
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ if [[ "${DO_OCN}" == "YES" ]]; then
YMD="${PDY}" HH="${cyc}" declare_from_tmpl -rx COM_MED_RESTART COM_OCEAN_RESTART COM_OCEAN_INPUT \
COM_OCEAN_HISTORY COM_OCEAN_ANALYSIS
RUN="${rCDUMP}" YMD="${gPDY}" HH="${gcyc}" declare_from_tmpl -rx \
COM_OCEAN_RESTART_PREV:COM_OCEAN_RESTART_TMPL
COM_OCEAN_RESTART_PREV:COM_OCEAN_RESTART_TMPL \
COM_MED_RESTART_PREV:COM_MED_RESTART_TMPL
fi

if [[ "${DO_ICE}" == "YES" ]]; then
Expand Down
1 change: 1 addition & 0 deletions parm/config/gfs/config.base
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export WRITE_NSFLIP=".true."

# IAU related parameters
export DOIAU="@DOIAU@" # Enable 4DIAU for control with 3 increments
if [[ "${MODE}" == "cycled" && "${SDATE}" == "${PDY}${cyc}" && ${EXP_WARM_START} == ".true." ]]; then export DOIAU="NO"; fi
export IAUFHRS="3,6,9"
export IAU_FHROT=${IAUFHRS%%,*}
export IAU_DELTHRS=6
Expand Down
39 changes: 19 additions & 20 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,29 +224,28 @@ FV3_out() {
done
done

# Copy restarts in the assimilation window for RUN=gdas|enkfgdas|enkfgfs
if [[ "${RUN}" =~ "gdas" || "${RUN}" == "enkfgfs" ]]; then
local restart_date
restart_date=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${restart_interval} hours" +%Y%m%d%H)
while (( restart_date < forecast_end_cycle )); do
echo "Copying FV3 restarts for 'RUN=${RUN}' at ${restart_date}"
for fv3_restart_file in "${fv3_restart_files[@]}"; do
restart_file="${restart_date:0:8}.${restart_date:8:2}0000.${fv3_restart_file}"
${NCP} "${DATArestart}/FV3_RESTART/${restart_file}" \
"${COM_ATMOS_RESTART}/${restart_file}"
done
restart_date=$(date --utc -d "${restart_date:0:8} ${restart_date:8:2} + ${restart_interval} hours" +%Y%m%d%H)
# Create an array of restart dates that need to be copied back to COM based on RUN
local rdate restart_dates
if [[ "${RUN}" == "gfs" || "${RUN}" == "gefs" ]]; then # Copy last restart files for RUN=gfs|gefs to COM
rdate=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${FHMAX} hours" +%Y%m%d.%H0000)
restart_dates=("${rdate}")
else # Copy restart files for RUN=gdas|enkfgdas|enkfgfs to COM
local restart_hour
restart_dates=()
for restart_hour in "${FV3_RESTART_FH[@]}"; do
rdate=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${restart_hour} hours" +%Y%m%d.%H0000)
restart_dates+=("${rdate}")
done
fi

# Copy the final restart files at the end of the forecast segment
# The final restart written at the end of the forecast does not include the valid date
# TODO: verify the above statement since RM found that it did!
echo "Copying FV3 restarts for 'RUN=${RUN}' at the end of the forecast segment: ${forecast_end_cycle}"
for fv3_restart_file in "${fv3_restart_files[@]}"; do
restart_file="${forecast_end_cycle:0:8}.${forecast_end_cycle:8:2}0000.${fv3_restart_file}"
${NCP} "${DATArestart}/FV3_RESTART/${restart_file}" \
"${COM_ATMOS_RESTART}/${restart_file}"
# Copy restart files for the dates from above to COM
local restart_date
for restart_date in "${restart_dates[@]}"; do
echo "Copying FV3 restarts for 'RUN=${RUN}' at ${restart_date}"
for fv3_restart_file in "${fv3_restart_files[@]}"; do
${NCP} "${DATArestart}/FV3_RESTART/${restart_date}.${fv3_restart_file}" \
"${COM_ATMOS_RESTART}/${restart_date}.${fv3_restart_file}"
done
done

echo "SUB ${FUNCNAME[0]}: Output data for FV3 copied"
Expand Down
10 changes: 10 additions & 0 deletions ush/forecast_predet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,18 @@ FV3_predet(){
FHCYC=${FHCYC:-24}
restart_interval=${restart_interval:-${FHMAX}}
# restart_interval = 0 implies write restart at the END of the forecast i.e. at FHMAX
# Convert restart interval into an explicit list for FV3
if (( restart_interval == 0 )); then
restart_interval=${FHMAX}
FV3_RESTART_FH=("${restart_interval}")
else
# shellcheck disable=SC2312
mapfile -t FV3_RESTART_FH < <(seq "${restart_interval}" "${restart_interval}" "${FHMAX}")
# If the last forecast hour is not in the array, add it
local nrestarts=${#FV3_RESTART_FH[@]}
if (( FV3_RESTART_FH[nrestarts-1] != FHMAX )); then
FV3_RESTART_FH+=("${FHMAX}")
fi
fi

# Convert output settings into an explicit list for FV3
Expand Down
2 changes: 1 addition & 1 deletion ush/parsing_model_configure_FV3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ local SHOUR=${model_start_date:8:2}
# FHMAX
local FHROT=${IAU_FHROT:-0}
local DT_ATMOS=${DELTIM}
local RESTART_INTERVAL="${restart_interval} -1"
local RESTART_INTERVAL="${FV3_RESTART_FH[*]}"
# QUILTING
local QUILTING_RESTART=".true."
local WRITE_GROUP=${WRITE_GROUP:-1}
Expand Down
Loading