From 96b9b5f18aa1cd53647f096fa0c1a066db923b56 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Tue, 9 Aug 2022 00:40:02 +0000 Subject: [PATCH] Fix post comparison with zero-padded numbers An error was introduced with PR #929 that was causing 0p50 and 1p00 grib files to not be produced due to an error in comparing a zero-padded string. Switching to arithmatic comparison solves the issue. Also updated the method of the zero-padding to the preferred printf since the code was in close proximity. --- ush/fv3gfs_downstream_nems.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ush/fv3gfs_downstream_nems.sh b/ush/fv3gfs_downstream_nems.sh index a1257ec4af..4ef17a9785 100755 --- a/ush/fv3gfs_downstream_nems.sh +++ b/ush/fv3gfs_downstream_nems.sh @@ -77,10 +77,8 @@ elif [ $FH -eq 0 ] ; then else export paramlist=${paramlist:-$PARMpost/global_1x1_paramlist_g2} export paramlistb=${paramlistb:-$PARMpost/global_master-catchup_parmlist_g2} - export fhr3=$(expr $FH + 0 ) - if [ $fhr3 -lt 100 ]; then export fhr3="0$fhr3"; fi - if [ $fhr3 -lt 10 ]; then export fhr3="0$fhr3"; fi - if [ $fhr3%${FHOUT_PGB} -eq 0 ]; then + export fhr3=$(printf "%03d" ${FH}) + if (( fhr3%FHOUT_PGB == 0 )); then export PGBS=YES fi fi