Skip to content

Commit

Permalink
Make GOCART output times a function
Browse files Browse the repository at this point in the history
Makes GOCART output times a function since it is needed in two places.
  • Loading branch information
WalterKolczynski-NOAA committed Nov 14, 2024
1 parent d8d8412 commit 13ec408
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ GOCART_postdet() {
echo "SUB ${FUNCNAME[0]}: Linking output data for GOCART"

local vdate
for fhr in ${GOCART_OUTPUT_FH}; do
for fhr in $(GOCART_output_fh); do
vdate=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${fhr} hours" +%Y%m%d%H)

# Temporarily delete existing files due to noclobber in GOCART
Expand All @@ -711,19 +711,25 @@ GOCART_postdet() {
done
}

GOCART_output_fh() {
# This has to be called during postdet after FHROT has been set
local aero_min
local gocart_output_fh
aero_min=$(( ${IAU_FHROT:-0} > FHMIN ? IAU_FHROT + FHOUT_AERO : FHMIN + FHOUT_AERO ))
gocart_output_fh=$(seq -s ' ' "$(( aero_min ))" "${FHOUT_AERO}" "${FHMAX}")

echo "${gocart_output_fh}"
}

GOCART_out() {
echo "SUB ${FUNCNAME[0]}: Copying output data for GOCART"

# Copy gocart.inst_aod after the forecast is run (and successfull)
# TODO: this should be linked but there are issues where gocart crashing if it is linked
local fhr
local vdate
local aero_min
local gocart_output_fh
aero_min=$(( ${IAU_FHROT:-0} > FHMIN ? IAU_FHROT + FHOUT_AERO : FHMIN + FHOUT_AERO ))
gocart_output_fh=$(seq -s ' ' "$(( aero_min ))" "${FHOUT_AERO}" "${FHMAX}")

for fhr in ${gocart_output_fh}; do
for fhr in $(GOCART_output_fh); do
vdate=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${fhr} hours" +%Y%m%d%H)
${NCP} "${DATA}/gocart.inst_aod.${vdate:0:8}_${vdate:8:2}00z.nc4" \
"${COMOUT_CHEM_HISTORY}/gocart.inst_aod.${vdate:0:8}_${vdate:8:2}00z.nc4"
Expand Down

0 comments on commit 13ec408

Please sign in to comment.