Skip to content

Commit

Permalink
Make needed updates to run forecast from GEFS (#1203)
Browse files Browse the repository at this point in the history
Since some of the GEFS functions are empty or missing, this PR is to complete/add such functions and also make some variables to accept values from other scripts

Refs: #1147
  • Loading branch information
XianwuXue-NOAA authored Jan 25, 2023
1 parent b576389 commit 32e9778
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 55 deletions.
1 change: 1 addition & 0 deletions parm/config/config.base.emc.dyn
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ if [ $DOHYBVAR = "YES" ]; then
export FHMIN_ENKF=3
export FHMAX_ENKF=9
export FHMAX_ENKF_GFS=120
export FHOUT_ENKF_GFS=3
if [ $l4densvar = ".true." ]; then
export FHOUT=1
export FHOUT_ENKF=1
Expand Down
2 changes: 1 addition & 1 deletion parm/config/config.resources
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ elif [ ${step} = "esfc" ]; then
elif [ ${step} = "efcs" ]; then

if [ ${CASE} = "C768" ]; then
export wtime_efcs="01:20:00"
export wtime_efcs="06:00:00"
else
export wtime_efcs="00:40:00"
fi
Expand Down
4 changes: 3 additions & 1 deletion scripts/exgdas_enkf_fcst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ export LEVS=${LEVS_ENKF:-${LEVS:-64}}

# nggps_diag_nml
export FHOUT=${FHOUT_ENKF:-3}

if [[ ${CDUMP} == "gfs" ]]; then
export FHOUT=${FHOUT_ENKF_GFS:-${FHOUT_ENKF:${FHOUT:-3}}}
fi
# model_configure
export DELTIM=${DELTIM_ENKF:-${DELTIM:-225}}
export FHMAX=${FHMAX_ENKF:-9}
Expand Down
24 changes: 6 additions & 18 deletions scripts/exglobal_forecast.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,14 @@ common_predet
echo $RUN
case $RUN in
'data') DATM_predet;;
'gfs') FV3_GFS_predet;;
'gdas') FV3_GFS_predet;;
'gefs') FV3_GEFS_predet;;
'gfs' | 'gdas' | 'gefs') FV3_GFS_predet;;
esac
[[ $cplflx = .true. ]] && MOM6_predet
[[ $cplwav = .true. ]] && WW3_predet
[[ $cplice = .true. ]] && CICE_predet

case $RUN in
'gfs') FV3_GFS_det;;
'gdas') FV3_GFS_det;;
'gefs') FV3_GEFS_det;;
'gfs' | 'gdas' | 'gefs') FV3_GFS_det;;
esac #no run type determination for data atmosphere
[[ $cplflx = .true. ]] && MOM6_det
[[ $cplwav = .true. ]] && WW3_det
Expand All @@ -146,9 +142,7 @@ echo "MAIN: Post-determination set up of run type"
echo $RUN
case $RUN in
'data') DATM_postdet;;
'gfs') FV3_GFS_postdet;;
'gdas') FV3_GFS_postdet;;
'gefs') FV3_GEFS_postdet;;
'gfs' | 'gdas' | 'gefs') FV3_GFS_postdet;;
esac #no post determination set up for data atmosphere
[[ $cplflx = .true. ]] && MOM6_postdet
[[ $cplwav = .true. ]] && WW3_postdet
Expand All @@ -159,9 +153,7 @@ echo "MAIN: Post-determination set up of run type finished"
echo "MAIN: Writing name lists and model configuration"
case $RUN in
'data') DATM_nml;;
'gfs') FV3_GFS_nml;;
'gdas') FV3_GFS_nml;;
'gefs') FV3_GEFS_nml;;
'gfs' | 'gdas' | 'gefs') FV3_GFS_nml;;
esac #no namelist for data atmosphere
[[ $cplflx = .true. ]] && MOM6_nml
[[ $cplwav = .true. ]] && WW3_nml
Expand All @@ -170,9 +162,7 @@ esac #no namelist for data atmosphere

case $RUN in
'data') DATM_model_configure;;
'gfs') FV3_model_configure;;
'gdas') FV3_model_configure;;
'gefs') FV3_model_configure;;
'gfs' | 'gdas' | 'gefs') FV3_model_configure;;
esac
echo "MAIN: Name lists and model configuration written"

Expand Down Expand Up @@ -202,9 +192,7 @@ fi
if [ $machine != 'sandbox' ]; then
case $RUN in
'data') data_out_Data_ATM;;
'gfs') data_out_GFS;;
'gdas') data_out_GFS;;
'gefs') data_out_GEFS;;
'gfs' | 'gdas' | 'gefs') data_out_GFS;;
esac
[[ $cplflx = .true. ]] && MOM6_out
[[ $cplwav = .true. ]] && WW3_out
Expand Down
8 changes: 2 additions & 6 deletions ush/forecast_det.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ FV3_GFS_det(){

#-------------------------------------------------------
# determine if restart IC exists to continue from a previous forecast
RERUN="NO"
RERUN=${RERUN:-"NO"}
filecount=$(find "${RSTDIR_ATM:-/dev/null}" -type f | wc -l)
if [ ${CDUMP} = "gfs" -a ${rst_invt1} -gt 0 -a ${FHMAX} -gt ${rst_invt1} -a ${filecount} -gt 10 ]; then
if [[ ( ${CDUMP} = "gfs" || ( ${RUN} = "gefs" && ${CDATE_RST} = "" )) && ${rst_invt1} -gt 0 && ${FHMAX} -gt ${rst_invt1} && ${filecount} -gt 10 ]]; then
reverse=$(echo "${restart_interval[@]} " | tac -s ' ')
for xfh in ${reverse} ; do
yfh=$((xfh-(IAU_OFFSET/2)))
Expand Down Expand Up @@ -74,10 +74,6 @@ FV3_GFS_det(){
#-------------------------------------------------------
}

FV3_GEFS_det(){
echo "SUB ${FUNCNAME[0]}: Defining variables for FV3GEFS"
}

WW3_det(){
echo "SUB ${FUNCNAME[0]}: Run type determination for WW3"
}
Expand Down
16 changes: 6 additions & 10 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
## for execution.
#####

FV3_GEFS_postdet(){
echo SUB ${FUNCNAME[0]}: Linking input data for FV3 $RUN
# soft link commands insert here
}

DATM_postdet(){
######################################################################
# Link DATM inputs (ie forcing files) #
Expand Down Expand Up @@ -134,7 +129,7 @@ EOF
#.............................

else ## cold start
for file in $(ls $memdir/INPUT/*.nc); do
for file in $(ls ${memdir}/INPUT/*.nc); do
file2=$(echo $(basename $file))
fsuf=$(echo $file2 | cut -c1-3)
if [ $fsuf = "gfs" -o $fsuf = "sfc" ]; then
Expand Down Expand Up @@ -307,9 +302,9 @@ EOF
# inline post fix files
if [ $WRITE_DOPOST = ".true." ]; then
$NLN $PARM_POST/post_tag_gfs${LEVS} $DATA/itag
$NLN $PARM_POST/postxconfig-NT-GFS-TWO.txt $DATA/postxconfig-NT.txt
$NLN $PARM_POST/postxconfig-NT-GFS-F00-TWO.txt $DATA/postxconfig-NT_FH00.txt
$NLN $PARM_POST/params_grib2_tbl_new $DATA/params_grib2_tbl_new
$NLN ${FLTFILEGFS:-$PARM_POST/postxconfig-NT-GFS-TWO.txt} $DATA/postxconfig-NT.txt
$NLN ${FLTFILEGFSF00:-$PARM_POST/postxconfig-NT-GFS-F00-TWO.txt} $DATA/postxconfig-NT_FH00.txt
$NLN ${POSTGRB2TBL:-$PARM_POST/params_grib2_tbl_new} $DATA/params_grib2_tbl_new
fi

#------------------------------------------------------------------
Expand Down Expand Up @@ -593,13 +588,14 @@ data_out_GFS() {
done
fi
elif [ $CDUMP = "gfs" ]; then
$NCP $DATA/input.nml $ROTDIR/${CDUMP}.${PDY}/${cyc}/atmos/
$NCP $DATA/input.nml ${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos/
fi
fi

echo "SUB ${FUNCNAME[0]}: Output data for FV3 copied"
}


WW3_postdet() {
echo "SUB ${FUNCNAME[0]}: Linking input data for WW3"
COMPONENTwave=${COMPONENTwave:-${RUN}wave}
Expand Down
38 changes: 20 additions & 18 deletions ush/forecast_predet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,31 +205,33 @@ FV3_GFS_predet(){
print_freq=${print_freq:-6}

#-------------------------------------------------------
if [ $CDUMP = "gfs" ] && [ $rst_invt1 -gt 0 ] && [ $MEMBER -lt 0 ]; then
RSTDIR_ATM=${RSTDIR:-$ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos/RERUN_RESTART
if [[ ${CDUMP} = "gfs" || ${RUN} = "gefs" ]] && [ ${rst_invt1} -gt 0 ]; then
RSTDIR_ATM=${RSTDIR_ATM:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos/RERUN_RESTART}
if [ ! -d $RSTDIR_ATM ]; then mkdir -p $RSTDIR_ATM ; fi
$NLN $RSTDIR_ATM RESTART
# The final restart written at the end doesn't include the valid date
# Create links that keep the same name pattern for these files
VDATE=$($NDATE +$FHMAX_GFS $CDATE)
vPDY=$(echo $VDATE | cut -c1-8)
vcyc=$(echo $VDATE | cut -c9-10)
files="coupler.res fv_core.res.nc"
for tile in {1..6}; do
for base in ca_data fv_core.res fv_srf_wnd.res fv_tracer.res phy_data sfc_data; do
files="${files} ${base}.tile${tile}.nc"
if [[ $(( ${FHMAX_GFS} % ${restart_interval_gfs} )) == 0 ]]; then
# The final restart written at the end doesn't include the valid date
# Create links that keep the same name pattern for these files
VDATE=$($NDATE +$FHMAX_GFS $CDATE)
vPDY=$(echo $VDATE | cut -c1-8)
vcyc=$(echo $VDATE | cut -c9-10)
files="coupler.res fv_core.res.nc"
for tile in {1..6}; do
for base in ca_data fv_core.res fv_srf_wnd.res fv_tracer.res phy_data sfc_data; do
files="${files} ${base}.tile${tile}.nc"
done
done
done
for file in $files; do
$NLN $RSTDIR_ATM/$file $RSTDIR_ATM/${vPDY}.${vcyc}0000.$file
done
for file in $files; do
$NLN $RSTDIR_ATM/$file $RSTDIR_ATM/${vPDY}.${vcyc}0000.$file
done
fi
else
mkdir -p $DATA/RESTART
fi

#-------------------------------------------------------
# member directory
if [ $MEMBER -lt 0 ]; then
if [[ ${MEMBER} -lt 0 || ${RUN} = "gefs" ]]; then
prefix=$CDUMP
rprefix=$rCDUMP
memchar=""
Expand All @@ -238,13 +240,13 @@ FV3_GFS_predet(){
rprefix=enkf$rCDUMP
memchar=mem$(printf %03i $MEMBER)
fi
memdir=$ROTDIR/${prefix}.$PDY/$cyc/$memchar/atmos
memdir=${memdir:-${ROTDIR}/${prefix}.${PDY}/${cyc}/${memchar}/atmos}
if [ ! -d $memdir ]; then mkdir -p $memdir; fi

GDATE=$($NDATE -$assim_freq $CDATE)
gPDY=$(echo $GDATE | cut -c1-8)
gcyc=$(echo $GDATE | cut -c9-10)
gmemdir=$ROTDIR/${rprefix}.$gPDY/$gcyc/$memchar/atmos
gmemdir=${gmemdir:-${ROTDIR}/${rprefix}.${gPDY}/${gcyc}/${memchar}/atmos}

if [[ "$DOIAU" = "YES" ]]; then
sCDATE=$($NDATE -3 $CDATE)
Expand Down
3 changes: 2 additions & 1 deletion workflow/rocoto/workflow_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1254,9 +1254,10 @@ def epos(self):
def _get_eposgroups(epos):
fhmin = epos['FHMIN_ENKF']
fhmax = epos['FHMAX_ENKF']
fhout = epos['FHOUT_ENKF']
if self.cdump == "gfs":
fhmax = epos['FHMAX_ENKF_GFS']
fhout = epos['FHOUT_ENKF']
fhout = epos['FHOUT_ENKF_GFS']
fhrs = range(fhmin, fhmax + fhout, fhout)

neposgrp = epos['NEPOSGRP']
Expand Down

0 comments on commit 32e9778

Please sign in to comment.