Skip to content

Commit

Permalink
Handle negative, 0-padded integers for math. NOAA-EMC#2185
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuber-NOAA committed Dec 22, 2023
1 parent d125136 commit 0490649
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jobs/rocoto/atmos_products.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ IFS='_' read -ra fhrs <<< "${FHRLST//f}" # strip off the 'f's and convert to arr
#---------------------------------------------------------------
# Execute the JJOB
for fhr in "${fhrs[@]}"; do
export FORECAST_HOUR=$(( 10#${fhr} ))
# The analysis fhr is -001. Performing math on negative, leading 0 integers is tricky.
# The negative needs to be in front of "10#", so do some regex magic to make it happen.
fhr="10#${fhr}"
fhr=$( echo ${fhr} | sed "s/10#-/-10#/" )
export FORECAST_HOUR=$(( ${fhr} ))
"${HOMEgfs}/jobs/JGLOBAL_ATMOS_PRODUCTS"
status=$?
if (( status != 0 )); then exit "${status}"; fi
Expand Down

0 comments on commit 0490649

Please sign in to comment.