Skip to content
Draft
Show file tree
Hide file tree
Changes from 8 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 .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
url = https://github.com/NOAA-EMC/gfs-utils
[submodule "sorc/ufs_utils.fd"]
path = sorc/ufs_utils.fd
url = https://github.com/ufs-community/UFS_UTILS.git
url = https://github.com/ClaraDraper-NOAA/UFS_UTILS.git
branch = feature/speedup_sfcanl
[submodule "sorc/verif-global.fd"]
path = sorc/verif-global.fd
url = https://github.com/NOAA-EMC/EMC_verif-global.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ if [[ ${status} -ne 0 ]]; then
exit "${status}"
fi

export job="sfcanl"
export job="sfcanlg"
export jobid="${job}.$$"

###############################################################
# Execute the JJOB
"${HOMEgfs}/dev/jobs/JGLOBAL_ATMOS_SFCANL"
"${HOMEgfs}/dev/jobs/JGLOBAL_ATMOS_SFCANL_GCYCLE"
status=$?

exit "${status}"
21 changes: 21 additions & 0 deletions dev/job_cards/rocoto/sfcanl_regrid.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#! /usr/bin/env bash

set -x

###############################################################
# Source FV3GFS workflow modules
source "${HOMEgfs}/dev/ush/load_modules.sh" run
status=$?
if [[ ${status} -ne 0 ]]; then
exit "${status}"
fi

export job="sfcanlr"
export jobid="${job}.$$"

###############################################################
# Execute the JJOB
"${HOMEgfs}/dev/jobs/JGLOBAL_ATMOS_SFCANL_REGRID"
status=$?

exit "${status}"
67 changes: 67 additions & 0 deletions dev/jobs/JGLOBAL_ATMOS_SFCANL_GCYCLE
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#! /usr/bin/env bash

# for now, leave environment and config files un-changed.
source "${HOMEgfs}/ush/jjob_header.sh" -e "sfcanl" -c "base sfcanl"

##############################################
# Begin JOB SPECIFIC work
##############################################
# Ignore possible spelling error (nothing is misspelled)
# shellcheck disable=SC2153
GDATE=$(date --utc -d "${PDY} ${cyc} - ${assim_freq} hours" +%Y%m%d%H)
export GDATE

BKG_RUN="gdas"
if [[ "${RUN}" == "gcafs" || "${RUN}" == "gcdas" ]]; then
BKG_RUN="gcdas"
fi

RUN=${BKG_RUN} YMD=${GDATE:0:8} HH=${GDATE:8:2} declare_from_tmpl -rx \
COMIN_OBS_PREV:COM_OBS_TMPL \
COMIN_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL

YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COMIN_OBS:COM_OBS_TMPL \
COMIN_ATMOS_ANALYSIS:COM_ATMOS_ANALYSIS_TMPL \
COMIN_SNOW_ANALYSIS:COM_SNOW_ANALYSIS_TMPL

YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COMOUT_ATMOS_RESTART:COM_ATMOS_RESTART_TMPL

RUN="enkfgdas" MEMDIR="ensstat" YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COMIN_ATMOS_ENKF_ANALYSIS_STAT:COM_ATMOS_ANALYSIS_TMPL

mkdir -p "${COMOUT_ATMOS_RESTART}"

# Use CFP to stage and save files in parallel
export USE_CFP=YES

###############################################################
# Run relevant script

${SFCANALSH:-${SCRgfs}/exglobal_atmos_sfcanl_gcycle.sh} && true
export err=$?
if [[ ${err} -ne 0 ]]; then
err_exit
fi

##############################################
# End JOB SPECIFIC work
##############################################

##############################################
# Final processing
##############################################
if [[ -e "${pgmout}" ]]; then
cat "${pgmout}"
fi

##########################################
# Remove the Temporary working directory
##########################################
cd "${DATAROOT}" || true
if [[ "${KEEPDATA}" == "NO" ]]; then
rm -rf "${DATA}"
fi

exit 0
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export USE_CFP=YES
###############################################################
# Run relevant script

${SFCANALSH:-${SCRgfs}/exglobal_atmos_sfcanl.sh} && true
${SFCANALSH:-${SCRgfs}/exglobal_atmos_sfcanl_regrid.sh} && true
export err=$?
if [[ ${err} -ne 0 ]]; then
err_exit
Expand Down
1 change: 0 additions & 1 deletion dev/parm/config/gfs/config.esfc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ if [[ ${DO_GSISOILDA} == "YES" ]]; then
else
export GCYCLE_DO_SOILINCR=".true."
fi
export GCYCLE_INTERP_LANDINCR=".false."
export REGRID_EXEC="${HOMEgfs}/exec/regridStates.x"
fi

Expand Down
1 change: 0 additions & 1 deletion dev/parm/config/gfs/config.sfcanl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ if [[ "${DO_GSISOILDA}" == "YES" ]]; then
else
export GCYCLE_DO_SOILINCR=".true."
fi
export GCYCLE_INTERP_LANDINCR=".false."
export REGRID_EXEC="${HOMEgfs}/exec/regridStates.x"
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
################################################################################
#### UNIX Script Documentation Block
# . .
# Script name: exglobal_atmos_sfcanl.sh
# Script description: Makes global model surface analysis files
# Script name: exglobal_atmos_sfcanl_gcycle.sh
# Script description: Updates global surface analysis files
# with global_cycle program
#
# Author: Russ Treadon Org: NCEP/EMC Date: 2021-12-13
#
# Abstract: This script makes global model surface analysis files
# Abstract: This script updates global model surface analysis files
# using global_cycle
#
# $Id$
#
Expand All @@ -17,13 +19,8 @@
#
################################################################################

# Set environment.

# Derived base variables

# Dependent Scripts and Executables
CYCLESH=${CYCLESH:-"${USHgfs}/global_cycle.sh"}
REGRIDSH=${REGRIDSH:-"${USHgfs}/regrid_gsiSfcIncr_to_tile.sh"}
export CYCLEXEC=${CYCLEXEC:-"${EXECgfs}/global_cycle"}
NTHREADS_CYCLE=${NTHREADS_CYCLE:-24}
APRUN_CYCLE=${APRUN_CYCLE:-${APRUN:-""}}
Expand Down Expand Up @@ -125,54 +122,23 @@ fi

# Collect the dates in the window to update surface restarts
gcycle_dates=("${PDY}${cyc}") # Always update surface restarts at middle of window

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

Suggested change
gcycle_dates=("${PDY}${cyc}") # Always update surface restarts at middle of window
gcycle_dates=("${PDY}${cyc}") # Always update surface restarts at middle of window

soilinc_fhrs=("${assim_freq}") # increment file at middle of window
LFHR="${assim_freq}"
if [[ "${DOIAU:-}" == "YES" ]]; then # Update surface restarts at beginning of window
half_window=$((assim_freq / 2))
soilinc_fhrs+=("${half_window}")
LFHR=-1
BDATE=$(date --utc -d "${PDY} ${cyc} - ${half_window} hours" +%Y%m%d%H)
gcycle_dates+=("${BDATE}")
fi

# if doing GSI soil anaysis, copy increment file and re-grid it to native model resolution
if [[ "${DO_GSISOILDA}" == "YES" ]]; then

export COMIN_SOIL_ANALYSIS_MEM="${COMIN_ATMOS_ENKF_ANALYSIS_STAT}"
export COMOUT_ATMOS_ANALYSIS_MEM="${COMIN_ATMOS_ANALYSIS}"
export CASE_IN="${CASE_ENS}"
export CASE_OUT="${CASE}"
export OCNRES_OUT="${OCNRES}"
export LFHR

"${REGRIDSH}"
export err=$?
if [[ ${err} -ne 0 ]]; then
err_exit "Soil increment file was not regridded correctly!"
fi

fi

# Loop over the dates in the window to update the surface restarts
for hr in "${!gcycle_dates[@]}"; do

gcycle_date="${gcycle_dates[hr]}"
FHR="${soilinc_fhrs[hr]}"
echo "Updating surface restarts for ${gcycle_date} ..."

datestr="${gcycle_date:0:8}.${gcycle_date:8:2}0000"

if [[ "${DO_GSISOILDA}" == "YES" ]] && [[ "${GCYCLE_DO_SOILINCR}" == ".true." ]]; then
for ((nn = 1; nn <= ntiles; nn++)); do
cpreq "${COMIN_ATMOS_ANALYSIS}/increment.sfc.i00${FHR}.tile${nn}.nc" \
"${DATA}/soil_xainc.00${nn}"
done
fi

# Copy inputs from COMIN to DATA
for ((nn = 1; nn <= ntiles; nn++)); do
cpreq "${sfcdata_dir}/${datestr}.${snow_prefix}sfc_data.tile${nn}.nc" "${DATA}/fnbgsi.00${nn}"
cpreq "${DATA}/fnbgsi.00${nn}" "${DATA}/fnbgso.00${nn}"
cpreq "${sfcdata_dir}/${datestr}.${snow_prefix}sfc_data.tile${nn}.nc" "${DATA}/sfc_data_cycle.00${nn}"
done

"${CYCLESH}" && true
Expand All @@ -183,7 +149,7 @@ for hr in "${!gcycle_dates[@]}"; do

# Copy outputs from DATA to COMOUT
for ((nn = 1; nn <= ntiles; nn++)); do
cpfs "${DATA}/fnbgso.00${nn}" "${COMOUT_ATMOS_RESTART}/${datestr}.sfcanl_data.tile${nn}.nc"
cpfs "${DATA}/sfc_data_cycle.00${nn}" "${COMOUT_ATMOS_RESTART}/${datestr}.sfcanl_data.tile${nn}.nc"
done

done
Expand Down
53 changes: 53 additions & 0 deletions dev/scripts/exglobal_atmos_sfcanl_regrid.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#! /usr/bin/env bash

################################################################################
#### UNIX Script Documentation Block
# . .
# Script name: exglobal_atmos_sfcanl_regrid.sh
# Script description: Regrids land increments generated by GSI
#
# Author: Russ Treadon Org: NCEP/EMC Date: 2021-12-13
#
# Abstract: Regrids land increments generated by GSI
#
# $Id$
#
# Attributes:
# Language: POSIX shell
#
################################################################################

# Dependent Scripts and Executables
REGRIDSH=${REGRIDSH:-"${USHgfs}/regrid_gsiSfcIncr_to_tile.sh"}

if [[ "${DO_GSISOILDA}" == "YES" ]]; then

# Collect the dates in the window to update surface restarts

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

Suggested change
# Collect the dates in the window to update surface restarts
# Collect the dates in the window to update surface restarts

soilinc_fhrs=("${assim_freq}") # increment file at middle of window
LFHR="${assim_freq}"
if [[ "${DOIAU:-}" == "YES" ]]; then # Update surface restarts at beginning of window
half_window=$((assim_freq / 2))
soilinc_fhrs+=("${half_window}")
LFHR=-1
fi

export COMIN_SOIL_ANALYSIS_MEM="${COMIN_ATMOS_ENKF_ANALYSIS_STAT}"
export COMOUT_ATMOS_ANALYSIS_MEM="${COMIN_ATMOS_ANALYSIS}"
export CASE_IN="${CASE_ENS}"
export CASE_OUT="${CASE}"
export OCNRES_OUT="${OCNRES}"
export LFHR

"${REGRIDSH}"
export err=$?
if [[ ${err} -ne 0 ]]; then
err_exit "Soil increment file was not regridded correctly!"
fi

fi

################################################################################

exit "${err}"

################################################################################
10 changes: 4 additions & 6 deletions dev/scripts/exglobal_enkf_sfc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ if [[ "${DOIAU}" == "YES" ]]; then
mkdir -p "${COMOUT_ATMOS_RESTART_MEM}"
fi
cpreq "${sfcdata_dir}/${bPDY}.${bcyc}0000.${snow_prefix}sfc_data.tile${n}.nc" \
"${DATA}/fnbgsi.${cmem}"
cpreq "${DATA}/fnbgsi.${cmem}" "${DATA}/fnbgso.${cmem}"
"${DATA}/sfc_data_cycle.${cmem}"
cpreq "${FIXgfs}/orog/${CASE}/${CASE}_grid.tile${n}.nc" "${DATA}/fngrid.${cmem}"
cpreq "${FIXgfs}/orog/${CASE}/${CASE}.mx${OCNRES}_oro_data.tile${n}.nc" "${DATA}/fnorog.${cmem}"

Expand Down Expand Up @@ -235,7 +234,7 @@ if [[ "${DOIAU}" == "YES" ]]; then
mkdir -p "${COMOUT_ATMOS_RESTART_MEM}"
fi

cpfs "${DATA}/fnbgso.${cmem}" "${COMOUT_ATMOS_RESTART_MEM}/${bPDY}.${bcyc}0000.sfcanl_data.tile${n}.nc"
cpfs "${DATA}/sfc_data_cycle.${cmem}" "${COMOUT_ATMOS_RESTART_MEM}/${bPDY}.${bcyc}0000.sfcanl_data.tile${n}.nc"

done # ensembles

Expand Down Expand Up @@ -277,8 +276,7 @@ if [[ "${DOSFCANL_ENKF}" == "YES" ]]; then
fi

cpreq "${sfcdata_dir}/${PDY}.${cyc}0000.${snow_prefix}sfc_data.tile${n}.nc" \
"${DATA}/fnbgsi.${cmem}"
cpreq "${DATA}/fnbgsi.${cmem}" "${DATA}/fnbgso.${cmem}"
"${DATA}/sfc_data_cycle.${cmem}"
cpreq "${FIXgfs}/orog/${CASE}/${CASE}_grid.tile${n}.nc" "${DATA}/fngrid.${cmem}"
cpreq "${FIXgfs}/orog/${CASE}/${CASE}.mx${OCNRES}_oro_data.tile${n}.nc" "${DATA}/fnorog.${cmem}"

Expand Down Expand Up @@ -311,7 +309,7 @@ if [[ "${DOSFCANL_ENKF}" == "YES" ]]; then
mkdir -p "${COMOUT_ATMOS_RESTART_MEM}"
fi

cpfs "${DATA}/fnbgso.${cmem}" "${COMOUT_ATMOS_RESTART_MEM}/${PDY}.${cyc}0000.sfcanl_data.tile${n}.nc"
cpfs "${DATA}/sfc_data_cycle.${cmem}" "${COMOUT_ATMOS_RESTART_MEM}/${PDY}.${cyc}0000.sfcanl_data.tile${n}.nc"

done

Expand Down
4 changes: 3 additions & 1 deletion dev/workflow/applications/gfs_cycled.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def get_task_names(self):
if options['do_jediocnvar']:
task_names[run] += ['prepoceanobs', 'marinebmatinit', 'marinebmat', 'marineanlinit', 'marineanlvar', 'marineanlchkpt', 'marineanlfinal']

task_names[run] += ['sfcanl']
task_names[run] += ['sfcanl_gcycle']

if options['do_jedisnowda']:
task_names[run] += ['snowanl']
Expand All @@ -280,6 +280,8 @@ def get_task_names(self):
if options['do_aero_anl']:
task_names[run] += ['aeroanlgenb']

if options['do_gsisoilda']:
task_names[run] += ['sfcanl_regrid']
else:
if options['do_wave']:
task_names[run] += wave_prep_tasks
Expand Down
10 changes: 5 additions & 5 deletions dev/workflow/rocoto/gcafs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ def offlineanl(self):

return task

def sfcanl(self):
def sfcanl_gcycle(self):
"""
Create a task for surface analysis (sfcanl).
Create a task for surface analysis (sfcanl_gcycle).

This task performs the surface analysis step in the workflow, depending on whether JEDI atmospheric variational analysis is enabled.

Expand All @@ -238,13 +238,13 @@ def sfcanl(self):
dependencies = rocoto.create_dependency(dep=deps)

resources = self.get_resource('sfcanl')
task_name = f'{self.run}_sfcanl'
task_name = f'{self.run}_sfcanl_gcycle'
task_dict = {'task_name': task_name,
'resources': resources,
'dependency': dependencies,
'envars': self.envars,
'cycledef': 'gcdas',
'command': f'{self.HOMEgfs}/dev/job_cards/rocoto/sfcanl.sh',
'command': f'{self.HOMEgfs}/dev/job_cards/rocoto/sfcanl_gcycle.sh',
'job_name': f'{self.pslot}_{task_name}_@H',
'log': f'{self.rotdir}/logs/@Y@m@d@H/{task_name}.log',
'maxtries': '&MAXTRIES;'
Expand Down Expand Up @@ -689,7 +689,7 @@ def _fcst_cycled(self):

# Always group sfcanl and aeroanlfinal together with AND
sfcanl_aero_deps = []
dep_dict = {'type': 'task', 'name': f'{anldep}_sfcanl'}
dep_dict = {'type': 'task', 'name': f'{anldep}_sfcanl_gcycle'}
sfcanl_aero_deps.append(rocoto.add_dependency(dep_dict))
if self.options['use_aero_anl']:
dep_dict = {'type': 'task', 'name': f'{anldep}_aeroanlfinal'}
Expand Down
Loading
Loading