Skip to content

Stop checking for restarts on non-GFS CDUMPs #1179

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

Merged
merged 3 commits into from
Dec 15, 2022
Merged
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
50 changes: 25 additions & 25 deletions ush/forecast_det.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,55 +19,55 @@ FV3_GFS_det(){
res_latlon_dynamics="''"

# Determine if this is a warm start or cold start
if [ -f $gmemdir/RESTART/${sPDY}.${scyc}0000.coupler.res ]; then
if [[ -f "${gmemdir}/RESTART/${sPDY}.${scyc}0000.coupler.res" ]]; then
export warm_start=".true."
fi

# turn IAU off for cold start
DOIAU_coldstart=${DOIAU_coldstart:-"NO"}
if [ $DOIAU = "YES" -a $warm_start = ".false." ] || [ $DOIAU_coldstart = "YES" -a $warm_start = ".true." ]; then
if [ ${DOIAU} = "YES" -a ${warm_start} = ".false." ] || [ ${DOIAU_coldstart} = "YES" -a ${warm_start} = ".true." ]; then
export DOIAU="NO"
echo "turning off IAU since warm_start = $warm_start"
echo "turning off IAU since warm_start = ${warm_start}"
DOIAU_coldstart="YES"
IAU_OFFSET=0
sCDATE=$CDATE
sPDY=$PDY
scyc=$cyc
tPDY=$sPDY
tcyc=$cyc
sCDATE=${CDATE}
sPDY=${PDY}
scyc=${cyc}
tPDY=${sPDY}
tcyc=${cyc}
fi

#-------------------------------------------------------
# determine if restart IC exists to continue from a previous forecast
RERUN="NO"
filecount=$(find $RSTDIR_ATM -type f | wc -l)
if [ $CDUMP = "gfs" -a $rst_invt1 -gt 0 -a $FHMAX -gt $rst_invt1 -a $filecount -gt 10 ]; then
[[ ${CDUMP} = "gfs" ]] && filecount=$(find "${RSTDIR_ATM}" -type f | wc -l)
if [ ${CDUMP} = "gfs" -a ${rst_invt1} -gt 0 -a ${FHMAX} -gt ${rst_invt1} -a ${filecount} -gt 10 ]; then
reverse=$(echo "${restart_interval[@]} " | tac -s ' ')
for xfh in $reverse ; do
for xfh in ${reverse} ; do
yfh=$((xfh-(IAU_OFFSET/2)))
SDATE=$($NDATE +$yfh $CDATE)
PDYS=$(echo $SDATE | cut -c1-8)
cycs=$(echo $SDATE | cut -c9-10)
flag1=$RSTDIR_ATM/${PDYS}.${cycs}0000.coupler.res
flag2=$RSTDIR_ATM/coupler.res
SDATE=$(${NDATE} +${yfh} "${CDATE}")
PDYS=$(echo "${SDATE}" | cut -c1-8)
cycs=$(echo "${SDATE}" | cut -c9-10)
flag1=${RSTDIR_ATM}/${PDYS}.${cycs}0000.coupler.res
flag2=${RSTDIR_ATM}/coupler.res

#make sure that the wave restart files also exist if cplwav=true
waverstok=".true."
if [ $cplwav = ".true." ]; then
for wavGRD in $waveGRD ; do
if [ ! -f ${RSTDIR_WAVE}/${PDYS}.${cycs}0000.restart.${wavGRD} ]; then
if [[ "${cplwav}" = ".true." ]]; then
for wavGRD in ${waveGRD} ; do
if [[ ! -f "${RSTDIR_WAVE}/${PDYS}.${cycs}0000.restart.${wavGRD}" ]]; then
waverstok=".false."
fi
done
fi

if [ -s $flag1 -a $waverstok = ".true." ]; then
CDATE_RST=$SDATE
[[ $RERUN = "YES" ]] && break
mv $flag1 ${flag1}.old
if [ -s $flag2 ]; then mv $flag2 ${flag2}.old ;fi
if [[ -s "${flag1}" ]] && [[ ${waverstok} = ".true." ]]; then
CDATE_RST=${SDATE}
[[ ${RERUN} = "YES" ]] && break
mv "${flag1}" "${flag1}.old"
if [[ -s "${flag2}" ]]; then mv "${flag2}" "${flag2}.old" ;fi
RERUN="YES"
[[ $xfh = $rst_invt1 ]] && RERUN="NO"
[[ ${xfh} = ${rst_invt1} ]] && RERUN="NO"
fi
done
fi
Expand Down