Skip to content

Commit

Permalink
Support coupled GEFS forecast, use mem000 for GEFS control (#1755)
Browse files Browse the repository at this point in the history
Makes the necessary updates to allow the workflow to run (non-wave) coupled
forecasts. Some of the coupled functions in postdet had to be updated because
they only checked for gfs and gdas runs, so necessary code was never executed.

Also updates so that the GEFS control uses `mem000` as the memdir so it
appears at the same level as the perturbed members. Relatedly, the default
member number in coupled files is changed to 000 instead of 01.

Finally, an unrelated error in the earc job is corrected where a character
from the middle of the line was moved to the beginning.

Resolves #1754
  • Loading branch information
WalterKolczynski-NOAA authored Jul 21, 2023
1 parent 09c6650 commit 4f31327
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 27 deletions.
2 changes: 1 addition & 1 deletion jobs/rocoto/ocnpost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ done
fhrlst=$(echo ${FHRLST} | sed -e 's/_/ /g; s/f/ /g; s/,/ /g')

export OMP_NUM_THREADS=1
export ENSMEM=${ENSMEM:-01}
export ENSMEM=${ENSMEM:-000}

export IDATE=${PDY}${cyc}

Expand Down
1 change: 1 addition & 0 deletions parm/config/gefs/config.aero
5 changes: 5 additions & 0 deletions parm/config/gefs/config.base.emc.dyn
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ export DO_MERGENSST="NO"
# Hybrid related
export NMEM_ENS=@NMEM_ENS@

# set default member number memdir for control
# this will be overwritten for the perturbed members
export ENSMEM="000"
export MEMDIR="mem${ENSMEM}"

# Check if cycle is cold starting
if [[ "${EXP_WARM_START}" = ".false." ]]; then
export IAU_FHROT=0
Expand Down
1 change: 1 addition & 0 deletions parm/config/gefs/config.defaults.s2sw
7 changes: 0 additions & 7 deletions parm/config/gefs/config.efcs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@

echo "BEGIN: config.efcs"

# TODO: the _ENKF counterparts need to be defined in config.base
export DO_AERO=${DO_AERO_ENKF:-"NO"}
export DO_OCN=${DO_OCN_ENKF:-"NO"}
export DO_ICE=${DO_ICE_ENKF:-"NO"}
export DO_WAVE=${DO_WAVE_ENKF:-"NO"}

# TODO: Possibly need OCNRES_ENKF, ICERES_ENKF, WAVRES_ENKF too
if [[ ${DO_OCN} == "YES" ]]; then
case "${CASE_ENS}" in
Expand Down Expand Up @@ -66,7 +60,6 @@ export SPPT_LSCALE=500000.
export SPPT_LOGIT=".true."
export SPPT_SFCLIMIT=".true."

# FV3 model namelist parameters to over-ride
export restart_interval=${restart_interval:-6}

echo "END: config.efcs"
1 change: 1 addition & 0 deletions parm/config/gefs/config.ice
1 change: 1 addition & 0 deletions parm/config/gefs/config.ocn
1 change: 1 addition & 0 deletions parm/config/gefs/config.wave
9 changes: 6 additions & 3 deletions parm/config/gfs/config.aero
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

# UFS-Aerosols settings

# Turn off warnings about unused variables
# shellcheck disable=SC2034

# Directory containing GOCART configuration files. Defaults to parm/chem if unset.
AERO_CONFIG_DIR=$HOMEgfs/parm/chem
AERO_CONFIG_DIR=${HOMEgfs}/parm/chem

# Path to the input data tree
case $machine in
case ${machine} in
"HERA")
AERO_INPUTS_DIR="/scratch1/NCEPDEV/global/glopara/data/gocart_emissions"
;;
Expand All @@ -23,7 +26,7 @@ case $machine in
AERO_INPUTS_DIR="/lfs4/HFIP/hfv3gfs/glopara/data/gocart_emissions"
;;
*)
echo "FATAL ERROR: Machine $machine unsupported for aerosols"
echo "FATAL ERROR: Machine ${machine} unsupported for aerosols"
exit 2
;;
esac
Expand Down
3 changes: 3 additions & 0 deletions parm/config/gfs/config.defaults.s2sw
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# Empty variables must include a space otherwise they will be overwritten

# Turn off warnings about unused variables
# shellcheck disable=SC2034

# config.base
FHMAX_GFS_00=48
FHMAX_GFS_06=48
Expand Down
2 changes: 1 addition & 1 deletion scripts/exgdas_enkf_earc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ if [[ "${ENSGRP}" -eq 0 ]]; then
# shellcheck disable=SC2312
templates=$(compgen -A variable | grep 'COM_OCEAN_.*_TMPL')
for template in ${templates}; do
YMEMDIR="${mem}" MD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}"
MEMDIR="${mem}" YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}"
remove_files "${directory}" "${exclude_list[@]}"
done

Expand Down
15 changes: 8 additions & 7 deletions scripts/exgdas_enkf_fcst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,17 @@ for imem in $(seq "${ENSBEG}" "${ENSEND}"); do

cd "${DATATOP}"

cmem=$(printf %03i "${imem}")
memchar="mem${cmem}"
ENSMEM=$(printf %03i "${imem}")
export ENSMEM
memchar="mem${ENSMEM}"

echo "Processing MEMBER: ${cmem}"
echo "Processing MEMBER: ${ENSMEM}"

ra=0

skip_mem="NO"
if [[ -f ${EFCSGRP}.fail ]]; then
memstat=$(grep "MEMBER ${cmem}" "${EFCSGRP}.fail" | grep -c "PASS")
memstat=$(grep "MEMBER ${ENSMEM}" "${EFCSGRP}.fail" | grep -c "PASS")
[[ ${memstat} -eq 1 ]] && skip_mem="YES"
fi

Expand Down Expand Up @@ -166,7 +167,7 @@ for imem in $(seq "${ENSBEG}" "${ENSEND}"); do

# Notify a member forecast failed and abort
if [[ ${ra} -ne 0 ]]; then
err_exit "FATAL ERROR: forecast of member ${cmem} FAILED. Aborting job"
err_exit "FATAL ERROR: forecast of member ${ENSMEM} FAILED. Aborting job"
fi

rc=$((rc+ra))
Expand All @@ -192,9 +193,9 @@ for imem in $(seq "${ENSBEG}" "${ENSEND}"); do
[[ -f log ]] && rm log
[[ -f log_new ]] && rm log_new
if [[ ${ra} -ne 0 ]]; then
echo "MEMBER ${cmem} : FAIL" > log
echo "MEMBER ${ENSMEM} : FAIL" > log
else
echo "MEMBER ${cmem} : PASS" > log
echo "MEMBER ${ENSMEM} : PASS" > log
fi
if [[ -s log_old ]] ; then
cat log_old log > log_new
Expand Down
13 changes: 5 additions & 8 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,8 @@ FV3_out() {
done
local idate=$(date -d "${idate:0:8} ${idate:8:2} + ${restart_interval} hours" +%Y%m%d%H)
done
elif [[ ${RUN} =~ "gfs" ]]; then
# No need to copy FV3 restart files when RUN=gfs
else
# No need to copy FV3 restart files when RUN=gfs or gefs
${NCP} "${DATA}/input.nml" "${COM_ATMOS_HISTORY}/input.nml"
fi
echo "SUB ${FUNCNAME[0]}: Output data for FV3 copied"
Expand Down Expand Up @@ -736,11 +736,10 @@ MOM6_postdet() {
[[ ! -d ${COM_OCEAN_HISTORY} ]] && mkdir -p "${COM_OCEAN_HISTORY}"

# Link output files
if [[ "${RUN}" =~ "gfs" ]]; then
if [[ "${RUN}" =~ "gfs" || "${RUN}" =~ "gefs" ]]; then
# Link output files for RUN = gfs

# TODO: get requirements on what files need to be written out and what these dates here are and what they mean
export ENSMEM=${ENSMEM:-01}

if [[ ! -d ${COM_OCEAN_HISTORY} ]]; then mkdir -p "${COM_OCEAN_HISTORY}"; fi

Expand Down Expand Up @@ -875,7 +874,7 @@ CICE_postdet() {

if [[ "${RUN}" =~ "gdas" ]]; then
cice_hist_avg=".false." # DA needs instantaneous
elif [[ "${RUN}" =~ "gfs" ]]; then
else
cice_hist_avg=".true." # P8 wants averaged over histfreq_n
fi

Expand Down Expand Up @@ -914,14 +913,12 @@ CICE_postdet() {
if [[ ! -d "${COM_ICE_HISTORY}" ]]; then mkdir -p "${COM_ICE_HISTORY}"; fi
mkdir -p "${COM_ICE_RESTART}"

if [[ "${RUN}" =~ "gfs" ]]; then
if [[ "${RUN}" =~ "gfs" || "${RUN}" =~ "gefs" ]]; then
# Link output files for RUN = gfs

# TODO: make these forecast output files consistent w/ GFS output
# TODO: Work w/ NB to determine appropriate naming convention for these files

export ENSMEM=${ENSMEM:-01}

# TODO: consult w/ NB on how to improve on this. Gather requirements and more information on what these files are and how they are used to properly catalog them
local vdate seconds vdatestr fhr last_fhr
for fhr in ${FV3_OUTPUT_FH}; do
Expand Down
1 change: 1 addition & 0 deletions ush/forecast_predet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ common_predet(){
CDUMP=${CDUMP:-gdas}
CASE=${CASE:-C768}
CDATE=${CDATE:-2017032500}
ENSMEM=${ENSMEM:-000}

FCSTEXECDIR=${FCSTEXECDIR:-${HOMEgfs}/exec}
FCSTEXEC=${FCSTEXEC:-ufs_model.x}
Expand Down

0 comments on commit 4f31327

Please sign in to comment.