Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow NUM_CYCLES to be optionally set by command line argument. #39

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/Conventional_Monitor/image_gen/ush/ConMon_IG.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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"
}


Expand All @@ -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
Expand All @@ -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
Expand All @@ -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?
Expand Down
5 changes: 5 additions & 0 deletions src/Conventional_Monitor/parm/ConMon_config
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
47 changes: 14 additions & 33 deletions src/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,18 @@
#
# 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 OZN_TANKDIR 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.
#
# -t|--tank = parent directory to the oznmon data file location. This will be extended by
# $OZNMON_SUFFIX, $RUN, and $PDATE to locate the extracted oznmon data.
# Three data directory formats will be tried:
# ops = ${tankdir}/${net}/${version}/${run}.${pdy}/${hh}/atmos/${monitor}
# dev = ${tankdir}/${monitor}/stats/${net}/${run}.${pdy}/${hh}
# mon = ${tankdir}/stats/${net}/${run}.${pdy}/${hh}/${monitor}
#
# If --tank is not specified then it defaults to OZN_TANKDIR (defined in
# parm/OznMon_config).
#
# -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 $OZN_TANKDIR 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 " -t | --tank parent directory to the oznmon data file location. This"
echo " will be extended by $OZNMON_SUFFIX, $RUN, and $PDATE to locate the"
echo " extracted oznmon data."
Expand All @@ -53,11 +27,12 @@ function usage {

echo start OznMon_Plt.sh


nargs=$#
echo nargs = $nargs

num_cycles=""
tank=""
pdate=""

while [[ $# -ge 1 ]]
do
Expand All @@ -72,6 +47,10 @@ do
export RUN="$2"
shift # past argument
;;
-n|--ncyc)
num_cycles="$2"
shift # past argument
;;
-t|--tank)
tank="$2"
shift # past argument
Expand All @@ -93,7 +72,7 @@ do
shift
done

if [[ $nargs -lt 0 || $nargs -gt 9 ]]; then
if [[ $nargs -lt 0 || $nargs -gt 13 ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be 11?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, 13 is right. The previous value of 9 was wrong and should have been 11. The options include run, pdate, ncyc, and tank, plus are 2 older, unique options for comparison plotting (comp1, comp2). So total of 12 + suffix is possible.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okie dokie. Thanks!

usage
exit 1
fi
Expand All @@ -112,6 +91,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"
Expand Down Expand Up @@ -172,7 +155,6 @@ else
fi
fi
export OZN_TANKDIR=${ozn_tankdir}
echo "OZN_TANKDIR = $OZN_TANKDIR"

#--------------------------------------------------------------------
# Set up OZN_TANKDIR_IMGS
Expand Down Expand Up @@ -218,7 +200,6 @@ if [[ ${#pdate} -le 0 ]]; then
fi
fi


#------------------------------------
# Confirm there is data for $pdate
#
Expand Down
5 changes: 3 additions & 2 deletions src/Ozone_Monitor/image_gen/ush/plot_summary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ $UNCOMPRESS *.gz
# cycle will be the cycle specified by $PDATE.
#
if [[ -e ${SATYPE}.${ptype}.ctl ]]; then
bdate=`$NDATE -720 $PDATE`
${OZN_IG_SCRIPTS}/update_ctl_tdef.sh ${SATYPE}.${ptype}.ctl ${bdate} 121
((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}

cat << EOF > ${SATYPE}.gs
'open ${SATYPE}.${ptype}.ctl'
Expand Down
7 changes: 4 additions & 3 deletions src/Ozone_Monitor/image_gen/ush/plot_time.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ done
# Modify tdef line in .ctl file to start at bdate.
#
if [[ -e ${SATYPE}.${dsrc}.ctl ]]; then
edate=`$NDATE -720 $PDATE`
${OZN_IG_SCRIPTS}/update_ctl_tdef.sh ${SATYPE}.${dsrc}.ctl ${edate} 121
((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
${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


Expand Down
4 changes: 4 additions & 0 deletions src/Ozone_Monitor/parm/OznMon_user_settings
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,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
Expand Down
16 changes: 14 additions & 2 deletions src/Radiance_Monitor/image_gen/ush/RadMon_IG_glb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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
Expand All @@ -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
Expand All @@ -44,6 +47,7 @@ fi
#
run=gdas
pdate=""
num_cycles=""

while [[ $# -ge 1 ]]
do
Expand All @@ -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
Expand All @@ -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,
Expand Down
19 changes: 15 additions & 4 deletions src/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -21,14 +21,17 @@ 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 ""
}


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
Expand All @@ -37,6 +40,8 @@ fi
# Process command line arguments.
#
run=nam
pdate=""
num_cycles=""

while [[ $# -ge 1 ]]
do
Expand All @@ -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
Expand All @@ -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
Expand Down