Skip to content

Commit

Permalink
Make aerosol output frequency variable
Browse files Browse the repository at this point in the history
The `AERO_HISTORY.rc` file that controls the GOCART output is turned
into a template usint `@[ ]` syntax to allow for variable output
times. A new "parsing" script is created for GOCART that handles
parsing the `AERO_HISTORY.rc` file through `atparse`. Other manip-
ulation of these files is also moved to the new parsing script to be
consistent with other components.

A new variable, `FHOUT_AERO` is introduced to control the output
frequency of the GOCART output. This is initially set to 3 to match
other components (this is a change from the current value of 6).
Since some aerosol fields are also included as part of the atmos
output, it may be desirable to meld this back into `FHOUT` later.
However, the atmos output has two frequencies (`FHOUT_HF` and
`FHOUT`), a feature not supported by other components.

The RUN lists for aero fcst, aero analysis, and waves is simplified
to avoid confusion, since there is no need for them to only be set
if the components are on.

Resolves NOAA-EMC#2072
  • Loading branch information
WalterKolczynski-NOAA committed Oct 9, 2024
1 parent a42c833 commit 11f9a1d
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 50 deletions.
9 changes: 3 additions & 6 deletions parm/config/gefs/config.base
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,8 @@ 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 AERO_FCST_RUN="gefs" # When to run aerosol forecast: gdas, gfs, or both
export WAVE_RUN="gefs" # When to include wave suite: gdas, gfs, or both
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 @@ -203,13 +202,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"
export cplwav2atm=".true."
fi
;;
Expand All @@ -225,6 +221,7 @@ export FHMAX=9
export FHOUT=3 # Will be changed to 1 in config.base if (DOHYBVAR set to NO and l4densvar set to false)
export FHOUT_OCN=3
export FHOUT_ICE=3
export FHOUT_AERO=3

# GFS cycle info
export gfs_cyc=@gfs_cyc@ # 0: no GFS cycle, 1: 00Z only, 2: 00Z and 12Z only, 4: all 4 cycles.
Expand Down
13 changes: 4 additions & 9 deletions parm/config/gfs/config.base
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ 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
export AERO_FCST_RUN="gdas" # When to run aerosol forecast: gdas, gfs, or both
export AERO_ANL_RUN="both" # When to run aerosol analysis: gdas, gfs, or both
export WAVE_RUN="both" # When to include wave suite: gdas, gfs, or both
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 @@ -229,13 +229,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 @@ -249,13 +246,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 @@ -278,6 +272,7 @@ export FHMAX=9
export FHOUT=3 # Will be changed to 1 in config.base if (DOHYBVAR set to NO and l4densvar set to false)
export FHOUT_OCN=3
export FHOUT_ICE=3
export FHOUT_AERO=3

# Cycle to run EnKF (set to BOTH for both gfs and gdas)
export EUPD_CYC="@EUPD_CYC@"
Expand Down
32 changes: 16 additions & 16 deletions parm/ufs/gocart/AERO_HISTORY.rc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PC720x361-DC.LM: 72
inst_du_ss.mode: 'instantaneous',
inst_du_ss.grid_label: PC720x361-DC ,
inst_du_ss.splitField: 1,
inst_du_ss.frequency: 120000 ,
inst_du_ss.frequency: @[inst_du_ss_freq] ,
inst_du_ss.duration: 010000 ,
inst_du_ss.ref_time: 000000 ,
inst_du_ss.nbits: 10,
Expand All @@ -72,7 +72,7 @@ PC720x361-DC.LM: 72
tavg_du_ss.mode: 'time-averaged',
tavg_du_ss.grid_label: PC720x361-DC ,
tavg_du_ss.splitField: 1,
tavg_du_ss.frequency: 120000 ,
tavg_du_ss.frequency: @[tavg_du_ss_freq] ,
tavg_du_ss.duration: 010000 ,
tavg_du_ss.ref_time: 000000 ,
tavg_du_ss.nbits: 10,
Expand All @@ -85,7 +85,7 @@ PC720x361-DC.LM: 72
inst_ca.template: '%y4%m2%d2_%h2%n2z.nc4',
inst_ca.mode: 'instantaneous',
inst_ca.grid_label: PC720x361-DC ,
inst_ca.frequency: 120000 ,
inst_ca.frequency: @[inst_ca_freq] ,
inst_ca.duration: 010000 ,
inst_ca.ref_time: 000000 ,
inst_ca.nbits: 10,
Expand All @@ -100,7 +100,7 @@ PC720x361-DC.LM: 72
inst_ni.template: '%y4%m2%d2_%h2%n2z.nc4',
inst_ni.mode: 'instantaneous',
inst_ni.grid_label: PC720x361-DC ,
inst_ni.frequency: 120000 ,
inst_ni.frequency: @[inst_ni_freq] ,
inst_ni.duration: 010000 ,
inst_ni.ref_time: 000000 ,
inst_ni.nbits: 10,
Expand All @@ -116,7 +116,7 @@ PC720x361-DC.LM: 72
inst_su.template: '%y4%m2%d2_%h2%n2z.nc4',
inst_su.mode: 'instantaneous',
inst_su.grid_label: PC720x361-DC ,
inst_su.frequency: 120000 ,
inst_su.frequency: @[inst_su_freq] ,
inst_su.duration: 010000 ,
inst_su.ref_time: 000000 ,
inst_su.nbits: 10,
Expand All @@ -135,7 +135,7 @@ PC720x361-DC.LM: 72
inst_du_bin.mode: 'instantaneous'
inst_du_bin.grid_label: PC720x361-DC ,
inst_du_bin.splitField: 1,
inst_du_bin.frequency: 010000 ,
inst_du_bin.frequency: @[inst_du_bin_freq] ,
inst_du_bin.duration: 010000 ,
inst_du_bin.ref_time: 000000 ,
inst_du_bin.nbits: 10,
Expand All @@ -152,7 +152,7 @@ PC720x361-DC.LM: 72
tavg_du_bin.mode: 'time-averaged'
tavg_du_bin.grid_label: PC720x361-DC ,
tavg_du_bin.splitField: 1,
tavg_du_bin.frequency: 030000 ,
tavg_du_bin.frequency: @[tavg_du_bin_freq] ,
tavg_du_bin.duration: 010000 ,
tavg_du_bin.ref_time: 000000 ,
tavg_du_bin.nbits: 10,
Expand All @@ -169,7 +169,7 @@ PC720x361-DC.LM: 72
inst_ss_bin.mode: 'instantaneous'
inst_ss_bin.grid_label: PC720x361-DC ,
inst_ss_bin.splitField: 1,
inst_ss_bin.frequency: 060000 ,
inst_ss_bin.frequency: @[inst_ss_bin_freq] ,
inst_ss_bin.duration: 010000 ,
inst_ss_bin.ref_time: 000000 ,
inst_ss_bin.nbits: 10,
Expand All @@ -186,7 +186,7 @@ PC720x361-DC.LM: 72
inst_ca_bin.mode: 'instantaneous'
inst_ca_bin.grid_label: PC720x361-DC ,
inst_ca_bin.splitField: 1,
inst_ca_bin.frequency: 120000 ,
inst_ca_bin.frequency: @[inst_ca_bin_freq] ,
inst_ca_bin.duration: 010000 ,
inst_ca_bin.ref_time: 000000 ,
inst_ca_bin.nbits: 10,
Expand All @@ -208,7 +208,7 @@ PC720x361-DC.LM: 72
inst_ni_bin.mode: 'instantaneous',
inst_ni_bin.grid_label: PC720x361-DC ,
inst_ni_bin.splitField: 1,
inst_ni_bin.frequency: 120000 ,
inst_ni_bin.frequency: @[inst_ni_bin_freq] ,
inst_ni_bin.duration: 010000 ,
inst_ni_bin.ref_time: 000000 ,
inst_ni_bin.nbits: 10,
Expand All @@ -225,7 +225,7 @@ PC720x361-DC.LM: 72
inst_su_bin.mode: 'instantaneous',
inst_su_bin.grid_label: PC720x361-DC ,
inst_su_bin.splitField: 1,
inst_su_bin.frequency: 120000 ,
inst_su_bin.frequency: @[inst_su_bin_freq] ,
inst_su_bin.duration: 010000 ,
inst_su_bin.ref_time: 000000 ,
inst_su_bin.nbits: 10,
Expand All @@ -244,7 +244,7 @@ PC720x361-DC.LM: 72
inst_2d.template: '%y4%m2%d2_%h2%n2z.nc4',
inst_2d.archive: '%c/Y%y4',
inst_2d.mode: 'instantaneous'
inst_2d.frequency: 030000,
inst_2d.frequency: @[inst_2d_freq],
inst_2d.duration: 030000,
inst_2d.ref_time: 000000,
inst_2d.grid_label: PC720x361-DC
Expand Down Expand Up @@ -343,7 +343,7 @@ PC720x361-DC.LM: 72
inst_3d.template: '%y4%m2%d2_%h2%n2z.nc4' ,
inst_3d.archive: '%c/Y%y4' ,
inst_3d.mode: 'instantaneous'
inst_3d.frequency: 060000,
inst_3d.frequency: @[inst_3d_freq],
inst_3d.duration: 010000,
inst_3d.ref_time: 000000,
inst_3d.grid_label: PC720x361-DC
Expand Down Expand Up @@ -381,7 +381,7 @@ PC720x361-DC.LM: 72
inst_aod.template: '%y4%m2%d2_%h2%n2z.nc4' ,
inst_aod.archive: '%c/Y%y4' ,
inst_aod.mode: 'instantaneous'
inst_aod.frequency: 060000,
inst_aod.frequency: @[inst_aod_freq],
inst_aod.duration: 010000,
inst_aod.ref_time: 000000,
inst_aod.grid_label: PC720x361-DC
Expand All @@ -398,7 +398,7 @@ PC720x361-DC.LM: 72
tavg_2d_rad.template: '%y4%m2%d2_%h2%n2z.nc4',
tavg_2d_rad.archive: '%c/Y%y4',
tavg_2d_rad.mode: 'time-averaged',
tavg_2d_rad.frequency: 120000,
tavg_2d_rad.frequency: @[tavg_2d_rad_freq],
tavg_2d_rad.duration: 120000,
tavg_2d_rad.ref_time: 000000,
tavg_2d_rad.grid_label: PC720x361-DC
Expand Down Expand Up @@ -432,7 +432,7 @@ PC720x361-DC.LM: 72
tavg_3d_rad.template: '%y4%m2%d2_%h2%n2z.nc4',
tavg_3d_rad.archive: '%c/Y%y4',
tavg_3d_rad.mode: 'time-averaged',
tavg_3d_rad.frequency: 120000,
tavg_3d_rad.frequency: @[tavg_3d_rad_freq],
tavg_3d_rad.duration: 120000,
tavg_3d_rad.ref_time: 000000,
tavg_3d_rad.grid_label: PC720x361-DC
Expand Down
19 changes: 2 additions & 17 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -682,23 +682,8 @@ GOCART_rc() {
[[ ${status} -ne 0 ]] && exit "${status}"
fi

# copying GOCART configuration files
if [[ -n "${AERO_CONFIG_DIR}" ]]; then
${NCP} "${AERO_CONFIG_DIR}"/*.rc "${DATA}"
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"
# attempt to generate ExtData configuration file if not provided
if [[ ! -f "${DATA}/AERO_ExtData.rc" ]]; then
{ \
echo "PrimaryExports%%" ; \
cat "${AERO_CONFIG_DIR}/ExtData.other" ; \
cat "${AERO_CONFIG_DIR}/ExtData.${AERO_EMIS_FIRE:-none}" ; \
echo "%%" ; \
} > "${DATA}/AERO_ExtData.rc"
status=$?
if (( status != 0 )); then exit "${status}"; fi
fi
fi
source "${USHgfs}/parsing_namelists_GOCART.sh"
GOCART_namelists
}

GOCART_postdet() {
Expand Down
3 changes: 1 addition & 2 deletions ush/forecast_predet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,5 @@ GOCART_predet(){

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

GOCART_OUTPUT_FH=$(seq -s ' ' "${FHMIN}" "6" "${FHMAX}")
# TODO: AERO_HISTORY.rc has hardwired output frequency to 6 hours
GOCART_OUTPUT_FH=$(seq -s ' ' "${FHMIN}" "${FHOUT_AERO}" "${FHMAX}")
}
51 changes: 51 additions & 0 deletions ush/parsing_namelists_GOCART.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#! /usr/bin/env bash

# Disable variable not used warnings
# shellcheck disable=SC2034
GOCART_namelists() {
# copying GOCART configuration files
if [[ -n "${AERO_CONFIG_DIR}" ]]; then

local base_in
local fhout_aero_padded
fhout_aero_padded=$(printf "%02d" "${FHOUT_AERO}")
# Only instantaneous AOD is output right now
local inst_aod_freq="${fhout_aero_padded}0000"

# Other gocart fields not currently used
local inst_du_ss_freq="120000"
local tavg_du_ss_freq="120000"
local inst_ca_freq="120000"
local inst_ni_freq="120000"
local inst_su_freq="120000"
local inst_du_bin_freq="010000"
local tavg_du_bin_freq="030000"
local inst_ss_bin_freq="060000"
local inst_ca_bin_freq="120000"
local inst_ni_bin_freq="120000"
local inst_su_bin_freq="120000"
local inst_2d_freq="030000"
local inst_3d_freq="060000"
local tavg_2d_rad_freq="120000"
local tavg_3d_rad_freq="120000"

for template_in in "${AERO_CONFIG_DIR}/"*.rc; do
base_in="$(basename "${template_in}")"
atparse < "${template_in}" >> "${DATA}/${base_in}"
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"
done

# attempt to generate ExtData configuration file if not provided
if [[ ! -f "${DATA}/AERO_ExtData.rc" ]]; then
{ \
echo "PrimaryExports%%" ; \
cat "${AERO_CONFIG_DIR}/ExtData.other" ; \
cat "${AERO_CONFIG_DIR}/ExtData.${AERO_EMIS_FIRE:-none}" ; \
echo "%%" ; \
} > "${DATA}/AERO_ExtData.rc"
status=$?
if (( status != 0 )); then exit "${status}"; fi
fi
fi
}

0 comments on commit 11f9a1d

Please sign in to comment.