Skip to content

Commit

Permalink
further updated exglobal_fcst_nemsfv3gfs.sh to use restart_wave direc…
Browse files Browse the repository at this point in the history
…tory for gdas cycle as well
  • Loading branch information
yangfanglin committed Jul 6, 2020
1 parent 5fe1a21 commit 4a1cf2b
Showing 1 changed file with 18 additions and 31 deletions.
49 changes: 18 additions & 31 deletions scripts/exglobal_fcst_nemsfv3gfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,32 +148,38 @@ if [ ! -d $DATA ]; then
fi
cd $DATA || exit 8
mkdir -p $DATA/INPUT
if [ $CDUMP = "gfs" -a $rst_invt1 -gt 0 ]; then
RSTDIR_TMP=${RSTDIR:-$ROTDIR}/${CDUMP}.${PDY}/${cyc}/RERUN_RESTART
if [ ! -d $RSTDIR_TMP ]; then mkdir -p $RSTDIR_TMP ; fi
$NLN $RSTDIR_TMP RESTART
if [ $cplwav = ".true." ]; then
RSTDIR_WAVE=${RSTDIR:-$ROTDIR}/${CDUMP}wave.${PDY}/${cyc}/RERUN_RESTART
if [ ! -d $RSTDIR_WAVE ]; then mkdir -p $RSTDIR_WAVE ; fi
$NLN $RSTDIR_WAVE restart_wave

if [ $cplwav = ".true." ]; then
if [ $CDUMP = "gdas" ]; then
RSTDIR_WAVE=$ROTDIR/${CDUMP}wave.${PDY}/${cyc}/restart
else
RSTDIR_WAVE=${RSTDIR_WAVE:-$ROTDIR/${CDUMP}wave.${PDY}/${cyc}/restart}
fi
if [ ! -d $RSTDIR_WAVE ]; then mkdir -p $RSTDIR_WAVE ; fi
$NLN $RSTDIR_WAVE restart_wave
fi

if [ $CDUMP = "gfs" -a $rst_invt1 -gt 0 ]; then
RSTDIR_ATM=${RSTDIR:-$ROTDIR}/${CDUMP}.${PDY}/${cyc}/RERUN_RESTART
if [ ! -d $RSTDIR_ATM ]; then mkdir -p $RSTDIR_ATM ; fi
$NLN $RSTDIR_ATM RESTART
else
mkdir -p $DATA/RESTART
fi

#-------------------------------------------------------
# determine if restart IC exists to continue from a previous forecast
RERUN="NO"
filecount=$(find $RSTDIR_TMP -type f | wc -l)
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
yfh=$((xfh-(IAU_OFFSET/2)))
SDATE=$($NDATE +$yfh $CDATE)
PDYS=$(echo $SDATE | cut -c1-8)
cycs=$(echo $SDATE | cut -c9-10)
flag1=$RSTDIR_TMP/${PDYS}.${cycs}0000.coupler.res
flag2=$RSTDIR_TMP/coupler.res
flag1=$RSTDIR_ATM/${PDYS}.${cycs}0000.coupler.res
flag2=$RSTDIR_ATM/coupler.res
if [ -s $flag1 ]; then
CDATE_RST=$SDATE
[[ $RERUN = "YES" ]] && break
Expand Down Expand Up @@ -316,7 +322,7 @@ EOF
export warm_start=".true."
PDYT=$(echo $CDATE_RST | cut -c1-8)
cyct=$(echo $CDATE_RST | cut -c9-10)
for file in $(ls $RSTDIR_TMP/${PDYT}.${cyct}0000.*); do
for file in $(ls $RSTDIR_ATM/${PDYT}.${cyct}0000.*); do
file2=$(echo $(basename $file))
file2=$(echo $file2 | cut -d. -f3-)
$NLN $file $DATA/INPUT/$file2
Expand Down Expand Up @@ -1310,7 +1316,6 @@ if [ $SEND = "YES" ]; then
if [ $CDUMP = "gdas" -a $rst_invt1 -gt 0 ]; then
cd $DATA/RESTART
mkdir -p $memdir/RESTART

for rst_int in $restart_interval ; do
if [ $rst_int -ge 0 ]; then
RDATE=$($NDATE +$rst_int $CDATE)
Expand All @@ -1319,15 +1324,6 @@ if [ $SEND = "YES" ]; then
for file in $(ls ${rPDY}.${rcyc}0000.*) ; do
$NCP $file $memdir/RESTART/$file
done

if [ $cplwav = ".true." ]; then
WRDIR=$ROTDIR/gdaswave.${PDY}/${cyc}/restart
mkdir -p ${WRDIR}
for wavGRD in $waveGRD ; do
# Copy wave IC for the next cycle
$NCP $DATA/${rPDY}.${rcyc}0000.restart.${wavGRD} ${WRDIR}
done
fi
fi
done
if [ $DOIAU = "YES" ] || [ $DOIAU_coldstart = "YES" ]; then
Expand All @@ -1342,17 +1338,8 @@ if [ $SEND = "YES" ]; then
for file in $(ls ${rPDY}.${rcyc}0000.*) ; do
$NCP $file $memdir/RESTART/$file
done
if [ $cplwav = ".true." ]; then
WRDIR=$ROTDIR/gdaswave.${PDY}/${cyc}/restart/
mkdir -p ${WRDIR}
for wavGRD in $waveGRD ; do
$NCP $DATA/${rPDY}.${rcyc}0000.restart.${wavGRD} ${WRDIR}
done
fi
fi

fi

fi

#------------------------------------------------------------------
Expand Down

0 comments on commit 4a1cf2b

Please sign in to comment.