From 514588cbead940a8f2ffff168f48530546ee0471 Mon Sep 17 00:00:00 2001 From: "edward.safford" Date: Fri, 28 Oct 2022 13:19:53 +0000 Subject: [PATCH 1/2] Ref #38 Add setting num_cycles via command line. --- .../image_gen/ush/ConMon_IG.sh | 19 +++++++--- src/Conventional_Monitor/parm/ConMon_config | 5 +++ src/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh | 36 ++++++++----------- .../image_gen/ush/plot_summary.sh | 2 +- src/Ozone_Monitor/image_gen/ush/plot_time.sh | 4 +-- src/Ozone_Monitor/parm/OznMon_user_settings | 4 +++ .../image_gen/ush/RadMon_IG_glb.sh | 16 +++++++-- .../image_gen/ush/RadMon_IG_rgn.sh | 19 +++++++--- 8 files changed, 70 insertions(+), 35 deletions(-) diff --git a/src/Conventional_Monitor/image_gen/ush/ConMon_IG.sh b/src/Conventional_Monitor/image_gen/ush/ConMon_IG.sh index 5573d32c..7b1377d5 100755 --- a/src/Conventional_Monitor/image_gen/ush/ConMon_IG.sh +++ b/src/Conventional_Monitor/image_gen/ush/ConMon_IG.sh @@ -15,7 +15,7 @@ function usage { echo " " echo " " - echo "Usage: ConMon_IG.sh suffix [-p|--pdate pdate -r|--run gdas|gfs]" + echo "Usage: ConMon_IG.sh suffix [-p|--pdate pdate -r|--run gdas|gfs -n|--ncyc]" echo " Suffix is the indentifier for this data source." echo " " echo " -p | --pdate yyyymmddcc to specify the cycle to be plotted." @@ -27,6 +27,8 @@ function usage { echo " Use only if data in TANKdir stores both runs, gdas" echo " gdas is the default value." echo " " + echo " -n | --ncyc is the number of cycles to be used in time series plots. If" + echo " not specified the default value in parm/RadMon_user_settins will be used" } @@ -38,17 +40,16 @@ echo "Begin ConMon_IG.sh" nargs=$# -if [[ $nargs -lt 1 || $nargs -gt 5 ]]; then +if [[ $nargs -lt 1 || $nargs -gt 7 ]]; then usage exit 1 fi -set -ax - #----------------------------------------------- # Process command line arguments # export RUN=gdas +num_cycles="" while [[ $# -ge 1 ]] do @@ -64,6 +65,10 @@ do export RUN="$2" shift # past argument ;; + -n|--ncyc) + export num_cycles="$2" + shift # past argument + ;; *) #any unspecified key is CONMON_SUFFIX export CONMON_SUFFIX=$key @@ -80,7 +85,11 @@ echo "CONMON_SUFFIX = $CONMON_SUFFIX" echo "PDATE = $PDATE" echo "RUN = $RUN" -export NUM_CYCLES=${NUM_CYCLES:-121} # number of cycles in plot +if [[ ${#num_cycles} -gt 0 ]]; then + export NUM_CYCLES=${num_cycles} +fi + + export JOBNAME=${JOBNAME:-ConMon_plt_${CONMON_SUFFIX}} export grib2=${grib2:-1} # 1 = grib2 (true), 0 = grib # should this move to config? diff --git a/src/Conventional_Monitor/parm/ConMon_config b/src/Conventional_Monitor/parm/ConMon_config index 120d0a26..629dcc7e 100644 --- a/src/Conventional_Monitor/parm/ConMon_config +++ b/src/Conventional_Monitor/parm/ConMon_config @@ -177,6 +177,11 @@ if [[ $CONMON_CONFIG -ne 1 ]]; then export C_LOGDIR=${C_PTMP_USER}/logs/${CONMON_SUFFIX}/${RUN}/conmon export WORK_conmon=${WORK_conmon:-${C_STMP_USER}/${CONMON_SUFFIX}/${RUN}/ConMon} + # + # NUM_CYCLES is the number of cycles to be used time series plots. + # + export NUM_CYCLES=${NUM_CYCLES:-121} + # # Automatically remove old, extracted data files # diff --git a/src/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh b/src/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh index b1683abf..64ed4266 100755 --- a/src/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh +++ b/src/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh @@ -5,44 +5,28 @@ # # Main plot script for OznMon. # -# Usage: -# -# OznMon_Plt.sh OZNMON_SUFFIX [-p|pdate yyyymmddcc] [-r|run gdas|gfs] -# -# OZNMON_SUFFIX = data source identifier which matches data -# in the TANKverf/stats directory. -# -p|--pdate = specified cycle to plot. If not specified the -# last available date will be plotted. -# -r|--run = $RUN value, gdas|gfs, default is gdas. -# -c1|--comp1 = define first instrument/sat source to plot as comparison -# (applies to time series plots only) -# -c2|--comp2 = define second instrument/sat source to plot as comparison -# (applies to time series plots only) -# -# NOTE: Both COMP1 and COMP2 have to be defined to -# generate comparison plots as part of the COMP1 -# source's time plots. #----------------------------------------------------------------------- function usage { echo " " - echo "Usage: OznMon_Plt.sh OZNMON_SUFFIX " + echo "Usage: OznMon_Plt.sh OZNMON_SUFFIX [-p|--pdate -r|--run -n|--ncyc -c1|--comp1 -c2|--comp2] " echo " OZNMON_SUFFIX is data source identifier which matches data in " echo " the $TANKverf/stats directory." echo " -p | --pdate yyyymmddcc to specify the cycle to be plotted." echo " If unspecified the last available date will be plotted." echo " -r | --run the gdas|gfs run to be plotted, gdas is default" + echo " -n | --ncyc is the number of cycles to be used in time series plots. If" + echo " not specified the default value in parm/RadMon_user_settins will be used" echo " -c1| --comp1 first instrument/sat source to plotted as a comparision" echo " -c2| --comp2 first instrument/sat source to plotted as a comparision" echo " " } echo start OznMon_Plt.sh -set -ax nargs=$# echo nargs = $nargs - +num_cycles="" while [[ $# -ge 1 ]] do @@ -58,6 +42,10 @@ do export RUN="$2" shift # past argument ;; + -n|--ncyc) + export num_cycles="$2" + shift # past argument + ;; -c1|--comp1) export COMP1="$2" shift # past argument @@ -75,7 +63,9 @@ do shift done -if [[ $nargs -lt 0 || $nargs -gt 9 ]]; then +echo "num_cycles = $num_cycles" + +if [[ $nargs -lt 0 || $nargs -gt 11 ]]; then usage exit 1 fi @@ -94,6 +84,10 @@ if [[ ${#RUN} -le 0 ]]; then export RUN=gdas fi +if [[ ${#num_cycles} -gt 0 ]]; then + export NUM_CYCLES=${num_cycles} +fi + echo "OZNMON_SUFFIX = $OZNMON_SUFFIX" echo "pdate = $pdate" echo "RUN = $RUN" diff --git a/src/Ozone_Monitor/image_gen/ush/plot_summary.sh b/src/Ozone_Monitor/image_gen/ush/plot_summary.sh index 2ad2e6a3..d865f243 100755 --- a/src/Ozone_Monitor/image_gen/ush/plot_summary.sh +++ b/src/Ozone_Monitor/image_gen/ush/plot_summary.sh @@ -71,7 +71,7 @@ done # if [[ -e ${SATYPE}.${ptype}.ctl ]]; then bdate=`$NDATE -720 $PDATE` - ${OZN_IG_SCRIPTS}/update_ctl_tdef.sh ${SATYPE}.${ptype}.ctl ${bdate} 121 + ${OZN_IG_SCRIPTS}/update_ctl_tdef.sh ${SATYPE}.${ptype}.ctl ${bdate} ${NUM_CYCLES} fi cat << EOF > ${SATYPE}.gs diff --git a/src/Ozone_Monitor/image_gen/ush/plot_time.sh b/src/Ozone_Monitor/image_gen/ush/plot_time.sh index 518837f2..f54548e9 100755 --- a/src/Ozone_Monitor/image_gen/ush/plot_time.sh +++ b/src/Ozone_Monitor/image_gen/ush/plot_time.sh @@ -100,10 +100,10 @@ done # if [[ -e ${SATYPE}.${dsrc}.ctl ]]; then edate=`$NDATE -720 $PDATE` - ${OZN_IG_SCRIPTS}/update_ctl_tdef.sh ${SATYPE}.${dsrc}.ctl ${edate} 121 + ${OZN_IG_SCRIPTS}/update_ctl_tdef.sh ${SATYPE}.${dsrc}.ctl ${edate} ${NUM_CYCLES} if [[ $ADD_COMP -eq 1 ]]; then - ${OZN_IG_SCRIPTS}/update_ctl_tdef.sh ${COMP2}.${dsrc}.ctl ${edate} 121 + ${OZN_IG_SCRIPTS}/update_ctl_tdef.sh ${COMP2}.${dsrc}.ctl ${edate} ${NUM_CYCLES} fi fi diff --git a/src/Ozone_Monitor/parm/OznMon_user_settings b/src/Ozone_Monitor/parm/OznMon_user_settings index 9c75a863..08a6b8ec 100644 --- a/src/Ozone_Monitor/parm/OznMon_user_settings +++ b/src/Ozone_Monitor/parm/OznMon_user_settings @@ -123,6 +123,10 @@ export REGIONAL_RR=${REGIONAL_RR:-0} # export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} +# +# NUM_CYCLES is the number of cycles to be used time series plots. +# +export NUM_CYCLES=${NUM_CYCLES:-121} # # CLEAN_TANKDIR controls automatic removal of old data files in diff --git a/src/Radiance_Monitor/image_gen/ush/RadMon_IG_glb.sh b/src/Radiance_Monitor/image_gen/ush/RadMon_IG_glb.sh index fe9b1331..bf53ac97 100755 --- a/src/Radiance_Monitor/image_gen/ush/RadMon_IG_glb.sh +++ b/src/Radiance_Monitor/image_gen/ush/RadMon_IG_glb.sh @@ -13,7 +13,7 @@ # usage #-------------------------------------------------------------------- function usage { - echo "Usage: RadMon_IG_glb.sh suffix [-p|--pdate -r|--run ]" + echo "Usage: RadMon_IG_glb.sh suffix [-p|--pdate -r|--run -n|--ncyc]" echo "" echo " suffix is the indentifier for this data source." echo " This is usually the same as the NET value." @@ -23,6 +23,9 @@ function usage { echo "" echo " -r|--run is gdas|gfs. gdas is the default if not specified." echo "" + echo " -n|--ncyc is the number of cycles to be used in time series plots. If" + echo " not specified the default value in parm/RadMon_user_settins will be used" + echo "" } echo start RadMon_IG_glb.sh @@ -34,7 +37,7 @@ echo exit_value=0 nargs=$# -if [[ $nargs -lt 1 || $nargs -gt 5 ]]; then +if [[ $nargs -lt 1 || $nargs -gt 7 ]]; then usage exit 1 fi @@ -44,6 +47,7 @@ fi # run=gdas pdate="" +num_cycles="" while [[ $# -ge 1 ]] do @@ -58,6 +62,10 @@ do run="$2" shift # past argument ;; + -n|--ncyc) + num_cycles="$2" + shift # past argument + ;; *) #any unspecified key is RADMON_SUFFIX export RADMON_SUFFIX=$key @@ -72,7 +80,11 @@ export RUN=${run} echo "RADMON_SUFFIX = ${RADMON_SUFFIX}" echo "RUN = ${RUN}" echo "pdate = ${pdate}" +echo "num_cycles = ${num_cycles}" +if [[ ${#num_cycles} -gt 0 ]]; then + export NUM_CYCLES=${num_cycles} +fi #-------------------------------------------------------------------- # Run config files to load environment variables, diff --git a/src/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh b/src/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh index 1fa3e272..b85baf2d 100755 --- a/src/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh +++ b/src/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh @@ -11,7 +11,7 @@ # usage #-------------------------------------------------------------------- function usage { - echo "Usage: RadMon_IG_rgn.sh suffix [-p|--pdate -r|--run ]" + echo "Usage: RadMon_IG_rgn.sh suffix [-p|--pdate -r|--run -n|--ncyc]" echo "" echo " suffix is the indentifier for this data source." echo " This is usually the same as the NET value." @@ -21,6 +21,9 @@ function usage { echo "" echo " -r|--run nam is the default if not specified." echo "" + echo " -n|--ncyc is the number of cycles to be used in time series plots. If" + echo " not specified the default value in parm/RadMon_user_settins will be used" + echo "" } @@ -28,7 +31,7 @@ echo start RadMon_IG_rgn.sh nargs=$# -if [[ $nargs -lt 1 || $nargs -gt 5 ]]; then +if [[ $nargs -lt 1 || $nargs -gt 7 ]]; then usage exit 1 fi @@ -37,6 +40,8 @@ fi # Process command line arguments. # run=nam +pdate="" +num_cycles="" while [[ $# -ge 1 ]] do @@ -51,6 +56,10 @@ do run="$2" shift # past argument ;; + -n|--ncyc) + num_cycles="$2" + shift # past argument + ;; *) #any unspecified key is RADMON_SUFFIX export RADMON_SUFFIX=$key @@ -65,9 +74,11 @@ export RUN=${run} echo "RADMON_SUFFIX = ${RADMON_SUFFIX}" echo "RUN = ${RUN}" echo "pdate = ${pdate}" +echo "num_cycles = ${num_cycles}" - -set -ax +if [[ ${#num_cycles} -gt 0 ]]; then + export NUM_CYCLES=${num_cycles} +fi #-------------------------------------------------------------------- # Set environment variables From 2e5372e572a58e377ceadcb935623a85cbd129ae Mon Sep 17 00:00:00 2001 From: "edward.safford" Date: Mon, 31 Oct 2022 13:42:27 +0000 Subject: [PATCH 2/2] Ref #38 OznMon changes for NUM_CYCLES. --- src/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh | 10 +++++----- src/Ozone_Monitor/image_gen/ush/plot_summary.sh | 4 ++-- src/Ozone_Monitor/image_gen/ush/plot_time.sh | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh b/src/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh index 669f14ac..795ab095 100755 --- a/src/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh +++ b/src/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh @@ -29,8 +29,10 @@ echo start OznMon_Plt.sh nargs=$# echo nargs = $nargs + num_cycles="" tank="" +pdate="" while [[ $# -ge 1 ]] do @@ -46,7 +48,9 @@ do shift # past argument ;; -n|--ncyc) - export num_cycles="$2" + num_cycles="$2" + shift # past argument + ;; -t|--tank) tank="$2" shift # past argument @@ -68,8 +72,6 @@ do shift done -echo "num_cycles = $num_cycles" - if [[ $nargs -lt 0 || $nargs -gt 13 ]]; then usage exit 1 @@ -153,7 +155,6 @@ else fi fi export OZN_TANKDIR=${ozn_tankdir} -echo "OZN_TANKDIR = $OZN_TANKDIR" #-------------------------------------------------------------------- # Set up OZN_TANKDIR_IMGS @@ -199,7 +200,6 @@ if [[ ${#pdate} -le 0 ]]; then fi fi - #------------------------------------ # Confirm there is data for $pdate # diff --git a/src/Ozone_Monitor/image_gen/ush/plot_summary.sh b/src/Ozone_Monitor/image_gen/ush/plot_summary.sh index 82b0162a..879265ee 100755 --- a/src/Ozone_Monitor/image_gen/ush/plot_summary.sh +++ b/src/Ozone_Monitor/image_gen/ush/plot_summary.sh @@ -60,9 +60,9 @@ $UNCOMPRESS *.gz # cycle will be the cycle specified by $PDATE. # if [[ -e ${SATYPE}.${ptype}.ctl ]]; then - bdate=`$NDATE -720 $PDATE` + ((cyc=${NUM_CYCLES}-1, hrs=cyc*${CYCLE_INTERVAL})) + bdate=`${NDATE} -${hrs} ${PDATE}` ${OZN_IG_SCRIPTS}/update_ctl_tdef.sh ${SATYPE}.${ptype}.ctl ${bdate} ${NUM_CYCLES} -fi cat << EOF > ${SATYPE}.gs 'open ${SATYPE}.${ptype}.ctl' diff --git a/src/Ozone_Monitor/image_gen/ush/plot_time.sh b/src/Ozone_Monitor/image_gen/ush/plot_time.sh index c56f826d..1a8ba8cd 100755 --- a/src/Ozone_Monitor/image_gen/ush/plot_time.sh +++ b/src/Ozone_Monitor/image_gen/ush/plot_time.sh @@ -84,7 +84,8 @@ done # Modify tdef line in .ctl file to start at bdate. # if [[ -e ${SATYPE}.${dsrc}.ctl ]]; then - edate=`$NDATE -720 $PDATE` + ((cyc=${NUM_CYCLES}-1, hrs=cyc*${CYCLE_INTERVAL})) + edate=`${NDATE} -${hrs} ${PDATE}` ${OZN_IG_SCRIPTS}/update_ctl_tdef.sh ${SATYPE}.${dsrc}.ctl ${edate} ${NUM_CYCLES} if [[ $ADD_COMP -eq 1 ]]; then