Skip to content

Commit

Permalink
simplify aerosol/wave RUN-based options
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuber-NOAA committed Oct 10, 2024
1 parent 71a2c4e commit 731f16e
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 92 deletions.
2 changes: 1 addition & 1 deletion parm/archive/gdas.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ gdas:
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}oznstat"
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}radstat"
{% endif %}
{% if AERO_ANL_RUN == "gdas" or AERO_ANL_RUN == "both" %}
{% if DO_AERO_ANL %}
- "{{ COMIN_CHEM_ANALYSIS | relpath(ROTDIR) }}/{{ head }}aerostat"
{% endif %}
{% if DO_PREP_OBS_AERO %}
Expand Down
2 changes: 1 addition & 1 deletion parm/archive/gfs_arcdir.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
ARCDIR ~ "/snowstat." ~ RUN ~ "." ~ cycle_YMDH ~ ".tgz"]) %}
{% endif %}

{% if AERO_ANL_RUN == RUN or AERO_ANL_RUN == "both" %}
{% if DO_AERO_ANL %}
{% do det_anl_files.append([COMIN_CHEM_ANALYSIS ~ "/" ~ head ~ "aerostat",
ARCDIR ~ "/aerostat." ~ RUN ~ "." ~ cycle_YMDH ]) %}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion parm/archive/gfsa.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ gfsa:
{% else %}
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}gsistat"
{% endif %}
{% if AERO_ANL_RUN == "gfs" or AERO_ANL_RUN == "both" %}
{% if DO_AERO_ANL %}
- "{{ COMIN_CHEM_ANALYSIS | relpath(ROTDIR) }}/{{ head }}aerostat"
{% endif %}
{% if DO_PREP_OBS_AERO %}
Expand Down
2 changes: 1 addition & 1 deletion parm/archive/master_gfs.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ datasets:
{% endfilter %}
{% endif %}

{% if AERO_FCST_RUN == "gfs" or AERO_FCST_RUN == "both" %}
{% if DO_AERO_FCST %}
# Aerosol forecasts
{% filter indent(width=4) %}
{% include "chem.yaml.j2" %}
Expand Down
12 changes: 3 additions & 9 deletions parm/config/gefs/config.base
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ export DO_OCN="NO"
export DO_ICE="NO"
export DO_AERO="NO"
export DO_EXTRACTVARS="@DO_EXTRACTVARS@" # Option to process and extract a subset of products to save on disk
export AERO_FCST_RUN="" # When to run aerosol forecast: gdas, gfs, or both
export AERO_ANL_RUN="" # When to run aerosol analysis: gdas, gfs, or both
export WAVE_RUN="" # When to include wave suite: gdas, gfs, or both
export DO_AERO_FCST="NO"
export DOBNDPNT_WAVE="NO" # The GEFS buoys file does not currently have any boundary points
export DOIBP_WAV="NO" # Option to create point outputs from input boundary points
export FRAC_GRID=".true."
Expand Down Expand Up @@ -183,13 +181,11 @@ case "${APP}" in
;;
ATMA)
export DO_AERO="YES"
export AERO_ANL_RUN="both"
export AERO_FCST_RUN="gdas"
export DO_AERO_FCST="NO"
;;
ATMW)
export DO_COUPLED="YES"
export DO_WAVE="YES"
export WAVE_RUN="both"
;;
NG-GODAS)
export DO_ATM="NO"
Expand All @@ -203,13 +199,11 @@ case "${APP}" in

if [[ "${APP}" =~ A$ ]]; then
export DO_AERO="YES"
export AERO_ANL_RUN="both"
export AERO_FCST_RUN="gdas"
export DO_AERO_FCST="NO"
fi

if [[ "${APP}" =~ ^S2SW ]]; then
export DO_WAVE="YES"
export WAVE_RUN="both"
export cplwav2atm=".true."
fi
;;
Expand Down
13 changes: 3 additions & 10 deletions parm/config/gefs/config.fcst
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@ echo "BEGIN: config.fcst"
export USE_ESMF_THREADING="YES" # Toggle to use ESMF-managed threading or traditional threading in UFSWM
export COPY_FINAL_RESTARTS="NO" # Toggle to copy restarts from the end of GFS/GEFS Run (GDAS is handled seperately)

# Turn off waves if not used for this RUN
case ${WAVE_RUN} in
both | "${RUN/enkf}" ) ;; # Don't change
*) DO_WAVE="NO" ;; # Turn waves off
esac

# Turn off aerosols if not used for this RUN
case ${AERO_FCST_RUN} in
both | "${RUN/enkf}" ) ;; # Don't change
*) DO_AERO="NO" ;; # Turn waves off
esac
if [[ "${DO_AERO_FCST}" == "NO" ]]; then
DO_AERO="NO"
fi

# Source model specific information that is resolution dependent
string="--fv3 ${CASE}"
Expand Down
31 changes: 22 additions & 9 deletions parm/config/gfs/config.base
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export SENDDBN=${SENDDBN:-"NO"}
export DBNROOT=${DBNROOT:-${UTILROOT:-}/fakedbn}

# APP settings; configurable by RUN
# If a component (WAVES, etc) needs to be turned on/off by RUN, set it here
case "${RUN}" in
"gfs")
export APP=@APP@
Expand Down Expand Up @@ -193,9 +194,11 @@ export DO_OCN="NO"
export DO_ICE="NO"
export DO_AERO="NO"
export DO_PREP_OBS_AERO="NO"
export AERO_FCST_RUN="" # When to run aerosol forecast: gdas, gfs, or both
export AERO_ANL_RUN="" # When to run aerosol analysis: gdas, gfs, or both
export WAVE_RUN="" # When to include wave suite: gdas, gfs, or both
aero_fcst_runs="gdas" # When to run aerosol forecast: gdas, gfs, or both
aero_anl_runs="gdas gfs" # When to run aerosol analysis: gdas, gfs, or both
wave_runs="gdas gfs" # When to include wave suite: gdas, gfs, or both
export DO_AERO_FCST="NO"
export DO_AERO_ANL="NO"
export DOBNDPNT_WAVE="NO"
export DOIBP_WAV="NO" # Option to create point outputs from input boundary points
export FRAC_GRID=".true."
Expand Down Expand Up @@ -246,13 +249,10 @@ case "${APP}" in
;;
ATMA)
export DO_AERO="YES"
export AERO_ANL_RUN="both"
export AERO_FCST_RUN="gdas"
;;
ATMW)
export DO_COUPLED="YES"
export DO_WAVE="YES"
export WAVE_RUN="both"
;;
NG-GODAS)
export DO_ATM="NO"
Expand All @@ -266,13 +266,10 @@ case "${APP}" in

if [[ "${APP}" =~ A$ ]]; then
export DO_AERO="YES"
export AERO_ANL_RUN="both"
export AERO_FCST_RUN="gdas"
fi

if [[ "${APP}" =~ ^S2SW ]]; then
export DO_WAVE="YES"
export WAVE_RUN="both"
fi
;;
*)
Expand All @@ -281,6 +278,22 @@ case "${APP}" in
;;
esac

# Aerosol forecasts and analyses may be RUN-dependent
if [[ "${DO_AERO}" == "YES" ]]; then
for aero_run in ${aero_anl_runs}; do
if [[ "${aero_run}" == "${RUN}" ]]; then
export DO_AERO_ANL="YES"
break
fi
done
for aero_run in ${aero_fcst_runs}; do
if [[ "${aero_run}" == "${RUN}" ]]; then
export DO_AERO_FCST="YES"
break
fi
done
fi

# Surface cycle update frequency
if [[ "${RUN}" =~ "gdas" ]] ; then
export FHCYC=1
Expand Down
15 changes: 4 additions & 11 deletions parm/config/gfs/config.fcst
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@ echo "BEGIN: config.fcst"
export USE_ESMF_THREADING="YES" # Toggle to use ESMF-managed threading or traditional threading in UFSWM
export COPY_FINAL_RESTARTS="NO" # Toggle to copy restarts from the end of GFS/GEFS Run (GDAS is handled seperately)

# Turn off waves if not used for this RUN
case ${WAVE_RUN} in
both | "${RUN/enkf}" ) ;; # Don't change
*) DO_WAVE="NO" ;; # Turn waves off
esac

# Turn off aerosols if not used for this RUN
case ${AERO_FCST_RUN} in
both | "${RUN/enkf}" ) ;; # Don't change
*) DO_AERO="NO" ;; # Turn aerosols off
esac
# Turn off aerosols if they are not being forecasted
if [[ "${DO_AERO_FCST}" == "NO" ]]; then
DO_AERO="NO"
fi

# Source model specific information that is resolution dependent
string="--fv3 ${CASE}"
Expand Down
4 changes: 2 additions & 2 deletions scripts/exglobal_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os

from pygfs.task.archive import Archive
from wxflow import AttrDict, Logger, cast_strdict_as_dtypedict, chdir, logit
from wxflow import AttrDict, Logger, cast_strdict_as_dtypedict, logit

# initialize root logger
logger = Logger(level=os.environ.get("LOGGING_LEVEL", "DEBUG"), colored_log=True)
Expand All @@ -29,7 +29,7 @@ def main():
'DOIAU', 'OCNRES', 'ICERES', 'NUM_SND_COLLECTIVES', 'FHOUT_WAV',
'FHOUT_HF_WAV', 'FHMAX_WAV', 'FHMAX_HF_WAV', 'FHMAX_WAV_GFS',
'restart_interval_gdas', 'restart_interval_gfs',
'AERO_ANL_RUN', 'AERO_FCST_RUN', 'DOIBP_WAV', 'DO_JEDIOCNVAR',
'DO_AERO_ANL', 'DO_AERO_FCST', 'DOIBP_WAV', 'DO_JEDIOCNVAR',
'NMEM_ENS', 'DO_JEDIATMVAR', 'DO_VRFY_OCEANDA', 'FHMAX_FITS', 'waveGRD',
'IAUFHRS', 'DO_FIT2OBS', 'NET', 'FHOUT_HF_GFS', 'FHMAX_HF_GFS', 'REPLAY_ICS',
'OFFSET_START_HOUR']
Expand Down
33 changes: 2 additions & 31 deletions workflow/applications/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,44 +98,15 @@ def _get_run_options(self, conf: Configuration) -> Dict[str, Any]:
run_options[run]['do_ice'] = run_base.get('DO_ICE', False)
run_options[run]['do_aero'] = run_base.get('DO_AERO', False)
run_options[run]['do_prep_obs_aero'] = run_base.get('DO_PREP_OBS_AERO', False)
run_options[run]['do_aero_anl'] = run_base.get('DO_AERO_ANL', False)
run_options[run]['do_aero_fcst'] = run_base.get('DO_AERO_FCST', False)

run_options[run]['do_hpssarch'] = run_base.get('HPSSARCH', False)
run_options[run]['fcst_segments'] = run_base.get('FCST_SEGMENTS', None)

if not AppConfig.is_monotonic(run_options[run]['fcst_segments']):
raise ValueError(f'Forecast segments do not increase monotonically: {",".join(self.fcst_segments)}')

wave_runs = []
if run_options[run]['do_wave']:
wave_run = run_base.get('WAVE_RUN', 'BOTH').lower()
if wave_run in ['both']:
wave_runs = ['gfs', 'gdas']
elif wave_run in ['gfs', 'gdas']:
wave_runs = [wave_run]

run_options[run]['wave_runs'] = wave_runs

aero_anl_runs = []
aero_fcst_runs = []
if run_options[run]['do_aero']:
aero_anl_run = run_base.get('AERO_ANL_RUN', 'BOTH').lower()
if aero_anl_run in ['both']:
aero_anl_runs = ['gfs', 'gdas']
elif aero_anl_run in ['gfs', 'gdas']:
aero_anl_runs = [aero_anl_run]

aero_fcst_run = run_base.get('AERO_FCST_RUN', None).lower()
if aero_fcst_run in ['both']:
aero_fcst_runs = ['gfs', 'gdas']
elif aero_fcst_run in ['gfs', 'gdas']:
aero_fcst_runs = [aero_fcst_run]

run_options[run]['do_aero_anl'] = True if run in aero_anl_runs else False
run_options[run]['do_aero_fcst'] = True if run in aero_fcst_runs else False

run_options[run]['aero_anl_runs'] = aero_anl_runs
run_options[run]['aero_fcst_runs'] = aero_fcst_runs

# Append any MODE-specific options
run_options = self._netmode_run_options(run_base, run_options)

Expand Down
10 changes: 5 additions & 5 deletions workflow/applications/gfs_cycled.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,17 @@ def get_task_names(self):
if not options['do_jediatmvar']:
task_names[run] += ['analdiag']

if options['do_wave'] and run in self.wave_runs:
if options['do_wave']:
task_names[run] += wave_prep_tasks

if options['do_aero'] and run in options['aero_anl_runs']:
if options['do_aero_anl']:
task_names[run] += ['aeroanlgenb']

else:
if options['do_wave'] and run in self.wave_runs:
if options['do_wave']:
task_names[run] += wave_prep_tasks

if options['do_aero'] and run in options['aero_anl_runs']:
if options['do_aero_anl']:
task_names[run] += ['aeroanlinit', 'aeroanlvar', 'aeroanlfinal']

if options['do_prep_obs_aero']:
Expand Down Expand Up @@ -257,7 +257,7 @@ def get_task_names(self):
if options['do_metp']:
task_names[run] += ['metp']

if options['do_wave'] and run in options['wave_runs']:
if options['do_wave']:
if options['do_wave_bnd']:
task_names[run] += wave_bndpnt_tasks
task_names[run] += wave_post_tasks
Expand Down
7 changes: 2 additions & 5 deletions workflow/applications/gfs_forecast_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,8 @@ def get_task_names(self):
tasks = ['stage_ic']
options = self.run_options[self.run]

if options['do_aero']:
aero_fcst_run = options['aero_fcst_run']
if self.run in aero_fcst_run or aero_fcst_run == "both":
if not options['exp_warm_start']:
tasks += ['aerosol_init']
if options['do_aero_fcst'] and not options['exp_warm_start']:
tasks += ['aerosol_init']

if options['do_wave']:
tasks += ['waveinit']
Expand Down
10 changes: 4 additions & 6 deletions workflow/rocoto/gfs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,14 +867,12 @@ def _fcst_forecast_only(self):
dep_dict = {'type': 'task', 'name': f'{self.run}stage_ic'}
dependencies.append(rocoto.add_dependency(dep_dict))

if self.options['do_wave'] and self.run in self.options['wave_runs']:
if self.options['do_wave']:
wave_job = 'waveprep' if self.options['app'] in ['ATMW'] else 'waveinit'
dep_dict = {'type': 'task', 'name': f'{self.run}{wave_job}'}
dependencies.append(rocoto.add_dependency(dep_dict))

if self.options['do_aero'] and \
self.run in self.options['aero_fcst_runs'] and \
not self._base['EXP_WARM_START']:
if self.options['do_aero_fcst'] and not self._base['EXP_WARM_START']:
# Calculate offset based on RUN = gfs | gdas
interval = None
if self.run in ['gfs']:
Expand Down Expand Up @@ -935,7 +933,7 @@ def _fcst_cycled(self):
dep_dict = {'type': 'task', 'name': f'{self.run}marineanlfinal'}
dependencies.append(rocoto.add_dependency(dep_dict))

if self.options['do_aero'] and self.run in self.options['aero_anl_runs']:
if self.options['do_aero_anl']:
dep_dict = {'type': 'task', 'name': f'{self.run}aeroanlfinal'}
dependencies.append(rocoto.add_dependency(dep_dict))

Expand All @@ -950,7 +948,7 @@ def _fcst_cycled(self):
dependencies.append(rocoto.add_dependency(dep_dict))
dependencies = rocoto.create_dependency(dep_condition='or', dep=dependencies)

if self.options['do_wave'] and self.run in self.options['wave_runs']:
if self.options['do_wave']:
dep_dict = {'type': 'task', 'name': f'{self.run}waveprep'}
dependencies.append(rocoto.add_dependency(dep_dict))
dependencies = rocoto.create_dependency(dep_condition='and', dep=dependencies)
Expand Down

0 comments on commit 731f16e

Please sign in to comment.