Skip to content

Commit 6f9afff

Browse files
Add some flexibility for ocean/ice output (#2327)
This adds functionality to have ocean/ice output frequency be separate from the atm model. One time was created because there's an assumption in the post that these are the same. This could be further modified to remove this assumption. Refs #1629
1 parent a23b7f2 commit 6f9afff

11 files changed

+47
-30
lines changed

parm/config/gefs/config.base.emc.dyn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,10 @@ export gfs_cyc=@gfs_cyc@ # 0: no GFS cycle, 1: 00Z only, 2: 00Z and 12Z only, 4:
220220
export FHMIN_GFS=0
221221
export FHMIN=${FHMIN_GFS}
222222
export FHMAX_GFS=@FHMAX_GFS@
223-
export FHOUT_GFS=6 # Must be 6 for S2S until #1629 is addressed; 3 for ops
223+
export FHOUT_GFS=6
224224
export FHMAX_HF_GFS=0
225225
export FHOUT_HF_GFS=1
226+
export FHOUT_OCNICE_GFS=6
226227
if (( gfs_cyc != 0 )); then
227228
export STEP_GFS=$(( 24 / gfs_cyc ))
228229
else

parm/config/gefs/config.fcst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export FHMAX=${FHMAX_GFS}
2727
export FHOUT=${FHOUT_GFS}
2828
export FHMAX_HF=${FHMAX_HF_GFS}
2929
export FHOUT_HF=${FHOUT_HF_GFS}
30+
export FHOUT_OCNICE=${FHOUT_OCNICE_GFS}
3031

3132
# Get task specific resources
3233
source "${EXPDIR}/config.resources" fcst

parm/config/gfs/config.base.emc.dyn

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ fi
248248
export FHMIN=0
249249
export FHMAX=9
250250
export FHOUT=3 # Will be changed to 1 in config.base if (DOHYBVAR set to NO and l4densvar set to false)
251+
export FHOUT_OCNICE=3
251252

252253
# Cycle to run EnKF (set to BOTH for both gfs and gdas)
253254
export EUPD_CYC="gdas"
@@ -258,9 +259,10 @@ export gfs_cyc=@gfs_cyc@ # 0: no GFS cycle, 1: 00Z only, 2: 00Z and 12Z only, 4:
258259
# GFS output and frequency
259260
export FHMIN_GFS=0
260261
export FHMAX_GFS=@FHMAX_GFS@
261-
export FHOUT_GFS=6 # Must be 6 for S2S until #1629 is addressed; 3 for ops
262+
export FHOUT_GFS=3 # Must be 6 for S2S until #1629 is addressed; 3 for ops
262263
export FHMAX_HF_GFS=0
263264
export FHOUT_HF_GFS=1
265+
export FHOUT_OCNICE_GFS=6
264266
if (( gfs_cyc != 0 )); then
265267
export STEP_GFS=$(( 24 / gfs_cyc ))
266268
else

parm/config/gfs/config.fcst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ case ${RUN} in
3030
export FHOUT=${FHOUT_GFS}
3131
export FHMAX_HF=${FHMAX_HF_GFS}
3232
export FHOUT_HF=${FHOUT_HF_GFS}
33+
export FHOUT_OCNICE=${FHOUT_OCNICE_GFS}
3334
;;
3435
*gdas)
3536
export FHMAX_HF=0

parm/ufs/fv3/diag_table

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"fv3_history", 0, "hours", 1, "hours", "time"
22
"fv3_history2d", 0, "hours", 1, "hours", "time"
3-
"ocn%4yr%2mo%2dy%2hr", 6, "hours", 1, "hours", "time", 6, "hours", "1901 1 1 0 0 0"
4-
"ocn_daily%4yr%2mo%2dy", 1, "days", 1, "days", "time", 1, "days", "1901 1 1 0 0 0"
3+
"ocn%4yr%2mo%2dy%2hr", @[FHOUT_OCNICE], "hours", 1, "hours", "time", @[FHOUT_OCNICE], "hours", "@[SYEAR] @[SMONTH] @[SDAY] @[CHOUR] 0 0"
4+
"ocn_daily%4yr%2mo%2dy", 1, "days", 1, "days", "time", 1, "days", "@[SYEAR] @[SMONTH] @[SDAY] @[CHOUR] 0 0"
55

66
##############
77
# Ocean fields

ush/forecast_predet.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ CICE_predet(){
229229
# Convert output settings into an explicit list for CICE
230230
# Ignore "not used" warning
231231
# shellcheck disable=SC2034
232-
CICE_OUTPUT_FH=$(seq -s ' ' "${FHMIN}" "${FHOUT}" "${FHMAX}")
232+
CICE_OUTPUT_FH=$(seq -s ' ' "${FHMIN}" "${FHOUT_OCNICE}" "${FHMAX}")
233233

234234
}
235235

@@ -247,7 +247,7 @@ MOM6_predet(){
247247
# Convert output settings into an explicit list for MOM6
248248
# Ignore "not used" warning
249249
# shellcheck disable=SC2034
250-
MOM6_OUTPUT_FH=$(seq -s ' ' "${FHMIN}" "${FHOUT}" "${FHMAX}")
250+
MOM6_OUTPUT_FH=$(seq -s ' ' "${FHMIN}" "${FHOUT_OCNICE}" "${FHMAX}")
251251

252252
}
253253

ush/parsing_namelists_CICE.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ local CICE_RESTART_FILE="cice_model.res"
6262
local CICE_DUMPFREQ="y" # "h","d","m" or "y" for restarts at intervals of "hours", "days", "months" or "years"
6363
local CICE_DUMPFREQ_N=10000 # Set this to a really large value, as cice, mom6 and cmeps restart interval is controlled by ufs.configure
6464
local CICE_DIAGFREQ=6
65-
local CICE_HISTFREQ_N="0, 0, ${FHOUT}, 1, 1"
65+
local CICE_HISTFREQ_N="0, 0, ${FHOUT_OCNICE}, 1, 1"
6666
if [[ "${RUN}" =~ "gdas" ]]; then
6767
local CICE_HIST_AVG=".false., .false., .false., .false., .false." # DA needs instantaneous
6868
else

ush/parsing_namelists_FV3.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
## This script is a direct execution.
1010
#####
1111

12+
# Disable variable not used warnings
13+
# shellcheck disable=SC2034
1214
FV3_namelists(){
1315

1416
# setup the tables
@@ -33,7 +35,15 @@ if [[ -n "${AERO_DIAG_TABLE:-}" ]]; then
3335
cat "${AERO_DIAG_TABLE}"
3436
fi
3537
cat "${DIAG_TABLE_APPEND}"
36-
} >> diag_table
38+
} >> diag_table_template
39+
40+
local template=diag_table_template
41+
local SYEAR=${current_cycle:0:4}
42+
local SMONTH=${current_cycle:4:2}
43+
local SDAY=${current_cycle:6:2}
44+
local CHOUR=${current_cycle:8:2}
45+
source "${HOMEgfs}/ush/atparse.bash"
46+
atparse < "${template}" >> "diag_table"
3747

3848

3949
# copy data table

ush/python/pygfs/task/oceanice_products.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __init__(self, config: Dict[str, Any]) -> None:
6161
# TODO: This is a bit of a hack, but it works for now
6262
# FIXME: find a better way to provide the averaging period
6363
# This will be different for ocean and ice, so when they are made flexible, this will need to be addressed
64-
avg_period = f"{self.config.FORECAST_HOUR-self.config.FHOUT_GFS:03d}-{self.config.FORECAST_HOUR:03d}"
64+
avg_period = f"{self.config.FORECAST_HOUR-self.config.FHOUT_OCNICE_GFS:03d}-{self.config.FORECAST_HOUR:03d}"
6565

6666
localdict = AttrDict(
6767
{'component': self.config.COMPONENT,

workflow/rocoto/gfs_tasks.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -929,19 +929,7 @@ def atmanlprod(self):
929929
@staticmethod
930930
def _get_ufs_postproc_grps(cdump, config, component='atmos'):
931931

932-
# Make a local copy of the config to avoid modifying the original
933-
local_config = config.copy()
934-
935-
# Ocean/Ice components do not have a HF output option like the atmosphere
936-
if component in ['ocean', 'ice']:
937-
local_config['FHMAX_HF_GFS'] = config['FHMAX_GFS']
938-
local_config['FHOUT_HF_GFS'] = config['FHOUT_GFS']
939-
940-
fhrs = Tasks._get_forecast_hours(cdump, local_config)
941-
942-
# ocean/ice components do not have fhr 0 as they are averaged output
943-
if component in ['ocean', 'ice']:
944-
fhrs.remove(0)
932+
fhrs = Tasks._get_forecast_hours(cdump, config, component=component)
945933

946934
nfhrs_per_grp = config.get('NFHRS_PER_GROUP', 1)
947935
ngrps = len(fhrs) // nfhrs_per_grp if len(fhrs) % nfhrs_per_grp == 0 else len(fhrs) // nfhrs_per_grp + 1

workflow/rocoto/tasks.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,37 @@ def _template_to_rocoto_cycstring(self, template: str, subs_dict: dict = {}) ->
120120
rocoto_conversion_dict.get)
121121

122122
@staticmethod
123-
def _get_forecast_hours(cdump, config) -> List[str]:
124-
fhmin = config['FHMIN']
125-
fhmax = config['FHMAX']
126-
fhout = config['FHOUT']
123+
def _get_forecast_hours(cdump, config, component='atmos') -> List[str]:
124+
# Make a local copy of the config to avoid modifying the original
125+
local_config = config.copy()
126+
127+
# Ocean/Ice components do not have a HF output option like the atmosphere
128+
if component in ['ocean', 'ice']:
129+
local_config['FHMAX_HF_GFS'] = config['FHMAX_GFS']
130+
local_config['FHOUT_HF_GFS'] = config['FHOUT_OCNICE_GFS']
131+
local_config['FHOUT_GFS'] = config['FHOUT_OCNICE_GFS']
132+
local_config['FHOUT'] = config['FHOUT_OCNICE']
133+
134+
fhmin = local_config['FHMIN']
135+
fhmax = local_config['FHMAX']
136+
fhout = local_config['FHOUT']
127137

128138
# Get a list of all forecast hours
129139
fhrs = []
130140
if cdump in ['gdas']:
131141
fhrs = list(range(fhmin, fhmax + fhout, fhout))
132142
elif cdump in ['gfs', 'gefs']:
133-
fhmax = config['FHMAX_GFS']
134-
fhout = config['FHOUT_GFS']
135-
fhmax_hf = config['FHMAX_HF_GFS']
136-
fhout_hf = config['FHOUT_HF_GFS']
143+
fhmax = local_config['FHMAX_GFS']
144+
fhout = local_config['FHOUT_GFS']
145+
fhmax_hf = local_config['FHMAX_HF_GFS']
146+
fhout_hf = local_config['FHOUT_HF_GFS']
137147
fhrs_hf = range(fhmin, fhmax_hf + fhout_hf, fhout_hf)
138148
fhrs = list(fhrs_hf) + list(range(fhrs_hf[-1] + fhout, fhmax + fhout, fhout))
139149

150+
# ocean/ice components do not have fhr 0 as they are averaged output
151+
if component in ['ocean', 'ice']:
152+
fhrs.remove(0)
153+
140154
return fhrs
141155

142156
def get_resource(self, task_name):

0 commit comments

Comments
 (0)