From 5820bd3011b2cd69f6db3d7749d0f752438ea155 Mon Sep 17 00:00:00 2001 From: "Edward.Safford" Date: Wed, 14 Dec 2022 21:34:11 +0000 Subject: [PATCH] Ref #28 wcoss2 plot updates. --- .../data_extract/ush/ConMon_DE.sh | 5 +- .../image_gen/gscripts/colorbar.gs | 12 +- .../image_gen/gscripts/page.gs | 1 - .../image_gen/gscripts/plot_hist.gs | 2 - .../image_gen/ush/ConMon_IG.sh | 19 +- .../image_gen/ush/Transfer.sh | 31 +- .../image_gen/ush/grib2ctl.pl | 1458 ----------------- .../image_gen/ush/make_tdef.sh | 2 +- .../image_gen/ush/mk_horz_hist.sh | 60 +- .../image_gen/ush/mk_time_vert.sh | 80 +- .../image_gen/ush/plot_hist.sh | 64 +- .../image_gen/ush/plot_horz.sh | 52 +- .../image_gen/ush/plot_horz_uv.sh | 68 +- .../image_gen/ush/plot_time.sh | 43 +- .../image_gen/ush/plot_time_ps.sh | 36 +- .../image_gen/ush/plot_vert.sh | 47 +- .../image_gen/ush/read_scatter.sh | 24 +- .../image_gen/ush/transfer_imgs.sh | 6 +- src/Conventional_Monitor/parm/ConMon_config | 38 +- ush/find_last_cycle.sh | 3 + 20 files changed, 245 insertions(+), 1806 deletions(-) delete mode 100755 src/Conventional_Monitor/image_gen/ush/grib2ctl.pl diff --git a/src/Conventional_Monitor/data_extract/ush/ConMon_DE.sh b/src/Conventional_Monitor/data_extract/ush/ConMon_DE.sh index df1a0b64..46e56e11 100755 --- a/src/Conventional_Monitor/data_extract/ush/ConMon_DE.sh +++ b/src/Conventional_Monitor/data_extract/ush/ConMon_DE.sh @@ -81,7 +81,7 @@ this_file=`basename $0` this_dir=`dirname $0` -gfs_ver=v16.2 +gfs_ver=v16.3 echo CONMON_SUFFIX = $CONMON_SUFFIX export NET=${CONMON_SUFFIX} @@ -129,7 +129,7 @@ else GDATE=`$NDATE -06 $PDATE` fi -echo GDATE = $GDATE +echo GDATE, PDATE = $GDATE, $PDATE export PDY=`echo $PDATE|cut -c1-8` export CYC=`echo $PDATE|cut -c9-10` @@ -192,7 +192,6 @@ echo "cnvstat = $cnvstat" echo "pgrbf00 = $pgrbf00" echo "pgrbf06 = $pgrbf06" -exit #--------------------------------------------- # override the default convinfo definition diff --git a/src/Conventional_Monitor/image_gen/gscripts/colorbar.gs b/src/Conventional_Monitor/image_gen/gscripts/colorbar.gs index 1291728d..338e9f92 100644 --- a/src/Conventional_Monitor/image_gen/gscripts/colorbar.gs +++ b/src/Conventional_Monitor/image_gen/gscripts/colorbar.gs @@ -13,10 +13,9 @@ function colorbar (args) * * Check shading information * - say '--> colorbar.gs' + 'query shades' shdinfo = result - say 'shdinfo = 'shdinfo if (subwrd(shdinfo,1)='None') say 'Cannot plot color bar: No shading information' @@ -74,14 +73,10 @@ function colorbar (args) * 'set strsiz 0.12 0.13' num = 0 - say 'cnum = 'cnum while (num= 1 & nx <= 9 & ny >= 1 & ny <= 9) y0 = ylo + (yhi - ylo) * (iy - 1) / ny y1 = ylo + (yhi - ylo) * (iy ) / ny 'set vpage ' x0 ' ' x1 ' ' y0 ' ' y1 - say 'set vpage ' x0 ' ' x1 ' ' y0 ' ' y1 endif 'set grads off' diff --git a/src/Conventional_Monitor/image_gen/gscripts/plot_hist.gs b/src/Conventional_Monitor/image_gen/gscripts/plot_hist.gs index 273246eb..d2a91e08 100755 --- a/src/Conventional_Monitor/image_gen/gscripts/plot_hist.gs +++ b/src/Conventional_Monitor/image_gen/gscripts/plot_hist.gs @@ -28,8 +28,6 @@ debug=0 lin1=sublin(result,1) dtype=subwrd(lin1,4) cycle=subwrd(lin1,5) -say 'dtype=' dtype -say 'cycle='cycle histplot(dtype,cycle,plotfile,xsize,ysize,cdate) if (debug = 1) say 'hit enter to continue' diff --git a/src/Conventional_Monitor/image_gen/ush/ConMon_IG.sh b/src/Conventional_Monitor/image_gen/ush/ConMon_IG.sh index 7b1377d5..f36a790d 100755 --- a/src/Conventional_Monitor/image_gen/ush/ConMon_IG.sh +++ b/src/Conventional_Monitor/image_gen/ush/ConMon_IG.sh @@ -16,16 +16,17 @@ function usage { echo " " echo " " echo "Usage: ConMon_IG.sh suffix [-p|--pdate pdate -r|--run gdas|gfs -n|--ncyc]" + echo " " echo " Suffix is the indentifier for this data source." echo " " echo " -p | --pdate yyyymmddcc to specify the cycle to be plotted." - echo " If unspecified pdate will be set using the " + echo " If not specified pdate will be set using the " echo " C_IMGNDIR/last_plot_time file, and if that doesn't" echo " exist, then the last available date will be plotted." echo " " echo " -r | --run the gdas|gfs run to be processed." - echo " Use only if data in TANKdir stores both runs, gdas" - echo " gdas is the default value." + echo " Use only if data in TANKdir stores both runs." + echo " Default value is gdas" 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" @@ -50,6 +51,7 @@ fi # export RUN=gdas num_cycles="" +PDATE="" while [[ $# -ge 1 ]] do @@ -66,7 +68,7 @@ do shift # past argument ;; -n|--ncyc) - export num_cycles="$2" + num_cycles="$2" shift # past argument ;; *) @@ -90,9 +92,7 @@ if [[ ${#num_cycles} -gt 0 ]]; then fi -export JOBNAME=${JOBNAME:-ConMon_plt_${CONMON_SUFFIX}} -export grib2=${grib2:-1} # 1 = grib2 (true), 0 = grib - # should this move to config? +export JOBNAME=${JOBNAME:-CM_IG_${CONMON_SUFFIX}} #-------------------------------------------------------------------- # Run config files to load environment variables, @@ -157,9 +157,7 @@ fi # Set the START_DATE for the plot #-------------------------------------------------------------------- ncycles=`expr $NUM_CYCLES - 1` - hrs=`expr $ncycles \\* -6` -echo "hrs = $hrs" export START_DATE=`$NDATE ${hrs} $PDATE` echo "START_DATE, last_cycle, PDATE = $START_DATE $last_cycle $PDATE" @@ -184,7 +182,7 @@ if [[ $PDATE -le ${last_cycle} ]]; then cd $C_PLOT_WORKDIR #-------------------------------------------------------------------- - # Run the two setup scripts + # Run the two plot setup scripts #-------------------------------------------------------------------- ${C_IG_SCRIPTS}/mk_horz_hist.sh @@ -193,6 +191,7 @@ if [[ $PDATE -le ${last_cycle} ]]; then #-------------------------------------------------------------------- # Update the last_plot_time file if found #-------------------------------------------------------------------- + echo C_IMGNDIR = $C_IMGNDIR if [[ -e ${C_IMGNDIR}/last_plot_time ]]; then echo "update last_plot_time file" echo ${PDATE} > ${C_IMGNDIR}/last_plot_time diff --git a/src/Conventional_Monitor/image_gen/ush/Transfer.sh b/src/Conventional_Monitor/image_gen/ush/Transfer.sh index 53079bd7..2ed5b4cb 100755 --- a/src/Conventional_Monitor/image_gen/ush/Transfer.sh +++ b/src/Conventional_Monitor/image_gen/ush/Transfer.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash #-------------------------------------------------------------------- # usage @@ -12,11 +12,6 @@ function usage { echo " " } - -set -ax -mybin=`ls ~/bin` -echo "test: $mybin" - nargs=$# if [[ $nargs -lt 1 || $nargs -gt 3 ]]; then usage @@ -48,7 +43,6 @@ do done -CMON_SUFFIX=$CONMON_SUFFIX this_file=`basename $0` this_dir=`dirname $0` @@ -64,12 +58,20 @@ else fi -logfile=${C_LOGDIR}/transfer_${CMON_SUFFIX}.log +logfile=${C_LOGDIR}/transfer_${CONMON_SUFFIX}.log +if [[ -e ${logfile} ]]; then + rm ${logfile} +fi + +errfile=${C_LOGDIR}/transfer_${CONMON_SUFFIX}.err +if [[ -e ${errfile} ]]; then + rm ${errfile} +fi export JOB_QUEUE=dev_transfer -WEBDIR=${WEBDIR}/${CMON_SUFFIX}/${RUN} +WEBDIR=${WEBDIR}/${CONMON_SUFFIX}/${RUN} -export jobname=transfer_${CMON_SUFFIX}_conmon +export jobname=transfer_${CONMON_SUFFIX}_conmon #-------------------------------------------------------- # Note that transfers from hera are not straightforward, @@ -78,13 +80,16 @@ export jobname=transfer_${CMON_SUFFIX}_conmon # and leave it to the user to manually transfer files to # the server. # -if [[ $MY_MACHINE == "wcoss_d" || $MY_MACHINE == "wcoss_c" ]]; then - $SUB -P $PROJECT -q $JOB_QUEUE -o ${logfile} -M 80 -W 1:30 \ - -R affinity[core] -J ${jobname} -cwd ${PWD} \ +if [[ $MY_MACHINE = "wcoss2" ]]; then + + $SUB -q $JOB_QUEUE -A $ACCOUNT -o ${logfile} -e ${errfile} \ + -V -l select=1:mem=500M -l walltime=45:00 -N ${jobname} \ ${C_IG_SCRIPTS}/transfer_imgs.sh + else echo "Unable to transfer files from $MY_MACHINE to $WEBSVR." echo "Manual intervention is required." + fi diff --git a/src/Conventional_Monitor/image_gen/ush/grib2ctl.pl b/src/Conventional_Monitor/image_gen/ush/grib2ctl.pl deleted file mode 100755 index 31f7cf01..00000000 --- a/src/Conventional_Monitor/image_gen/ush/grib2ctl.pl +++ /dev/null @@ -1,1458 +0,0 @@ -#!/usr/bin/perl -w -# makes a GrADS control file for grib files -# -# requires wgrib and Perl5 -# -# usage: grib2ctl [options] [grib file] [optional index file] >[control file] -# -# note: this script does not make the index file .. you have to run gribmap -# -# Analyses: (using initial time) -# -# $ grib2ctl.pl example.grib >example.ctl -# $ gribmap -i example.ctl -0 -# -# Forecasts: (using verifiation time) -# -# $ grib2ctl.pl -verf example.grib >example.ctl -# $ gribmap -i example.ctl -# -# bugs: -# many -# will fail under number of situations -# finite number of NCEP grids are supported -# -# requires wgrib 1.7.4 or higher -# wesley ebisuzaki, -# http://www.cpc.ncep.noaa.gov/products/wesley/grib2ctl.html -# -# -# added output for rotated LatLon grids -# Helmut P. Frank, Helmut.Frank@dwd.de -# Fri Sep 14 13:54:00 GMT 2001 -# -ts, -lc options: Ag Stephens, BADC 3/2003 - -$version="0.9.12.5p39a"; -use POSIX; - -# ***** if wgrib is not on path, add it here -# $wgrib='/u/wx51we/home/bin/wgrib'; -#$wgrib='wgrib'; -$wgrib=(system("wgrib --v > /dev/null 2>&1") == 0) ? 'wgrib' : '/gpfs/dell1/nco/ops/nwprod/grib_util.v1.1.1/exec/wgrib' ; # NCEP only -print STDERR "*** wgrib = $wgrib \n\n"; - -# **** directory of interpolation files -$pdef_dir='/usr/local/lib/grads'; -#$pdef_dir='/u/wx51we/home/grads'; - -$wflag=""; -$file=""; -$index=""; -$pdef=""; -$prs="prs"; -$suffix=""; -$model="GFS"; -$calendar=""; -$lc=""; -$global_map=""; -$timestep=""; -$rr=""; -$nearest_neighbor=""; -$kludge=""; -$no235z=""; -$template=""; - -$raw="no"; - -# vertical levels allowd, index = grib level number -# 100 = mb, 103=m above msl 105-m above ground 107=sigma 109=hybrid level 111=cm down 113=K -# 115=mb above ground 125=cm above ground 160=m below sea level -$allow_profile[20] = '+'; -$allow_profile[100] = '-'; -$allow_profile[103] = '+'; -$allow_profile[105] = '+'; -$allow_profile[107] = '-'; -$allow_profile[109] = '+'; -$allow_profile[111] = '-'; -$allow_profile[113] = '+'; -$allow_profile[115] = '+'; -$allow_profile[125] = '-'; -$allow_profile[160] = '-'; -$allow_profile[235] = '-'; - - -foreach $_ (@ARGV) { - SWITCH: { - /^-verf/ && do { $wflag="$wflag -verf" ; last SWITCH; }; - /^-ncep_opn/ && do { $wflag="$wflag -ncep_opn" ; last SWITCH; }; - /^-ncep_rean/ && do { $wflag="$wflag -ncep_rean" ; last SWITCH; }; - /^-no_prs/ && do { $prs="" ; last SWITCH; }; - /^-no_suffix/ && do { $suffix="no" ; last SWITCH; }; - /^-rev_z/ && do { last SWITCH; }; - /^-365/ && do { $calendar="365"; last SWITCH; }; - /^-ts(\d+\w+)/ && do { $timestep=$1; last SWITCH; }; - /^-lc$/ && do { $lc="on"; last SWITCH; }; - /^-rr_nn$/ && do { $rr="on"; $nearest_neighbor="on"; $model="ETA"; last SWITCH; }; - /^-rr$/ && do { $rr="on"; $model="ETA"; last SWITCH; }; - /^-eta$/ && do { $model="ETA"; last SWITCH; }; - /^-mrf$/ && do { $model="GFS"; last SWITCH; }; - /^-gfs$/ && do { $model="GFS"; last SWITCH; }; - /^-ruc$/ && do { $model="RUC"; last SWITCH; }; - /^-global$/ && do { $global_map = "on"; last SWITCH; }; - /^-noah$/ && do { $wflag="$wflag -ncep_opn"; last SWITCH; }; - /^-osu/ && do { last SWITCH; }; - /^-kludge/ && do { $kludge="on"; last SWITCH; }; - /^-no_235z/ && do { $no235z="on"; last SWITCH; }; - - /^-iso_profile/ && do { undef @allow_profile; $allow_profile[235]='yes'; last SWITCH }; - /^-prs_profile/ && do { undef @allow_profile; $allow_profile[100]='yes'; last SWITCH }; - /^-m_profile/ && do { undef @allow_profile; $allow_profile[103]='yes'; - $allow_profile[105]='yes' ; last SWITCH }; - - /^-raw/ && do { $raw="yes" ; last SWITCH }; - /^-/ && do { print STDERR "unknown option: $_\n"; exit 8; }; - if ($file eq "") { - $file = $_; - } - elsif ($index eq "") { - $index = $_; - } - else { - $pdef = $_; - } - } -} - -if ($file eq "") { - if ($#ARGV >= 0) { - print STDERR "*** missing grib file ***\n\n\n"; - } - print STDERR "$0 $version wesley ebisuzaki\n"; - print STDERR " makes a Grads control file for grib files\n"; - print STDERR " usage: $0 [options] [grib_file] [optional index file] [optional pdef file] >[ctl file]\n"; - print STDERR " -ncep_opn .. use NCEP opn grib table for T62 NCEP fields\n"; - print STDERR " -ncep_rean .. use NCEP reanalysis grib table for T62 NCEP fields\n"; - print STDERR " -verf .. use forecast verification times\n"; - print STDERR " -no_prs .. no prs suffix on variable name\n"; - print STDERR " -no_suffix .. no suffix on variable name\n"; - print STDERR " -365 .. 365 day calendar\n"; - print STDERR " -ts[timestep] .. set timestep for individual time files (e.g. -ts6hr)\n"; - print STDERR " -lc .. set lowercase option for parameter names\n"; - print STDERR " -iso_profile .. set z coordinate to ocean isotherms\n"; - print STDERR " -m_profile .. set z coordinate to meters above ground/msl\n"; - print STDERR " -prs_profile .. set z coordinate to pressure (mb)\n"; -# print STDERR " -eta .. ETA model levels\n"; -# print STDERR " -gfs .. GFS (MRF) model level (default)\n"; -# print STDERR " -noah .. NOAH model levels (default)\n"; -# print STDERR " -osu .. OSU model levels\n"; - print STDERR " -raw .. raw grid\n"; -# print STDERR " -ruc .. RUC levels\n"; - print STDERR " -iso_profile .. make profile using subsurface isoterms\n"; - print STDERR "\n"; - print STDERR "Note 1: the index file will be generated by the gribmap program, default: grib_file.idx\n"; - print STDERR "Note 2: the pdef file is only generated for thinned lat-lon grids, default: grib_file.pdef\n"; - exit 8; -} - -$_ = $file; -if (/%y4/ || /%y2/ || /%m2/ || /%m1/ || /%d2/ || /%d1/ || /%h2/ || - /%h1/ || /%f2/ || /%f3/) { $template='on'; } - -if (-d "c:\\") { - $ListA="c:\\g$$.tmp"; - $TmpFile="c:\\h$$.tmp"; - unlink ($ListA, $TmpFile); - $sys="win"; -} -else { - $ListA="/tmp/grib2ctl.$$.tmp"; - $TmpFile="/dev/null"; - unlink $ListA; - $sys="unix"; -} - -# ctlfilename = name used by control file (different for template option( -# file = file name (of first matching file) -$ctlfilename=$file; - - -# inventory of All records -if ($template eq "on") { - $gfile=$file; - - if ($sys eq 'win') { - $gfile =~ s=\\=/=g; - } - $gfile =~ s/%y4/\\d{4}/g; - $gfile =~ s/%y2/\\d{2}/g; - $gfile =~ s/%m2/\\d{2}/g; - $gfile =~ s/%m1/\\d{1,2}/g; - $gfile =~ s/%d2/\\d{2}/g; - $gfile =~ s/%d1/\\d{1,2}/g; - $gfile =~ s/%h2/\\d{2}/g; - $gfile =~ s/%h1/\\d{1,2}/g; - $gfile =~ s/%h3/\\d{3}/g; - $gfile =~ s/%f2/\\d{2,3}/g; - $gfile =~ s/%f3/\\d{3}/g; - - $dir=$gfile; - $dir =~ s=(/*)[^/]*$=$1=; - - $head=$gfile; - $head =~ s=\\d\{.*==; - $tail=$gfile; - $tail =~ s=.*\\d\{.*\}==; - - if ($dir eq "") { - opendir(DIR,'.'); - } - else { - opendir(DIR,$dir); - } - - @allfiles = grep /^$gfile$/, readdir DIR; - closedir DIR; - - if ($#allfiles <= -1 ) { - print STDERR "\nError: could not find any files in directory: $dir\n"; - exit 8; - } - -# allfiles has the name of all the files -# need to find times: t0, t1, .. t-las - - for ($i = 0; $i <= $#allfiles; $i++) { - $_ = $allfiles[$i]; - $_ =~ s/$head//; - $_ =~ s/$tail//; -# now $_ has the date code / forecast hour - - if ($i == 0) { - $min_tval = $_; - $min_t2val = $_; - $max_tval = $_; - } - elsif ($min_tval eq $min_t2val && $min_tval eq $max_tval) { - if ($_ > $min_tval) { - $min_t2val = $_; - $max_tval = $_; - } - else { - $min_tval = $_; - } - } - else { - if ($_ > $max_tval) { $max_tval = $_; } - elsif ($_ < $min_tval) { - $min_t2val = $min_tval; - $min_tval = $_; - } - elsif ($_ < $min_t2val && $_ > $min_tval) { - $min_t2val = $_; - } - } - } - - $file="$dir$head$min_tval$tail"; - if ($sys eq 'win') { - $file =~ s=/=\\=g; - } - -# make inventory of first two files and last file -# need to get dt and last date - - system "$wgrib $wflag -v $dir$head$min_tval$tail >$ListA"; - if ($#allfiles >= 1) { - system "$wgrib $wflag -v $dir$head$min_t2val$tail >>$ListA"; - } - if ($#allfiles >= 2) { - system "$wgrib $wflag -v $dir$head$max_tval$tail >>$ListA"; - } -} -else { - system "$wgrib $wflag -v $file >$ListA"; -} - -if ( ! -s $ListA ) { - print STDERR "Big problem:\n"; - print STDERR " either $file is missing or not a grib file\n"; - print STDERR " or wgrib is not on your path\n"; - unlink $ListA; - exit 8; -} - -# make table of dates and variables - -open (FileDate, "<$ListA"); -while (defined($_ = )) { - - # date table - - $_ =~ s/^.*D=//; - $d=substr($_, 0, 10); - $dates{$d}=""; - - # variable/level list - @Fld = split(':', $_, 99); - $kpds=substr($Fld[3],5); - ($kpds5,$kpds6,$kpds7) = split(/,/,$kpds); - $varname = "$Fld[1]:$kpds6"; - if (defined $flevels{$varname}) { - if (!($flevels{$varname} =~ / $kpds7 /)) { - $flevels{$varname} .= "$kpds7 "; - } - } - else { - $flevels{$varname} = " $kpds7 "; - $fcomments{$varname} = "$kpds5:$Fld[$#Fld]"; - } -} -close (FileDate); -@sdates=sort keys(%dates); - -# number of time 1 or greater -$ntime=$#sdates + 1; - -$time=$sdates[0]; - -$year = substr($time,0,4); -$mo = substr($time,4,2); -$day = substr($time,6,2); -$hour = substr($time,8,2); - -if ($mo < 0 || $mo > 12) { - print "illegal date code $time\n"; - unlink $ListA; - exit 8; -} - -$month=substr("janfebmaraprmayjunjulaugsepoctnovdec",$mo*3-3,3); - -if ($ntime > 1) { - $year1 = substr($sdates[1],0,4); - $mo1 = substr($sdates[1],4,2); - $day1 = substr($sdates[1],6,2); - $hour1 = substr($sdates[1],8,2); - - $year_last = substr($sdates[$#sdates],0,4); - $mo_last = substr($sdates[$#sdates],4,2); - $day_last = substr($sdates[$#sdates],6,2); - $hour_last = substr($sdates[$#sdates],8,2); -} - -# ---------------intro------------------------------------ - -if ("$index" eq "") {$index="$file.idx";} -if ("$pdef" eq "") { $pdef = "$file.pdef";} - - -if ($sys eq "unix") { - $caret1 = (substr($file,0,1) eq "/") ? "" : '^'; - $caret2 = (substr($index,0,1) eq "/") ? "" : '^'; - $caret3 = (substr($pdef,0,1) eq "/") ? "" : '^'; -} -else { - $caret1 = (substr($file,1,1) eq ":") ? "" : '^'; - $caret2 = (substr($index,1,1) eq ":") ? "" : '^'; - $caret3 = (substr($pdef,1,1) eq ":") ? "" : '^'; -} - -print "dset $caret1$ctlfilename\nindex $caret2$index\n"; - -print "undef 9.999E+20\ntitle $file\n* produced by grib2ctl v$version\n"; - -# ------------------- grid ----------------------- -$griddef = `$wgrib $wflag -V $file -d 1 -o $TmpFile`; -$_=$griddef; - -/ center (\S*) /; -$center=$1; -/ grid=(\S*) /; -$grid=$1; - -print "dtype grib $grid\n"; -if ($template eq "on") { - print "options template\n"; -} - -if ($raw eq 'yes') { - / nx (\S*) ny (\S*) /; - $nx=$1; - $ny=$2; - print "xdef $nx linear 0 0.1\n"; - print "ydef $ny linear 0 0.1\n"; -} -elsif (/ thinned latlon: /) { - / lat *(\S*) to (\S*) by (\S*) /; - $lat0 = $1; - $lat1 = $2; - $dy = $3; - / long (\S*) to (\S*), (\S*) grid pts \(-1 x (\S*)\) /; - $lon0=$1; - $lon1=$2; - $nxny = $3; - $ny = $4; - if ($lat0 > $lat1) { - $yrev = 1; - print "ydef $ny linear $lat1 ", abs($dy), "\n" - } - else { - $yrev = 0; - print "ydef $ny linear $lat0 ", abs($dy), "\n" - } - - - $t=$_; - s/\n//g; - / bdsgrid \S* (.*) min/; - $list=$1; - $i = 1; - foreach $t (split(' ',$list)) { - $nlon[$i++] = $t; - } - $nx=$nlon[1]; - if ($nx < $nlon[$ny]) { $nx = $nlon[$ny]; } - if ($lon1 <= $lon0) { $lon1 += 360.0; } - $dx = ($lon1 - $lon0) / ($nx - 1); - print "xdef $nx linear $lon0 $dx\n"; - -# now to create the pdef file - - open (PDEF, ">$pdef"); - binmode PDEF; - - print "pdef $nxny 1 file 1 stream binary $caret3$pdef\n"; - - if ($yrev == 0) { - $offset = 0; - for ($j = 1; $j <= $ny; $j++) { - for ($i = 0; $i < $nx; $i++) { - $x = $i / ($nx - 1.0) * ($nlon[$j] - 1); - $x = floor($x + 0.5) + $offset; - print PDEF pack("L", $x); - } - $offset += $nlon[$j]; - } - } - else { - $offset = $nxny; - for ($j = $ny; $j >= 1; $j--) { - $offset -= $nlon[$j]; - for ($i = 0; $i < $nx; $i++) { - $x = $i / ($nx - 1.0) * ($nlon[$j] - 1); - $x = floor($x + 0.5) + $offset; - print PDEF pack("L", $x); - } - } - } - - -# print weights - $x = pack("f", 1.0); - for ($i = 0; $i < $nx*$ny; $i++) { - print PDEF $x; - } -# print wind rotation - $x = pack("L", -999); - for ($i = 0; $i < $nx*$ny; $i++) { - print PDEF $x; - } - close(PDEF); -} -elsif (/ latlon: /) { - / lat (\S*) to (\S*) by (\S*) /; - $lat0=$1; - $lat1=$2; - $dlat=$3; - - / long (\S*) to (\S*) by (\S*), \((\S*) x (\S*)\)/; - $lon0=$1; - # $lon1=$2; - $dlon=$3; - $nx =$4; - $ny =$5; - - if ($lat0 > $lat1) { - print "options yrev\n"; - print "ydef $ny linear $lat1 ", abs($dlat), "\n" - } - else { - print "ydef $ny linear $lat0 ", abs($dlat), "\n" - } - print "xdef $nx linear $lon0 $dlon\n"; -} -elsif ($grid == 5 && $center == 7) { - print "pdef 53 57 nps 27 49 -105 190.5\n"; - print "xdef 161 linear -140 0.5\n"; - print "ydef 81 linear 20 0.5\n"; -} -elsif ($grid == 6 && $center == 7) { - print "pdef 53 45 nps 27 49 -105 190.5\n"; - print "xdef 161 linear -140 0.5\n"; - print "ydef 81 linear 20 0.5\n"; -} -elsif ($grid == 87 && $center == 7) { - print "pdef 81 62 nps 31.9 112.53 -105 68.513\n"; - print "xdef 161 linear -140 0.5\n"; - print "ydef 81 linear 20 0.5\n"; -} -elsif ($grid == 96 && $kludge eq "on" && $center == 7) { - # quick and dirty pdef for eta 12 km - # use -kludge option - print "pdef 606 1067 eta.u -111 50 0.17520661 0.075046904\n"; - print "xdef 1440 linear -200 0.125\n"; - print "ydef 721 linear 0 0.125\n"; -} -elsif ($grid == 101 && $center == 7) { - print "pdef 113 91 nps 58.5 92.5 -105 91.452\n"; - print "xdef 161 linear -140 0.5\n"; - print "ydef 81 linear 20 0.5\n"; -} -elsif ($grid == 104 && $center == 7) { - print "pdef 147 110 nps 75.5 109.5 -105 90.75464\n"; - print "xdef 161 linear -140 0.5\n"; - print "ydef 81 linear 20 0.5\n"; -} -elsif ($grid == 105 && $center == 7) { - print "pdef 83 83 nps 40.5 88.5 -105 90.75464\n"; - print "xdef 161 linear -140 0.5\n"; - print "ydef 81 linear 20 0.5\n"; -} -elsif ($grid == 106 && $center == 7) { - print "pdef 165 117 nps 80 176 -105 45.37732\n"; - print "xdef 161 linear -140 0.5\n"; - print "ydef 81 linear 20 0.5\n"; -} -elsif ($grid == 107 && $center == 7) { - print "pdef 120 92 nps 46 167 -105 45.37732\n"; - print "xdef 161 linear -140 0.5\n"; - print "ydef 81 linear 20 0.5\n"; -} -elsif ($grid == 192 && $rr ne "" && $center == 7) { - # quick and dirty pdef for RR egrid - # need -rr option to use - print "pdef 237 387 eta.u -111 50 0.4491525 0.2072539\n"; - print "xdef 360 linear -180 0.5\n"; - print "ydef 181 linear 0 0.5\n"; -} -elsif ($grid == 201 && $center == 7) { - print "pdef 65 65 nps 33 33 -105 381\n"; - print "xdef 180 linear -180 2\n"; - print "ydef 51 linear -10 2\n"; -} -elsif ($grid == 202 && $center == 7) { - print "pdef 65 43 nps 33 45 -105 190.5\n"; - print "xdef 91 linear -200 2\n"; - print "ydef 41 linear 10 2\n"; -} -elsif ($grid == 203 && $center == 7) { - print "pdef 45 39 nps 27 37 -150 190.5\n"; - print "xdef 103 linear -250 2\n"; - print "ydef 33 linear 26 2\n"; -} -elsif ($grid == 205 && $center == 7) { - print "pdef 45 39 nps 27 57 -60 190.5\n"; - print "xdef 50 linear -120 2\n"; - print "ydef 46 linear 0 2\n"; -} -elsif ($grid == 207 && $center == 7) { - print "pdef 49 35 nps 25 51 -150 95.25\n"; - print "xdef 51 linear -200 2\n"; - print "ydef 30 linear 45 1\n"; -} -elsif ($grid == 211 && $center == 7) { - # awips lambert conformal - print "pdef 93 65 lcc 12.19 -133.459 1 1 25 25 -95 81270.5 81270.5\n"; - print "xdef 161 linear -140 0.5\n"; - print "ydef 81 linear 20 0.5\n"; -} -elsif ($grid == 212 && $center == 7) { - # awips lambert conformal - print "pdef 185 129 lcc 35.0 -95.0 105 49 25 25 -95 40635 40635\n"; - print "xdef 181 linear -140 0.5\n"; - print "ydef 91 linear 15 0.5\n"; -} -elsif ($grid == 213 && $center == 7) { - print "pdef 129 85 nps 65 89 -105 95.25\n"; - print "xdef 170 linear -190 1\n"; - print "ydef 81 linear 10 1\n"; -} -elsif ($grid == 215 && $center == 7) { - # lambert conformal - print "pdef 369 257 lcc 12.19 -133.46 1 1 25 25 -95 20318 20318\n"; - print "xdef 289 linear -136 0.25\n"; - print "ydef 157 linear 18 0.25\n"; -} -elsif ($grid == 216 && $center == 7) { - print "pdef 147 110 nps 75.5 109.5 -105 91.452\n"; - print "xdef 181 linear -180 1\n"; - print "ydef 91 linear 0 1\n"; -} -elsif ($grid == 221 && $nearest_neighbor eq "on" && $center == 7) { - # awips lambert conformal nearest neighbor - print "pdef 96673 1 file 1 sequential binary-little $pdef_dir/grib221nn.pdef\n"; - print "xdef 1111 linear -250 0.333333\n"; - print "ydef 247 linear 8 0.333333\n"; -} -elsif ($grid == 221 && $center == 7) { - # awips lambert conformal - print "pdef 349 277 lcc 1 -145.5 1 1 50 50 -107 32463 32463\n"; - print "xdef 1111 linear -250 0.333333\n"; - print "ydef 247 linear 8 0.333333\n"; -} -# old grid 240 -#elsif ($grid == 240) { -# # nps usa -# print "pdef 1160 880 nps 441 1601 255 4.763\n"; -# print "xdef 801 linear -130 0.1\n"; -# print "ydef 401 linear 20 0.1\n"; -#} -# new grid 240 -elsif ($grid == 240 && $center == 7) { - # nps usa - print "pdef 1121 881 nps 401 1601 255 4.7625\n"; - print "xdef 1601 linear -130 0.05\n"; - print "ydef 801 linear 20 0.05\n"; -} -elsif ($grid == 241 && $center == 7) { - print "pdef 386 293 nps 147.315 534.0 -105 14.2875\n"; - print "xdef 161 linear -140 0.5\n"; - print "ydef 81 linear 20 0.5\n"; -} -else { - # unknown grid - - $_ = $griddef; - GRD: { - - / polar stereo: Lat1 16.125000 Long1 234.983000 Orient -100.0/ && do { - print "options yrev\n"; - print "pdef 129 86 nps 64 136 -100 60\n"; - print "xdef 720 linear 0 0.5\n"; - print "ydef 148 linear 16 0.5\n"; - last GRD; }; - - / polar stereo: Lat1 -4.860000 Long1 -122.614000 Orient -80.000000/ && do { - print "pdef 49 51 nps 24 26 -80 381\n"; - print "xdef 144 linear 0 2.5\n"; - print "ydef 45 linear -20 2.5\n"; - last GRD; }; - - / Lambert Conf:.* Lov 265.*\(151 x 113\)/s && do { - print "options yrev\n"; - print "pdef 151 113 lcc 16.281 233.8622 1 1 25 25 265 40635 40635\n"; - print "xdef 141 linear -130 0.5\n"; - print "ydef 71 linear 20 0.5\n"; - last GRD; }; - - # beta: mercator - # scan modes .. assumes west to east - / Mercator: / && do { - /lat *(\S*) to (\S*) /; - $lat1 = $1; - $lat2 = $2; - /long (\S*) to (\S*) /; - $lon1 = $1; - $lon2 = $2; - / nx (\S*) ny (\S*) /; - $nx = $1; - $ny = $2; - - if ($lat1 > $lat2) { - print "options yrev\n"; - $t = $lat2; - $lat2 = $lat1; - $lat1 = $t; - } - print "ydef $ny levels\n"; - $i = 0; - $n1 = log(tan((45+$lat1/2)*3.1415927/180)); - $n2 = log(tan((45+$lat2/2)*3.1415927/180)); - $dy = ($n2 - $n1) / ($ny - 1); - - while ($i < $ny) { - $nn = $n1 + $dy * $i; - $lat = (atan(exp($nn))*180/3.1415927-45)*2; - printf ("%9.4f ", $lat); - $i++; - if ($i % 7 == 0) { print "\n"; } - } - if ($i % 7 != 0) { print "\n"; } - - $dlon = $lon2 - $lon1; - if ($dlon < 0) { - $dlon = $dlon + 360; - } - $dlon = $dlon / ($nx - 1); - print "xdef $nx linear $lon1 $dlon\n"; - - last GRD; }; - - - # beta: generalized lambert conformal pdef/xdef/ydef - # not very good .. needs to calculate the all - # vertices for better xdef and ydef - # for improvements .. pull out code from lcgrib - - / Lambert Conf: / && do { - / Lat1 (\S*) Lon1 (\S*) Lov (\S*)/; - $lat1 = $1; - $lon1 = $2; - $lov = $3; - - /Latin1 (\S*) Latin2 (\S*) /; - $latin1 = $1; - $latin2 = $2; - - /Pole \((\S*) x (\S*)\) Dx (\S*) Dy (\S*) /; - $nx = $1; - $ny = $2; - $dx = 1000*$3; - $dy = 1000*$4; - - print "pdef $nx $ny lcc $lat1 $lon1 1 1 $latin1 $latin2 $lov $dx $dy\n"; - if ($global_map eq "") { - $dx = $dx / (110000.0 * cos($lat1*3.141592654/180.0)); - $dy = $dy / 110000.0; - if ($lon1 > 180) { - $lon1 = $lon1 - 360.0; - } - print "xdef $nx linear $lon1 $dx\n"; - print "ydef $ny linear $lat1 $dy\n"; - } - else { - print "xdef 360 linear 0 1\n"; - print "ydef 181 linear -90 1\n"; - } - - last GRD; }; - - / thinned gaussian:/ && do { - - / lat *(\S*) to (\S*)/; - $lat0 = $1; - $lat1 = $2; - - / long (\S*) to (\S*), (\S*) grid pts \(-1 x (\S*)\) /; - $lon0=$1; - $lon1=$2; - $nxny = $3; - $ny = $4; - print "ydef $ny levels\n"; - $yrev = 0; - if ($lat0 > $lat1) { $yrev = 1; } - - $eps = 3e-14; - $m=int(($ny+1)/2); - - $i=1; - while ($i <= $m) { - $z=cos(3.141592654*($i-0.25)/($ny+0.5)); - do { - $p1 = 1; - $p2 = 0; - $j = 1; - while ($j <= $ny) { - $p3 = $p2; - $p2 = $p1; - $p1=((2*$j-1)*$z*$p2-($j-1)*$p3)/$j; - $j++; - } - $pp = $ny*($z*$p1-$p2)/($z*$z-1); - - $z1 = $z; - $z = $z1 - $p1/$pp; - } until abs($z-$z1) < $eps; - $x[$i] = -atan2($z,sqrt(1-$z*$z))*180/3.141592654; - $x[$ny+1-$i] = -$x[$i]; - $i++; - } - $i = 1; - while ($i < $ny) { - printf " %7.3f", $x[$i]; - if (($i % 10) == 0) { print "\n"; } - $i++; - } - printf " %7.3f\n", $x[$ny]; - - $t=$_; - - s/\n//g; - / bdsgrid \S* (.*) min/; - $list=$1; - $i = 1; - $nx = 0; - foreach $t (split(' ',$list)) { - $nlon[$i++] = $t; - if ($nx < $t) { $nx = $t; } - } - if ($lon1 <= $lon0) { $lon1 += 360.0; } - $dx = ($lon1 - $lon0) / ($nx - 1); - print "xdef $nx linear $lon0 $dx\n"; - -# now to create the pdef file - - open (PDEF, ">$pdef"); - binmode PDEF; - - print "pdef $nxny 1 file 1 stream binary $caret3$pdef\n"; - - if ($yrev == 0) { - $offset = 0; - for ($j = 1; $j <= $ny; $j++) { - for ($i = 0; $i < $nx; $i++) { - $x = $i / ($nx - 1.0) * ($nlon[$j] - 1); - $x = floor($x + 0.5) + $offset; - print PDEF pack("L", $x); - } - $offset += $nlon[$j]; - } - } - else { - $offset = $nxny; - for ($j = $ny; $j >= 1; $j--) { - $offset -= $nlon[$j]; - for ($i = 0; $i < $nx; $i++) { - $x = $i / ($nx - 1.0) * ($nlon[$j] - 1); - $x = floor($x + 0.5) + $offset; - print PDEF pack("L", $x); - } - } - } - -# print weights - $x = pack("f", 1.0); - for ($i = 0; $i < $nx*$ny; $i++) { - print PDEF $x; - } -# print wind rotation - $x = pack("L", -999); - for ($i = 0; $i < $nx*$ny; $i++) { - print PDEF $x; - } - close(PDEF); - last GRD; }; - - / gaussian:/ && do { - / lat (\S*) to (\S*)/; - $lat0=$1; - $lat1=$2; - - / long (\S*) to (\S*) by (\S*), \((\S*) x (\S*)\)/; - $lon0=$1; - # $lon1=$2; - $dlon=$3; - $nx =$4; - $ny =$5; - $dlon = 360 / $nx; - - if ($lat0 > $lat1) { - print "options yrev\n"; - } - print "xdef $nx linear $lon0 $dlon\n"; - print "ydef $ny levels\n"; - - $eps = 3e-14; - $m=int(($ny+1)/2); - - $i=1; - while ($i <= $m) { - $z=cos(3.141592654*($i-0.25)/($ny+0.5)); - do { - $p1 = 1; - $p2 = 0; - $j = 1; - while ($j <= $ny) { - $p3 = $p2; - $p2 = $p1; - $p1=((2*$j-1)*$z*$p2-($j-1)*$p3)/$j; - $j++; - } - $pp = $ny*($z*$p1-$p2)/($z*$z-1); - - $z1 = $z; - $z = $z1 - $p1/$pp; - } until abs($z-$z1) < $eps; - $x[$i] = -atan2($z,sqrt(1-$z*$z))*180/3.141592654; - $x[$ny+1-$i] = -$x[$i]; - $i++; - } - $i = 1; - while ($i < $ny) { - printf " %7.3f", $x[$i]; - if (($i % 10) == 0) { print "\n"; } - $i++; - } - printf " %7.3f\n", $x[$ny]; - - last GRD; }; -# rotated LatLon grid - / rotated LatLon grid/ && do { - / LatLon grid lat (\S*) to (\S*) lon (\S*) to (\S*)/; - $lat0 = $1; - $lat1 = $2; - $lon0 = $3; - $lon1 = $4; - /nxny \S+ \((\S*) x (\S*)\)/; - $nx = $1; - $ny = $2; - / south pole lat (\S*) lon (\S*) rot angle (\S*)/; - $lat_sp = $1; - $lon_sp = $2; - $rot_angle = $3; - print "* Rotated LatLon grid: South pole lat $lat_sp lon $lon_sp", - " rot angle $rot_angle\n"; - $dlon = ( $lon1-$lon0)/($nx-1); - $dlat = ( $lat1-$lat0)/($ny-1); - if ($lat0 > $lat1) { - print "options yrev\n"; - print "ydef $ny linear $lat1 ", abs($dlat), "\n" - } - else { - print "ydef $ny linear $lat0 ", abs($dlat), "\n" - } - print "xdef $nx linear $lon0 $dlon\n"; - last GRD; }; - -# polar stereographic - / polar stereo: / && do { - / Lat1 (\S*) Long1 (\S*) Orient (\S*)/; - $lat1=$1; - $lon1=$2; - $orient=$3; - - / (\S*) pole \((\S*) x (\S*)\) Dx (\S*) Dy (\S*) scan (\S*)/; - $pole=$1; - $nx=$2; - $ny=$3; - $dx=$4; - $dy=$5; - $scan=$6; - - # probably only works for scan=64 - - $dpr=3.14159265358979/180.0; - $rearth=6.3712e6; - - $h=1; - $proj="nps"; - if ($pole eq "south") { - $h=-1; - $proj="sps"; - } - $hi=1; - $hj=-1; - if (($scan/128 % 2) == 1) { - $hi=-1; - } - if (($scan/64 % 2) == 1) { - $hj=1; - } - $dxs=$dx*$hi; - $dys=$dy*$hj; - $de=(1+sin(60*$dpr))*$rearth; - $dr=$de*cos($lat1*$dpr)/(1+$h*sin($lat1*$dpr)); - $xp=1-$h*sin(($lon1-$orient)*$dpr)*$dr/$dxs; - $yp=1+cos(($lon1-$orient)*$dpr)*$dr/$dys; - $dx=$h*$dx/1000; - - printf "pdef $nx $ny $proj $xp $yp $orient $dx\n"; - - # need to do a better job here - # need to find lat/lon of end points to right domain - # for now, just do simple stuff - $dx=abs($dx)*1000; - $nx = int($rearth * 3.14 / $dx + 1); - $dx = 360/$nx; - printf "xdef $nx linear 0 $dx\n"; - if ($proj eq 'sps') { - $ny=int(($lat1+90)/$dx)+1; - printf "ydef $ny linear -90 $dx\n", - } - else { - $ny=int((90-$lat1)/$dx)+1; - $l=90-($ny-1)*$dx; - printf "ydef $ny linear $l $dx\n", - } - last GRD; }; - - - print STDERR "*** script needs to be modified ***\n"; - print STDERR "unknown user-defined grid\n"; - } -} - - -# make the tdef statement - -&tdef; - -# ------------------var-------------------------------------; - -%tails =( - '1' => 'sfc', - '2' => 'clb', - '3' => 'clt', - '4' => 'zdg', - '5' => 'adcl', - '6' => 'mwl', - '7' => 'trp', - '8' => 'toa', - '9' => 'bos', - '10' => 'clm', - '12' => 'lcb', - '13' => 'lct', - '14' => 'loc', - '20' => 'tmpl', - '22' => 'mcb', - '23' => 'mct', - '24' => 'mdc', - '32' => 'hcb', - '33' => 'hct', - '34' => 'hic', - '100' => 'prs', - '101' => 'plr', - '102' => 'msl', - '103' => 'hml', - '104' => 'zlr', - '105' => 'hag', - '106' => 'hlr', - '107' => 'sig', - '108' => 'slr', - '109' => 'hbl', - '110' => 'blr', - '111' => 'dpl', - '112' => 'dlr', - '113' => 'tht', - '114' => 'tlr', - '116' => 'plg', - '117' => 'pv', - '121' => 'plr', - '126' => 'pa', - '128' => 'slr', - '141' => 'plr', - '160' => 'dsl', - '200' => 'clm', - '201' => 'oclm', - '204' => 'htfl', - '206' => 'gcbl', - '207' => 'gctl', - '209' => 'bcb', - '210' => 'bct', - '211' => 'bcl', - '212' => 'lcb', - '213' => 'lct', - '214' => 'lcl', - '222' => 'mcb', - '223' => 'mct', - '224' => 'mcl', - '232' => 'hcb', - '233' => 'hct', - '234' => 'hcl', - '235' => 'tmp', - '237' => 'bmxl', - '238' => 'bitl', - '242' => 'cvb', - '243' => 'cvt', - '244' => 'cvl', - '248' => 'sccb', - '249' => 'scct', - '251' => 'dccb', - '252' => 'dcct', - ); - -# Find the vertical profile - -$nlevelmax=0; -$levelsmax=0; -$profile_kpds6=-1; - -foreach $fname (sort keys(%flevels)) { - ($name, $kpds6) = split(/:/, $fname); - $_=$flevels{$fname}; - $nlev = (tr/ / /) - 1; - if ($nlev > $nlevelmax) { - if (defined($allow_profile[$kpds6])) { - $nlevelmax = $nlev; - $levelsmax = $flevels{$fname}; - $profile_kpds6 = $kpds6; - } - } -} - -if ($nlevelmax <= 1) { - print "zdef 1 linear 1 1\n"; -} -else { - print "* z has $nlevelmax levels, for $tails{$profile_kpds6}\n"; - print "zdef $nlevelmax levels\n"; - ($_ = $levelsmax) =~ s/.//; - chop($_); - if ($allow_profile[$profile_kpds6] eq '+') { - print join ' ', sort {$a <=> $b} split(/ /,$_); - } - else { - print join ' ', sort {$b <=> $a} split(/ /,$_); - } - print "\n"; -} -if ($nlevelmax == 1) { $profile_kpds6 = -1; } - -$tails{'100'} = "$prs"; -$nvar = 0; - -foreach $fname (sort keys(%flevels)) { - ($name, $kpds6) = split(/:/, $fname); - ($kpds5, $comment) = split(/:/, $fcomments{$fname}); - $comment = substr($comment,1); - - $_=$flevels{$fname}; - $nlev = (tr/ / /) - 1; - $kpds7s = $_; - - # fix names to be grads compatible - # eliminate dashes, underscores, blanks and put no in front of leading digits - - $_ = $name; - $_ =~ tr/_\- //d; - if ($lc) { $_ =~ s/(.*)/\L$1/gi; } - if ( /^\d/ ) { $_ = "no$_"; } - $name = $_; - - $tail = $suffix eq 'no' ? "" : $tails{$kpds6}; - if (! defined $tail) { $tail="l$kpds6"; } - - # convert profile variable - - if ($profile_kpds6 == $kpds6 && $nlev != 1) { - $out[$nvar++] = "$name$tail $nlev $kpds5,$kpds6,0 ** (profile) $comment"; - } - - # convert profiles to individual layers - elsif ($kpds6 == 100) { - foreach $ll (sort {$b <=> $a} split(' ',$kpds7s)) { - $out[$nvar++] = "${name}${ll}mb 0 $kpds5,$kpds6,$ll ** $ll mb $comment"; - } - } - elsif ($kpds6 == 101) { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - $lev1 = int($ll / 256); - $lev2 = $ll % 256; - $out[$nvar++] = "${name}${lev1}0_${lev2}0mb 0 $kpds5,$kpds6,$ll ** ${lev1}0-${lev2}0 mb $comment"; - } - } - elsif ($kpds6 == 103) { - foreach $ll (sort {$b <=> $a} split(' ',$kpds7s)) { - $out[$nvar++] = "${name}${ll}m 0 $kpds5,$kpds6,$ll ** $ll m above msl $comment"; - } - } - elsif ($kpds6 == 105) { - foreach $ll (sort {$b <=> $a} split(' ',$kpds7s)) { - $out[$nvar++] = "${name}${ll}m 0 $kpds5,$kpds6,$ll ** $ll m above ground $comment"; - } - } - elsif ($kpds6 == 106) { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - $lev1 = int($ll / 256); - $lev2 = $ll % 256; - $lev1f=100*$lev1; - $lev2f=100*$lev2; - $out[$nvar++] = "${name}${lev2f}_${lev1f}m 0 $kpds5,$kpds6,$ll ** ${lev2f}-${lev1f} m above ground $comment"; - } - } - elsif ($kpds6 == 107) { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - if ($ll < 10) {$ll="0$ll";} - if ($ll < 100) {$ll="0$ll";} - if ($ll < 1000) {$ll="0$ll";} - $lev1 = $ll; - $lev1 =~ s/0+$/ /; - $out[$nvar++] = "${name}sig$lev1 0 $kpds5,$kpds6,$ll ** sigma=.${lev1} $comment"; - } - } - elsif ($kpds6 == 108) { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - $lev1 = int($ll / 256); - $lev2 = $ll % 256; - $lev1f = $lev1 / 100; - $lev2f = $lev2 / 100; - $out[$nvar++] = "${name}sg${lev1}_${lev2} 0 $kpds5,$kpds6,$ll ** sigma=${lev1f}-${lev2f} layer $comment"; - } - } - elsif ($kpds6 == 109) { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - $out[$nvar++] = "${name}hlev$ll 0 $kpds5,$kpds6,$ll ** hybrid level $ll $comment"; - } - } - elsif ($kpds6 == 110) { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - $lev1 = int($ll / 256); - $lev2 = $ll % 256; - $out[$nvar++] = "${name}hg${lev1}_${lev2} 0 $kpds5,$kpds6,$ll ** hybrid=${lev1}-${lev2} layer $comment"; - } - } - elsif ($kpds6 == 111) { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - $out[$nvar++] = "${name}_${ll}cm 0 $kpds5,$kpds6,$ll ** $ll cm underground $comment"; - } - } - elsif ($kpds6 == 112) { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - $lev1 = int($ll / 256); - $lev2 = $ll % 256; - $out[$nvar++] = "${name}${lev1}_${lev2}cm 0 $kpds5,$kpds6,$ll ** $lev1-$lev2 cm underground $comment"; - } - } - elsif ($kpds6 == 20) { - foreach $ll (sort {$b <=> $a} split(' ',$kpds7s)) { - $flt = $ll / 100.0; - # cK = centi-Kelvins - $out[$nvar++] = "${name}${ll}cK 0 $kpds5,$kpds6,$ll ** ${flt}K level $comment"; - } - } - elsif ($kpds6 == 113) { - foreach $ll (sort {$b <=> $a} split(' ',$kpds7s)) { - $out[$nvar++] = "${name}${ll}K 0 $kpds5,$kpds6,$ll ** ${ll}K level $comment"; - } - } - elsif ($kpds6 == 116) { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - $lev1 = int($ll / 256); - $lev2 = $ll % 256; - $out[$nvar++] = "${name}${lev1}_${lev2}mb 0 $kpds5,$kpds6,$ll ** ${lev1}-${lev2} mb above gnd $comment"; - } - } - elsif ($kpds6 == 235) { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - $val = $ll; - if ($val > 32768) { $val = 32768 - $val; } - $iso=$val/10; - $isovar=$iso; - $isovar =~ s/-/neg/; - $isovar =~ s/[.]/p/; - $out[$nvar++] = "${name}t${isovar}c 0 $kpds5,$kpds6,$ll ** ${iso}C isotherm $comment"; - } - } - elsif ($kpds6 == 236) { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - $lev1 = int($ll / 256)*10; - $lev2 = ($ll % 256)*10; - $out[$nvar++] = "${name}${lev1}_${lev2}m 0 $kpds5,$kpds6,$ll ** $lev1-$lev2 m under water $comment"; - } - } - elsif ($kpds6 == 1) { - $kpds7s =~ s/^ //; - $out[$nvar++] = "${name}sfc 0 $kpds5,$kpds6,$kpds7s ** surface $comment"; - } - elsif ($kpds6 == 2) { - $out[$nvar++] = "${name}clb 0 $kpds5,$kpds6,0 ** cloud base $comment"; - } - elsif ($kpds6 == 3) { - $out[$nvar++] = "${name}clt 0 $kpds5,$kpds6,0 ** cloud top $comment"; - } - elsif ($kpds6 == 4) { - $out[$nvar++] = "${name}0deg 0 $kpds5,$kpds6,0 ** 0C isotherm level $comment"; - } - elsif ($kpds6 == 5) { - $out[$nvar++] = "${name}adcl 0 $kpds5,$kpds6,0 ** adiabatic lifting condensation level $comment"; - } - elsif ($kpds6 == 6) { - $out[$nvar++] = "${name}mwl 0 $kpds5,$kpds6,0 ** max wind level $comment"; - } - elsif ($kpds6 == 7) { - $out[$nvar++] = "${name}trp 0 $kpds5,$kpds6,0 ** tropopause $comment"; - } - elsif ($kpds6 == 8) { - $out[$nvar++] = "${name}toa 0 $kpds5,$kpds6,0 ** top of atmos $comment"; - } - elsif ($kpds6 == 200) { - $out[$nvar++] = "${name}clm 0 $kpds5,$kpds6,0 ** atmos column $comment"; - } - elsif ($kpds6 == 201) { - $out[$nvar++] = "${name}oclm 0 $kpds5,$kpds6,0 ** ocean column $comment"; - } - elsif ($kpds6 == 204) { - $out[$nvar++] = "${name}htfl 0 $kpds5,$kpds6,0 ** highest trop freezing level $comment"; - } - elsif ($kpds6 == 206) { - $out[$nvar++] = "${name}gcbl 0 $kpds5,$kpds6,0 ** grid-scale cloud bottom level $comment"; - } - elsif ($kpds6 == 207) { - $out[$nvar++] = "${name}gctl 0 $kpds5,$kpds6,0 ** grid-scale cloud top level $comment"; - } - elsif ($kpds6 == 209) { - $out[$nvar++] = "${name}bcb 0 $kpds5,$kpds6,0 ** boundary cld base $comment"; - } - elsif ($kpds6 == 210) { - $out[$nvar++] = "${name}bct 0 $kpds5,$kpds6,0 ** boundary cld top $comment"; - } - elsif ($kpds6 == 211) { - $out[$nvar++] = "${name}bcl 0 $kpds5,$kpds6,0 ** boundary cld layer $comment"; - } - elsif ($kpds6 == 212) { - $out[$nvar++] = "${name}lcb 0 $kpds5,$kpds6,0 ** low cloud base $comment"; - } - elsif ($kpds6 == 213) { - $out[$nvar++] = "${name}lct 0 $kpds5,$kpds6,0 ** low cloud top $comment"; - } - elsif ($kpds6 == 214) { - $out[$nvar++] = "${name}lcl 0 $kpds5,$kpds6,0 ** low cloud level $comment"; - } - elsif ($kpds6 == 222) { - $out[$nvar++] = "${name}mcb 0 $kpds5,$kpds6,0 ** mid-cloud base $comment"; - } - elsif ($kpds6 == 223) { - $out[$nvar++] = "${name}mct 0 $kpds5,$kpds6,0 ** mid-cloud top $comment"; - } - elsif ($kpds6 == 224) { - $out[$nvar++] = "${name}mcl 0 $kpds5,$kpds6,0 ** mid-cloud level $comment"; - } - elsif ($kpds6 == 232) { - $out[$nvar++] = "${name}hcb 0 $kpds5,$kpds6,0 ** high cloud base $comment"; - } - elsif ($kpds6 == 233) { - $out[$nvar++] = "${name}hct 0 $kpds5,$kpds6,0 ** high cloud top $comment"; - } - elsif ($kpds6 == 234) { - $out[$nvar++] = "${name}hcl 0 $kpds5,$kpds6,0 ** high cloud level $comment"; - } - elsif ($kpds6 == 237) { - $out[$nvar++] = "${name}${tail} 0 $kpds5,$kpds6,0 ** bottom ocn mixed layer $comment"; - } - elsif ($kpds6 == 238) { - $out[$nvar++] = "${name}${tail} 0 $kpds5,$kpds6,0 ** bottom ocn isothermal layer $comment"; - } - elsif ($kpds6 == 242) { - $out[$nvar++] = "${name}cvb 0 $kpds5,$kpds6,0 ** convective cld base $comment"; - } - elsif ($kpds6 == 243) { - $out[$nvar++] = "${name}cvt 0 $kpds5,$kpds6,0 ** convective cld top $comment"; - } - elsif ($kpds6 == 244) { - $out[$nvar++] = "${name}cvl 0 $kpds5,$kpds6,0 ** convective cld layer $comment"; - } - elsif ($kpds6 == 246) { - $out[$nvar++] = "${name}cvl 0 $kpds5,$kpds6,0 ** max e-pot-t level $comment"; - } - elsif ($kpds6 == 248) { - $out[$nvar++] = "${name}sccb 0 $kpds5,$kpds6,0 ** shallow convective cloud base $comment"; - } - elsif ($kpds6 == 249) { - $out[$nvar++] = "${name}scct 0 $kpds5,$kpds6,0 ** shallow convective cloud top $comment"; - } - elsif ($kpds6 == 251) { - $out[$nvar++] = "${name}dccb 0 $kpds5,$kpds6,0 ** deep convective cloud base $comment"; - } - elsif ($kpds6 == 252) { - $out[$nvar++] = "${name}dcct 0 $kpds5,$kpds6,0 ** deep convective cloud top $comment"; - } - elsif ($kpds6 == 117) { - if ($kpds7s =~ s/ 2 / /) { - $out[$nvar++] = "${name}pv2 0 $kpds5,$kpds6,2 ** pot vorticity = 2 units level $comment"; - } - if ($kpds7s =~ s/ 32770 / /) { - $out[$nvar++] = "${name}pvneg2 0 $kpds5,$kpds6,32770 ** pot vorticity = -2 units level $comment"; - } - if ($kpds7s =~ s/ 2000 / /) { - $out[$nvar++] = "${name}pv2 0 $kpds5,$kpds6,2000 ** pot vorticity = 2000 units level $comment"; - } - if ($kpds7s =~ s/ 34768 / /) { - $out[$nvar++] = "${name}pvneg2 0 $kpds5,$kpds6,34768 ** pot vorticity = -2000 units level $comment"; - } - } - elsif ($nlev == 1) { - # unknown single level - $kpds7s =~ s/^ //; - $out[$nvar++] = "${name}$tail 0 $kpds5,$kpds6,$kpds7s ** unknown level $comment"; - } - else { - foreach $ll (sort {$a <=> $b} split(' ',$kpds7s)) { - $out[$nvar++] = "${name}$tail$ll 0 $kpds5,$kpds6,$ll **level=$ll $comment"; - } - } -} - -print "vars $nvar\n"; -for ($i = 0; $i < $nvar; $i++) { - print $out[$i]; -} -print "ENDVARS\n"; - -if ($sys eq "win") { - unlink $TmpFile; -} -unlink $ListA; -exit 0; - -#------------------ jday -------------------- -# jday(year,mo,day) return the julian day relative to jan 0 -# mo=1..12 -# -sub jday { - - local($n); - local($nleap); - local($year1); - $n=substr(" 000 031 059 090 120 151 181 212 243 273 304 334",($_[1]-1)*4,4); - $n = $n + $_[2]; - $year1 = $_[0] - 1905; - - if ($calendar eq '365') { - $n += $year1 * 365; - } - else { - if ($_[1] > 2 && $_[0] % 4 == 0) { - if ($_[0] % 400 == 0 || $_[0] % 100 != 0) { - $n++; - } - } - $nleap = int($year1 / 4); - $n = $n + $nleap + $year1 * 365; - } - $n; -} - -#------------------ write tdef statement ------------------ -# still not great but better than before - -sub tdef { - - local($tmp); - local($n); - $n=$ntime; - if ($timestep) { $dt=$timestep } - else { - if ($ntime == 1) { - if ($timestep) { $dt=$timestep } - else { $dt="1mo"; } - } - elsif ($hour != $hour1) { - $tmp= (&jday($year1,$mo1,$day1) - &jday($year,$mo,$day)) * 24 + $hour1 - $hour; - $dt="${tmp}hr"; - $n = (&jday($year_last,$mo_last,$day_last) - &jday($year,$mo,$day)) * 24 + $hour_last - $hour; - $n = int($n / $tmp) + 1; - } - elsif ($day != $day1) { - # assume that dt < 365 days - $tmp = &jday($year1,$mo1,$day1) - &jday($year,$mo,$day); - $dt="${tmp}dy"; - $n=int((&jday($year_last,$mo_last,$day_last) - &jday($year,$mo,$day))/$tmp)+1; - } - elsif ($mo != $mo1) { - # assume that dt < 12 months - $tmp = $year1*12+$mo1 - $year*12-$mo; - $dt="${tmp}mo"; - $n = int(($year_last*12+$mo_last - $year*12 - $mo) / $tmp) + 1; - } - else { - $tmp = $year1 - $year; - $dt="${tmp}yr"; - $n = int(($year_last - $year) / $tmp) + 1; - } - } - if ($calendar eq "365") { - print "options 365_day_calendar\n"; - } - print "tdef $n linear ${hour}Z$day$month$year $dt\n"; -} - diff --git a/src/Conventional_Monitor/image_gen/ush/make_tdef.sh b/src/Conventional_Monitor/image_gen/ush/make_tdef.sh index b0d2018a..d46f04d9 100755 --- a/src/Conventional_Monitor/image_gen/ush/make_tdef.sh +++ b/src/Conventional_Monitor/image_gen/ush/make_tdef.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash #------------------ # make_tdef.sh diff --git a/src/Conventional_Monitor/image_gen/ush/mk_horz_hist.sh b/src/Conventional_Monitor/image_gen/ush/mk_horz_hist.sh index cd18e190..c6053882 100755 --- a/src/Conventional_Monitor/image_gen/ush/mk_horz_hist.sh +++ b/src/Conventional_Monitor/image_gen/ush/mk_horz_hist.sh @@ -1,17 +1,12 @@ -#!/bin/sh +#!/bin/bash #------------------------------------------------------------------ # # mk_horz_hist.sh # #------------------------------------------------------------------ -set -ax - - echo "--> mk_horz_hist.sh" - rc=0 - echo "CONMON_SUFFIX = $CONMON_SUFFIX" echo "C_TANKDIR = $C_TANKDIR" @@ -42,19 +37,20 @@ set -ax #------------------------------ # submit the plot_hist job #------------------------------ - jobname="${JOBNAME}_hist" plot_hist="${C_IG_SCRIPTS}/plot_hist.sh" + logfile="${C_LOGDIR}/plothist_${CONMON_SUFFIX}.${PDY}.${CYC}.log" - errfile="${C_LOGDIR}/plothist_${CONMON_SUFFIX}.${PDY}.${CYC}.err" - rm -f $logfile - rm -f $errfile + if [[ -e ${logfile} ]]; then + rm -f ${logfile} + fi - if [[ ${MY_MACHINE} = "wcoss_d" || ${MY_MACHINE} = "wcoss_c" ]]; then - ${SUB} -q ${JOB_QUEUE} -P ${PROJECT} -o ${logfile} -M 100 \ - -R affinity[core] -W 0:20 -J ${jobname} -cwd ${PWD} ${plot_hist} + errfile="${C_LOGDIR}/plothist_${CONMON_SUFFIX}.${PDY}.${CYC}.err" + if [[ -e ${errfile} ]]; then + rm -f ${errfile} + fi - elif [[ $MY_MACHINE = "hera" || $MY_MACHINE = "s4" || $MY_MACHINE = "jet" ]]; then + if [[ $MY_MACHINE = "hera" || $MY_MACHINE = "s4" || $MY_MACHINE = "jet" ]]; then ${SUB} -A ${ACCOUNT} --ntasks=1 --time=00:20:00 \ -p ${SERVICE_PARTITION} -J ${jobname} -o ${logfile} ${plot_hist} @@ -67,19 +63,20 @@ set -ax #------------------------------ # submit the plot_horz job #------------------------------ - jobname="${JOBNAME}_horz" plot_horz="${C_IG_SCRIPTS}/plot_horz.sh" + logfile="${C_LOGDIR}/plothorz_${CONMON_SUFFIX}.${PDY}.${CYC}.log" - errfile="${C_LOGDIR}/plothorz_${CONMON_SUFFIX}.${PDY}.${CYC}.err" - rm -f $logfile - rm -f $errfile + if [[ -e ${logfile} ]]; then + rm -f ${logfile} + fi - if [[ $MY_MACHINE = "wcoss_d" || ${MY_MACHINE} = "wcoss_c" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 300 \ - -R affinity[core] -W 0:20 -J ${jobname} -cwd ${PWD} ${plot_horz} + errfile="${C_LOGDIR}/plothorz_${CONMON_SUFFIX}.${PDY}.${CYC}.err" + if [[ -e ${errfile} ]]; then + rm -f ${errfile} + fi - elif [[ $MY_MACHINE = "hera" || $MY_MACHINE = "s4" || $MY_MACHINE = "jet" ]]; then + if [[ $MY_MACHINE = "hera" || $MY_MACHINE = "s4" || $MY_MACHINE = "jet" ]]; then ${SUB} -A ${ACCOUNT} --ntasks=1 --time=00:20:00 \ -p ${SERVICE_PARTITION} -J ${jobname} -o ${logfile} ${plot_horz} @@ -92,19 +89,20 @@ set -ax #------------------------------ # submit the plot_horz_uv job #------------------------------ - jobname="${JOBNAME}_horz_uv" plot_horz_uv="${C_IG_SCRIPTS}/plot_horz_uv.sh" + logfile="${C_LOGDIR}/plothorz_uv_${CONMON_SUFFIX}.${PDY}.${CYC}.log" - errfile="${C_LOGDIR}/plothorz_uv_${CONMON_SUFFIX}.${PDY}.${CYC}.err" - rm -f $logfile - rm -f $errfile + if [[ -e ${logfile} ]]; then + rm -f ${logfile} + fi - if [[ $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "wcoss_c" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 300 \ - -R affinity[core] -W 1:00 -J ${jobname} ${plot_horz_uv} + errfile="${C_LOGDIR}/plothorz_uv_${CONMON_SUFFIX}.${PDY}.${CYC}.err" + if [[ -e ${errfile} ]]; then + rm -f ${errfile} + fi - elif [[ $MY_MACHINE = "hera" || $MY_MACHINE = "s4" || $MY_MACHINE = "jet" ]]; then + if [[ $MY_MACHINE = "hera" || $MY_MACHINE = "s4" || $MY_MACHINE = "jet" ]]; then ${SUB} -A ${ACCOUNT} --ntasks=1 --time=01:30:00 \ -p ${SERVICE_PARTITION} -J ${jobname} -o ${logfile} ${plot_horz_uv} @@ -115,5 +113,5 @@ set -ax echo "<-- mk_horz_hist.sh" -exit ${rc} +exit diff --git a/src/Conventional_Monitor/image_gen/ush/mk_time_vert.sh b/src/Conventional_Monitor/image_gen/ush/mk_time_vert.sh index b4b6f361..a233a9cb 100755 --- a/src/Conventional_Monitor/image_gen/ush/mk_time_vert.sh +++ b/src/Conventional_Monitor/image_gen/ush/mk_time_vert.sh @@ -1,5 +1,4 @@ -#!/bin/sh -set -xa +#!/bin/bash #-------------------------------------------------- # @@ -9,37 +8,32 @@ set -xa echo "--> mk_time_vert.sh" - export nregion=10 - - echo "CONMON_SUFFIX = $CONMON_SUFFIX" - echo "C_TANKDIR = $C_TANKDIR" - echo "PDATE = $PDATE" - export PDY=`echo ${PDATE}|cut -c1-8` export CYC=`echo ${PDATE}|cut -c9-10` - - #-------------------------------------------- # submit time ps plots #-------------------------------------------- jobname="${JOBNAME}_time_ps" - logfile="${C_LOGDIR}/plot_time_ps_${CONMON_SUFFIX}.${PDY}.${CYC}.log" - errfile="${C_LOGDIR}/plot_time_ps_${CONMON_SUFFIX}.${PDY}.${CYC}.err" pltfile="${C_IG_SCRIPTS}/plot_time_ps.sh" - rm -f $logfile - rm -f $errfile - if [[ $MY_MACHINE == "wcoss_d" || ${MY_MACHINE} = "wcoss_c" ]]; then - $SUB -q ${JOB_QUEUE} -P ${PROJECT} -o ${logfile} -R affinity[core] \ - -M 100 -W 0:50 -J ${jobname} -cwd ${PWD} ${pltfile} + logfile="${C_LOGDIR}/plot_time_ps_${CONMON_SUFFIX}.${PDY}.${CYC}.log" + if [[ -e ${logfile} ]]; then + rm -f $logfile + fi + + errfile="${C_LOGDIR}/plot_time_ps_${CONMON_SUFFIX}.${PDY}.${CYC}.err" + if [[ -e ${errfile} ]]; then + rm -f $errfile + fi - elif [[ $MY_MACHINE == "hera" || $MY_MACHINE == "s4" || $MY_MACHINE == "jet" ]]; then + if [[ $MY_MACHINE == "hera" || $MY_MACHINE == "s4" || $MY_MACHINE == "jet" ]]; then ${SUB} -A ${ACCOUNT} --ntasks=1 --time=00:15:00 \ -p ${SERVICE_PARTITION} -J ${jobname} -o ${logfile} ${pltfile} elif [[ $MY_MACHINE = "wcoss2" ]]; then - $SUB -V -q $JOB_QUEUE -A $ACCOUNT -o ${logfile} -e ${logfile} -l walltime=50:00 -N ${jobname} \ + echo "submitting $jobname" + $SUB -V -q $JOB_QUEUE -A $ACCOUNT -o ${logfile} -e ${logfile} -l walltime=50:00 -N ${jobname} \ -l select=1:mem=200M ${pltfile} fi @@ -48,25 +42,20 @@ echo "--> mk_time_vert.sh" #-------------------------------------------- for type in gps q t uv; do jobname="${JOBNAME}_time_${type}" - logfile="${C_LOGDIR}/plot_time_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.log" - errfile="${C_LOGDIR}/plot_time_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.err" - pltfile="${C_IG_SCRIPTS}/plot_time.sh " export TYPE=${type} - rm -f $logfile - rm -f $errfile - - if [[ $MY_MACHINE == "wcoss_d" || ${MY_MACHINE} = "wcoss_c" ]]; then + pltfile="${C_IG_SCRIPTS}/plot_time.sh " - if [[ ${type} == "uv" || ${type} == "u" || ${type} == "v" ]]; then - walltime="02:30" - else - walltime="00:50" - fi + logfile="${C_LOGDIR}/plot_time_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.log" + if [[ -e ${logfile} ]]; then + rm -f $logfile + fi - $SUB -q ${JOB_QUEUE} -P ${PROJECT} -o ${logfile} -R affinity[core] \ - -M 100 -W ${walltime} -J ${jobname} -cwd ${PWD} ${pltfile} + errfile="${C_LOGDIR}/plot_time_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.err" + if [[ -e ${errfile} ]]; then + rm -f $errfile + fi - elif [[ $MY_MACHINE == "hera" || $MY_MACHINE == "s4" || $MY_MACHINE == "jet" ]]; then + if [[ $MY_MACHINE == "hera" || $MY_MACHINE == "s4" || $MY_MACHINE == "jet" ]]; then if [[ ${type} == "uv" || ${type} == "u" || ${type} == "v" ]]; then walltime="02:30:00" else @@ -77,12 +66,12 @@ echo "--> mk_time_vert.sh" -p ${SERVICE_PARTITION} -J ${jobname} -o ${logfile} ${pltfile} elif [[ $MY_MACHINE = "wcoss2" ]]; then - if [[ ${type} == "uv" || ${type} == "u" || ${type} == "v" ]]; then walltime="01:30:00" else walltime="50:00" fi + echo "submitting $jobname" $SUB -V -q $JOB_QUEUE -A $ACCOUNT -o ${logfile} -e ${logfile} -l walltime=${walltime}\ -N ${jobname} -l select=1:mem=200M ${pltfile} @@ -96,19 +85,21 @@ echo "--> mk_time_vert.sh" #-------------------------------------------- for type in q t uv u v; do + export TYPE=${type} jobname="${JOBNAME}_vert_${type}" - logfile="${C_LOGDIR}/plot_vert_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.log" - errfile="${C_LOGDIR}/plot_vert_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.err" pltfile="${C_IG_SCRIPTS}/plot_vert.sh " - export TYPE=${type} - rm -f $logfile - rm -f $errfile - if [[ $MY_MACHINE == "wcoss_d" || ${MY_MACHINE} = "wcoss_c" ]]; then - $SUB -q ${JOB_QUEUE} -P ${PROJECT} -o ${logfile} -R affinity[core] \ - -M 100 -W 1:30 -J ${jobname} -cwd ${PWD} ${pltfile} + logfile="${C_LOGDIR}/plot_vert_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.log" + if [[ -e ${logfile} ]]; then + rm -f $logfile + fi + + errfile="${C_LOGDIR}/plot_vert_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.err" + if [[ -e ${errfile} ]]; then + rm -f $errfile + fi - elif [[ $MY_MACHINE == "hera" || $MY_MACHINE == "s4" || $MY_MACHINE == "jet" ]]; then + if [[ $MY_MACHINE == "hera" || $MY_MACHINE == "s4" || $MY_MACHINE == "jet" ]]; then if [[ ${type} == "uv" || ${type} == "u" || ${type} == "v" ]]; then walltime="00:50:00" else @@ -119,6 +110,7 @@ echo "--> mk_time_vert.sh" -p ${SERVICE_PARTITION} -J ${jobname} -o ${logfile} ${pltfile} elif [[ $MY_MACHINE == "wcoss2" ]]; then + echo "submitting $jobname" $SUB -V -q $JOB_QUEUE -A $ACCOUNT -o ${logfile} -e ${logfile} -l walltime=50:00 \ -N ${jobname} -l select=1:mem=500M ${pltfile} diff --git a/src/Conventional_Monitor/image_gen/ush/plot_hist.sh b/src/Conventional_Monitor/image_gen/ush/plot_hist.sh index dbe19e4a..ef5774c9 100755 --- a/src/Conventional_Monitor/image_gen/ush/plot_hist.sh +++ b/src/Conventional_Monitor/image_gen/ush/plot_hist.sh @@ -1,5 +1,4 @@ -#!/bin/sh -set -ax +#!/bin/bash #------------------------------------------------------------ # Function getField returns the corresponding value for @@ -8,7 +7,6 @@ set -ax getField () { field='default' - echo "getField $1 $2" file=$1 field=$2 @@ -55,29 +53,32 @@ set -ax # plot scater image histographs # #--------------------------------------------------- - echo "---> plot_hist.sh" - export workdir=${C_PLOT_WORKDIR}/plothist - - export xsize=800 # add standard plot sizes to parms file? export ysize=600 - export PDY=`echo $PDATE|cut -c1-8` - export CYC=`echo $PDATE|cut -c9-10` - + export PDY=`echo ${PDATE}|cut -c1-8` + export CYC=`echo ${PDATE}|cut -c9-10` - rm -rf $workdir - mkdir -p $workdir - cd $workdir + workdir=${C_PLOT_WORKDIR}/plothist + if [[ -d ${workdir} ]]; then + rm -rf ${workdir} + fi + mkdir -p ${workdir} + cd ${workdir} - echo "C_TANKDIR = $C_TANKDIR" - hh_tankdir=${C_TANKDIR}/${RUN}.${PDY}/${CYC}/conmon/horz_hist + hh_tankdir=`$MON_USH/get_stats_path.sh --run $RUN --pdate ${PDATE} \ + --net ${CONMON_SUFFIX} --tank ${TANKDIR} --mon conmon` + hh_tankdir=${hh_tankdir}/horz_hist $UNCOMPRESS ${hh_tankdir}/anl/*.scater.*${Z} $UNCOMPRESS ${hh_tankdir}/ges/*.scater.*${Z} + outdir=${C_IMGNDIR}/pngs/hist/ + if [[ ! -d ${outdir} ]]; then + mkdir -p ${outdir} + fi for type in ps q t uv; do @@ -85,17 +86,12 @@ set -ax eval nreal=\${nreal_${type}} exec=conmon_read_${type}_IG.x - echo "stype, nreal, exec = $stype, $nreal, $exec" - - for dtype in ${stype}; do mtype=`echo ${dtype} | cut -f1 -d_` subtype=`echo ${dtype} | cut -f2 -d_` rm -f ./fileout - tankdir=${C_TANKDIR}/${RUN}.${PDY}/${CYC}/conmon - #------------------------------------------ # The GrADS plot scripts for horiz plots @@ -113,10 +109,10 @@ set -ax # Read scatter data and create a GrADS # data file for histogram generation. # - /bin/sh ${C_IG_SCRIPTS}/read_scatter.sh $CONMON_SUFFIX \ + /bin/bash ${C_IG_SCRIPTS}/read_scatter.sh $CONMON_SUFFIX \ $dtype $mtype $subtype $PDATE ${HOMEgdas_conmon}/fix \ ${nreal} ${exec} ${type} ${cycle} \ - ${hh_tankdir}/${cycle} ${C_IG_EXEC} + ${hh_tankdir}/${cycle} ${EXECconmon} #------------------------------------------ @@ -126,7 +122,6 @@ set -ax nlev_str=`cat grads_info_${dtype}_${cycle}.${PDATE} | grep nlev` nlev=`echo $nlev_str | gawk '{print $3}'` - echo "DEBUG: nlev = $nlev" sdir=" dset ^out_${dtype}_${cycle}.${PDATE}" title="title ${dtype} ${cycle}" @@ -195,11 +190,6 @@ set -ax -e "s/SDATE/$PDATE/" \ plot_hist.gs >plothist_${dtype}.gs - if [[ ! -d ${C_IMGNDIR}/pngs/hist/${CYC} ]]; then - mkdir -p ${C_IMGNDIR}/pngs/hist/${CYC} - fi - - if [ "${type}" = 'uv' ]; then @@ -303,22 +293,16 @@ set -ax echo 'quit' | grads -blc " run plothist_${dtype}.gs" rm fileout - img_files=`ls *hist*.png` - for imgf in $img_files; do - newf=`echo $imgf | sed -e "s/\./.${PDATE}./g"` - echo $newf - cp $imgf $newf - mv $newf ${C_IMGNDIR}/pngs/hist/. - done - -# if [[ $CONMON_SUFFIX != "v16rt2" ]]; then -# mv -f *hist*.png ${C_IMGNDIR}/pngs/hist/${CYC}/. -# fi - done ### dtype loop done ### type loop + img_files=`ls *hist*.png` + for imgf in $img_files; do + newf=`echo $imgf | sed -e "s/\./.${PDATE}./g"` + mv $imgf ${outdir}/$newf + done + $COMPRESS ${hh_tankdir}/anl/*.scater.* $COMPRESS ${hh_tankdir}/ges/*.scater.* diff --git a/src/Conventional_Monitor/image_gen/ush/plot_horz.sh b/src/Conventional_Monitor/image_gen/ush/plot_horz.sh index ca890d1d..9245dbb9 100755 --- a/src/Conventional_Monitor/image_gen/ush/plot_horz.sh +++ b/src/Conventional_Monitor/image_gen/ush/plot_horz.sh @@ -1,27 +1,23 @@ -#!/bin/sh +#!/bin/bash #---------------------------------------------------------------------------------------- # plot_horz.sh # # This produces the horizontal temperature images. #---------------------------------------------------------------------------------------- - - set -ax - date - echo "--> plot_horz.sh" - - rc=0 hh_tankdir=${C_TANKDIR}/${RUN}.${PDY}/${CYC}/conmon/horz_hist export xsize=x800 export ysize=y600 - export tmpdir_plothorz=${C_PLOT_WORKDIR}/plothorz - rm -rf $tmpdir_plothorz - mkdir -p $tmpdir_plothorz - cd $tmpdir_plothorz + workdir=${C_PLOT_WORKDIR}/plothorz + if [[ -d ${workdir} ]]; then + rm -rf ${workdir} + fi + mkdir -p ${workdir} + cd ${workdir} #---------------------------------------------------------------------- @@ -35,23 +31,12 @@ #---------------------------------------------------------------------- - # create the idx and ctl files for ges|anl grib|grib2 files + # create the idx and ctl files for ges|anl grib2 files #---------------------------------------------------------------------- - echo "grib2 = $grib2" - - if [[ $grib2 -eq 0 ]]; then # grib files - echo "handling grib files" - ${C_IG_SCRIPTS}/grib2ctl.pl anal.${PDATE} > anal.ctl - gribmap -i anal.ctl -0 - ${C_IG_SCRIPTS}/grib2ctl.pl -verf guess.${PDATE} > guess.ctl - gribmap -i guess.ctl - else # grib2 - echo "handling grib2 files" - ${C_IG_SCRIPTS}/g2ctl.pl -0 anal.$PDATE > anal.ctl - gribmap -0 -i anal.ctl - ${C_IG_SCRIPTS}/g2ctl.pl guess.$PDATE > guess.ctl - gribmap -i guess.ctl - fi + ${C_IG_SCRIPTS}/g2ctl.pl -0 anal.$PDATE > anal.ctl + gribmap -0 -i anal.ctl + ${C_IG_SCRIPTS}/g2ctl.pl guess.$PDATE > guess.ctl + gribmap -i guess.ctl #---------------------------------------------------------------------- @@ -70,7 +55,6 @@ eval stype=\${${type}_TYPE} eval nreal=\${nreal_${type}} - for dtype in ${stype}; do mtype=`echo ${dtype} | cut -f1 -d_` subtype=`echo ${dtype} | cut -f2 -d_` @@ -186,10 +170,10 @@ mkdir -p ${outdir} img_files=`ls *.png` - for imgf in $img_files; do + for imgf in ${img_files}; do newf=`echo $imgf | sed -e "s/\./.${PDATE}./g"` - cp $imgf $newf - mv $newf ${outdir}/. + cp ${imgf} ${newf} + mv ${newf} ${outdir}/. done done ### dtype loop @@ -198,13 +182,13 @@ if [[ ${C_IG_SAVE_WORK} -eq 0 ]]; then - cd $workdir + cd ${workdir} cd .. - rm -rf $workdir + rm -rf ${workdir} fi echo "<-- plot_horz.sh" -exit $rc +exit diff --git a/src/Conventional_Monitor/image_gen/ush/plot_horz_uv.sh b/src/Conventional_Monitor/image_gen/ush/plot_horz_uv.sh index cbe0d890..ad5686e5 100755 --- a/src/Conventional_Monitor/image_gen/ush/plot_horz_uv.sh +++ b/src/Conventional_Monitor/image_gen/ush/plot_horz_uv.sh @@ -1,55 +1,41 @@ -#!/bin/sh -set -ax +#!/bin/bash #--------------------------------------------------------------------- # # plot_horz_uv.sh # - # plot scater image for temperature #--------------------------------------------------------------------- echo "--> plot_horz_uv.sh" - rc=0 hh_tankdir=${C_TANKDIR}/${RUN}.${PDY}/${CYC}/conmon/horz_hist - export savedir=${hh_tankdir} - export workdir=${C_PLOT_WORKDIR}/plothorz_uv - rm -rf $workdir - mkdir -p $workdir - cd $workdir + workdir=${C_PLOT_WORKDIR}/plothorz_uv + if [[ -d ${workdir} ]]; then + rm -rf ${workdir} + fi + mkdir -p ${workdir} + cd ${workdir} export xsize=x800 export ysize=y600 - export NCP="cp -f" #---------------------------------------------------------------------- # Link in the analysis and guess data files #---------------------------------------------------------------------- - ${UNCOMPRESS} ${hh_tankdir}/anl/anal.${PDATE}.${Z} - ${UNCOMPRESS} ${hh_tankdir}/ges/guess.${PDATE}.${Z} + ${UNCOMPRESS} ${hh_tankdir}/anl/anal.${PDATE}.gz + ${UNCOMPRESS} ${hh_tankdir}/ges/guess.${PDATE}.gz ln -s ${hh_tankdir}/anl/anal.${PDATE} anal.${PDATE} ln -s ${hh_tankdir}/ges/guess.${PDATE} guess.${PDATE} #---------------------------------------------------------------------- - # create the idx and ctl files for ges|anl grib|grib2 files + # create the idx and ctl files for ges|anl grib2 files #---------------------------------------------------------------------- - echo "grib2 = $grib2" - - if [[ $grib2 -eq 0 ]]; then # grib files - echo "handling grib files" - ${C_IG_SCRIPTS}/grib2ctl.pl anal.${PDATE} > anal.ctl - gribmap -i anal.ctl -0 - ${C_IG_SCRIPTS}/grib2ctl.pl -verf guess.${PDATE} > guess.ctl - gribmap -i guess.ctl - else # grib2 - echo "handling grib2 files" - ${C_IG_SCRIPTS}/g2ctl.pl -0 anal.$PDATE > anal.ctl - gribmap -0 -i anal.ctl - ${C_IG_SCRIPTS}/g2ctl.pl guess.$PDATE > guess.ctl - gribmap -i guess.ctl - fi + ${C_IG_SCRIPTS}/g2ctl.pl -0 anal.$PDATE > anal.ctl + gribmap -0 -i anal.ctl + ${C_IG_SCRIPTS}/g2ctl.pl guess.$PDATE > guess.ctl + gribmap -i guess.ctl #---------------------------------------------------------------------- @@ -137,8 +123,8 @@ set -ax #-------------------------------------------------------------- grads_file=${hh_tankdir}/${cycle}/${dtype}.grads.${cycle}.${PDATE} - if [ -s ${grads_file}.${Z} ]; then - ${UNCOMPRESS} ${grads_file}.${Z} + if [ -s ${grads_file}.gz ]; then + ${UNCOMPRESS} ${grads_file}.gz ln -s ${grads_file} ${dtype}.grads.${cycle}.${PDATE} elif [ -s ${grads_file} ]; then @@ -153,7 +139,7 @@ set -ax done ## done with cycle - if [ ! -s $savedir/$cycle/${dtype}.grads.${cycle}.${PDATE} ]; then + if [ ! -s ${hh_tankdir}/$cycle/${dtype}.grads.${cycle}.${PDATE} ]; then continue fi @@ -174,27 +160,29 @@ set -ax outdir=${C_IMGNDIR}/pngs/horz - mkdir -p ${outdir} - + if [[ ! -d ${outdir} ]]; then + mkdir -p ${outdir} + fi + img_files=`ls *.png` for imgf in $img_files; do - newf=`echo $imgf | sed -e "s/\./.${PDATE}./g"` - cp $imgf ${C_IMGNDIR}/pngs/horz/${newf} + newf=`echo ${imgf} | sed -e "s/\./.${PDATE}./g"` + cp ${imgf} ${C_IMGNDIR}/pngs/horz/${newf} done done ### dtype loop done ### type loop - ${COMPRESS} ${hh_tankdir}/ges/* - ${COMPRESS} ${hh_tankdir}/anl/* + ${COMPRESS} ${hh_tankdir}/ges/*grads* + ${COMPRESS} ${hh_tankdir}/anl/*grads* if [[ ${C_IG_SAVE_WORK} -eq 0 ]]; then - cd $workdir + cd ${workdir} cd .. - rm -rf $workdir + rm -rf ${workdir} fi echo "<-- plot_horz_uv.sh" -exit $rc +exit diff --git a/src/Conventional_Monitor/image_gen/ush/plot_time.sh b/src/Conventional_Monitor/image_gen/ush/plot_time.sh index 8cdf0a73..fec54171 100755 --- a/src/Conventional_Monitor/image_gen/ush/plot_time.sh +++ b/src/Conventional_Monitor/image_gen/ush/plot_time.sh @@ -1,5 +1,4 @@ -#!/bin/sh -set -ax +#!/bin/bash #---------------------------------------------------------- # @@ -24,16 +23,15 @@ function large_mv () { } - type=${TYPE} + echo "--> plot_time.sh, type=${TYPE}" - echo "--> plot_time.sh, type=${type}" - - workdir=${C_PLOT_WORKDIR}/plottime_${type} - rm -rf $workdir - mkdir -p $workdir - cd $workdir + workdir=${C_PLOT_WORKDIR}/plottime_${TYPE} + if [[ -d ${workdir} ]]; then + rm -rf ${workdir} + fi + mkdir -p ${workdir} + cd ${workdir} - rc=0 pdy=`echo $PDATE|cut -c1-8` cyc=`echo $PDATE|cut -c9-10` tv_tankdir=${C_TANKDIR}/${RUN}.${pdy}/${cyc}/conmon/time_vert @@ -57,7 +55,7 @@ function large_mv () { if [[ -d ${C_TANKDIR}/${RUN}.${day}/${dcyc}/conmon ]]; then for cycle in ges anl; do - data_file=${cycle}_${type}_stas.${cdate} + data_file=${cycle}_${TYPE}_stas.${cdate} data_fp=${C_TANKDIR}/${RUN}.${day}/${dcyc}/conmon/time_vert/${data_file} if [[ -e ${data_fp}.${Z} ]]; then cp -f ${data_fp}.${Z} ./${data_file}.${Z} @@ -79,7 +77,7 @@ function large_mv () { #--------------------------------------------------- for cycle in ges anl; do - ctl_file=${tv_tankdir}/${cycle}_${type}_stas.ctl + ctl_file=${tv_tankdir}/${cycle}_${TYPE}_stas.ctl if [[ -e ${ctl_file}.${Z} ]]; then cp -f ${ctl_file}.${Z} tmp.ctl.${Z} ${UNCOMPRESS} tmp.ctl.${Z} @@ -87,13 +85,13 @@ function large_mv () { cp -f ${ctl_file} tmp.ctl fi - new_dset="dset ${cycle}_${type}_stas.%y4%m2%d2%h2" + new_dset="dset ${cycle}_${TYPE}_stas.%y4%m2%d2%h2" tdef=`${C_IG_SCRIPTS}/make_tdef.sh ${START_DATE} ${NUM_CYCLES} 06` echo "tdef = $tdef" sed -e "s/^dset*/${new_dset}/" tmp.ctl >tmp2.ctl - sed -e "s/^tdef.*/${tdef}/" tmp2.ctl >${cycle}_${type}_stas.ctl + sed -e "s/^tdef.*/${tdef}/" tmp2.ctl >${cycle}_${TYPE}_stas.ctl rm -f tmp.ctl rm -f tmp2.ctl done @@ -112,7 +110,7 @@ function large_mv () { #--------------------------------------------------- for script in plotstas_time_count.gs plotstas_time_bias.gs ;do - if [[ ${type} = 'gps' && ${script} = 'plotstas_time_bias.gs' ]]; then + if [[ ${TYPE} = 'gps' && ${script} = 'plotstas_time_bias.gs' ]]; then continue fi @@ -121,17 +119,16 @@ function large_mv () { if [[ -s ${plot_script} ]]; then cp -f ${plot_script} . else - rc=9 echo "unable to find ${plot_script}, exiting" - exit ${rc} + exit 9 fi #-------------------------------- - # modify plot script for type + # modify plot script for TYPE #-------------------------------- base_name=`echo "${script}" | awk -F. '{print $1}'` - local_plot_script=${base_name}_${type}.gs - sed -e "s/DTYPE/$type/" \ + local_plot_script=${base_name}_${TYPE}.gs + sed -e "s/DTYPE/$TYPE/" \ ${script} > ${local_plot_script} #------------------------- @@ -151,12 +148,12 @@ function large_mv () { if [[ ${C_IG_SAVE_WORK} -eq 0 ]]; then - cd $workdir + cd ${workdir} cd .. - rm -rf $workdir + rm -rf ${workdir} fi - echo "<-- plot_time.sh, type=${type}" + echo "<-- plot_time.sh" exit diff --git a/src/Conventional_Monitor/image_gen/ush/plot_time_ps.sh b/src/Conventional_Monitor/image_gen/ush/plot_time_ps.sh index 71489d2f..de97b4fa 100755 --- a/src/Conventional_Monitor/image_gen/ush/plot_time_ps.sh +++ b/src/Conventional_Monitor/image_gen/ush/plot_time_ps.sh @@ -1,5 +1,4 @@ -#!/bin/sh -set -ax +#!/bin/bash #---------------------------------------------------------------------- # plot_time_ps.sh @@ -13,11 +12,12 @@ set -ax echo "NDATE = $NDATE" workdir=${C_PLOT_WORKDIR}/plottime_ps - rm -rf $workdir - mkdir -p $workdir - cd $workdir + if [[ -d ${workdir} ]]; then + rm -rf ${workdir} + fi + mkdir -p ${workdir} + cd ${workdir} - rc=0 pdy=`echo $PDATE|cut -c1-8` cyc=`echo $PDATE|cut -c9-10` tv_tankdir=${C_TANKDIR}/${RUN}.${pdy}/${cyc}/conmon/time_vert @@ -29,9 +29,9 @@ set -ax # plot surface pressure time series counts #--------------------------------------------------- - cp -f ${C_IG_GSCRIPTS}/plotstas_time_count_ps.gs . - cp -f ${C_IG_GSCRIPTS}/plotstas_time_bias_ps.gs . -# cp -f ${C_IG_GSCRIPTS}/plotstas_time_bias2_ps.gs . + ${NCP} ${C_IG_GSCRIPTS}/plotstas_time_count_ps.gs . + ${NCP} ${C_IG_GSCRIPTS}/plotstas_time_bias_ps.gs . +# ${NCP} ${C_IG_GSCRIPTS}/plotstas_time_bias2_ps.gs . #--------------------------------------------------- # Link in the data files. @@ -98,31 +98,27 @@ set -ax #------------------------- grads -bpc "run ./plotstas_time_count_ps.gs" -# mv -f *.png ${outdir}/. grads -bpc "run ./plotstas_time_bias_ps.gs" -# mv -f *.png ${outdir}/. # grads -bpc "run ./plotstas_time_bias2_ps.gs" img_files=`ls *.png` - for imgf in $img_files; do - newf=`echo $imgf | sed -e "s/\./.${PDATE}./g"` - cp $imgf $newf - mv $newf ${C_IMGNDIR}/pngs/time/. + for imgf in ${img_files}; do + newf=`echo ${imgf} | sed -e "s/\./.${PDATE}./g"` + cp ${imgf} ${newf} + mv ${newf} ${C_IMGNDIR}/pngs/time/. done - if [[ $CONMON_SUFFIX != "v16rt2" ]]; then - mv -f *.png ${outdir}/. - fi + mv -f *.png ${outdir}/. if [[ ${C_IG_SAVE_WORK} -eq 0 ]]; then - cd $workdir + cd ${workdir} cd .. - rm -rf $workdir + rm -rf ${workdir} fi echo "<--- plot_time_ps.sh" diff --git a/src/Conventional_Monitor/image_gen/ush/plot_vert.sh b/src/Conventional_Monitor/image_gen/ush/plot_vert.sh index 2b677660..fb942bb8 100755 --- a/src/Conventional_Monitor/image_gen/ush/plot_vert.sh +++ b/src/Conventional_Monitor/image_gen/ush/plot_vert.sh @@ -1,22 +1,19 @@ -#!/bin/sh -set -ax +#!/bin/bash #------------------------------------------------------- # # plot_vert.sh # #------------------------------------------------------- - echo "--> plot_vert.sh " - type=${TYPE} - - workdir=${C_PLOT_WORKDIR}/plotvert_${type} - rm -rf $workdir - mkdir -p $workdir - cd $workdir + workdir=${C_PLOT_WORKDIR}/plotvert_${TYPE} + if [[ -d ${workdir} ]]; then + rm -rf ${workdir} + fi + mkdir -p ${workdir} + cd ${workdir} - rc=0 pdy=`echo ${PDATE}|cut -c1-8` dday=`echo $PDATE|cut -c7-8` cyc=`echo ${PDATE}|cut -c9-10` @@ -38,7 +35,7 @@ set -ax if [[ -d ${C_TANKDIR}/${RUN}.${day}/${dcyc}/conmon ]]; then for cycle in ges anl; do - stas_file=${C_TANKDIR}/${RUN}.${day}/${dcyc}/conmon/time_vert/${cycle}_${type}_stas.${cdate} + stas_file=${C_TANKDIR}/${RUN}.${day}/${dcyc}/conmon/time_vert/${cycle}_${TYPE}_stas.${cdate} if [[ -s ${stas_file}.${Z} ]]; then ${UNCOMPRESS} ${stas_file}.${Z} @@ -60,7 +57,7 @@ set -ax #--------------------------------------------------- for cycle in ges anl; do - ctl_file=${tv_tankdir}/${cycle}_${type}_stas.ctl + ctl_file=${tv_tankdir}/${cycle}_${TYPE}_stas.ctl if [[ -e ${ctl_file}.${Z} ]]; then cp -f ${ctl_file}.${Z} tmp.ctl.${Z} @@ -69,14 +66,14 @@ set -ax cp -f ${ctl_file} tmp.ctl fi - new_dset=" dset ${cycle}_${type}_stas.%y4%m2%d2%h2" + new_dset=" dset ${cycle}_${TYPE}_stas.%y4%m2%d2%h2" num_cycles=${NUM_CYCLES} tdef=`${C_IG_SCRIPTS}/make_tdef.sh ${START_DATE} ${num_cycles} 06` echo "tdef = $tdef" sed -e "s/^dset*/${new_dset}/" tmp.ctl >tmp2.ctl - sed -e "s/^tdef.*/${tdef}/" tmp2.ctl >${cycle}_${type}_stas.ctl + sed -e "s/^tdef.*/${tdef}/" tmp2.ctl >${cycle}_${TYPE}_stas.ctl rm -f tmp.ctl rm -f tmp2.ctl done @@ -92,16 +89,14 @@ set -ax #--------------------------------------------------- # copy plots scripts locally, modify, and run #--------------------------------------------------- - for script in page.gs rgbset2.gs setvpage.gs ;do plot_script=${C_IG_GSCRIPTS}/${script} if [[ -s ${plot_script} ]]; then cp -f ${plot_script} . else - rc=10 echo "unable to find ${plot_script}, exiting" - exit ${rc} + exit 10 fi done @@ -111,17 +106,16 @@ set -ax if [[ -s ${plot_script} ]]; then cp -f ${plot_script} . else - rc=11 echo "unable to find ${plot_script}, exiting" - exit ${rc} + exit 11 fi #-------------------------------- - # modify plot script for type + # modify plot script for TYPE #-------------------------------- base_name=`echo "${script}" | awk -F. '{print $1}'` - local_plot_script=${base_name}_${type}.gs - sed -e "s/DTYPE/${type}/" \ + local_plot_script=${base_name}_${TYPE}.gs + sed -e "s/DTYPE/${TYPE}/" \ -e "s/HOUR/${cyc}/" \ -e "s/DDAY/${dday}/" \ ${script} > ${local_plot_script} @@ -137,15 +131,12 @@ set -ax mv $newf ${C_IMGNDIR}/pngs/vert/. done - if [[ $CONMON_SUFFIX != "v16rt2" ]]; then - mv -f *.png ${outdir}/. - fi - + mv -f *.png ${outdir}/. if [[ ${C_IG_SAVE_WORK} -eq 0 ]]; then - cd $workdir + cd ${workdir} cd .. - rm -rf $workdir + rm -rf ${workdir} fi diff --git a/src/Conventional_Monitor/image_gen/ush/read_scatter.sh b/src/Conventional_Monitor/image_gen/ush/read_scatter.sh index 302cf8e1..c25efd52 100755 --- a/src/Conventional_Monitor/image_gen/ush/read_scatter.sh +++ b/src/Conventional_Monitor/image_gen/ush/read_scatter.sh @@ -1,5 +1,5 @@ -#!/bin/sh -set -xa +#!/bin/bash + #----------------------------------------------------------------------------------- # # read_scatter.sh @@ -8,34 +8,18 @@ set -xa # and generate an out_${mtype) data file and # control file for GrADS. #----------------------------------------------------------------------------------- - -echo "---> read_scatter.sh" -echo " CONMON_SUFFIX = $CONMON_SUFFIX" - exp=$1 -echo "exp set to $exp" dtype=$2 -echo "dtype set to $dtype" mtype=$3 -echo "mtype set to $mtype" subtype=$4 -echo "subtype set to $subtype" rdate=$5 -echo "rdate set to $rdate" fixdir=$6 -echo "fixdir set to $fixdir" nreal=$7 -echo "nreal set to $nreal" exec=$8 -echo "exec set to $exec" type=$9 -echo "type set to $type" cycle=${10} -echo "cycle set to $cycle" datadir=${11} -echo "datadir set to $datadir" sorcdir=${12} -echo "sorcdir set to $sorcdir" ## set up the directory with excutable files @@ -69,9 +53,6 @@ cp $sorcdir/$exec ./$exec ./$exec stdout_${dtype}_${cycle}.${rdate} 2>&1 -#rm -f $exec -#rm -f input - if [ "${type}" = 'uv' ]; then mv out_u out_${dtype}_u_${cycle}.${rdate} @@ -85,5 +66,4 @@ if [ "${type}" = 'uv' ]; then fi -echo "<--- read_scatter.sh" exit diff --git a/src/Conventional_Monitor/image_gen/ush/transfer_imgs.sh b/src/Conventional_Monitor/image_gen/ush/transfer_imgs.sh index 2107e795..ac170618 100755 --- a/src/Conventional_Monitor/image_gen/ush/transfer_imgs.sh +++ b/src/Conventional_Monitor/image_gen/ush/transfer_imgs.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash echo begin transfer_imgs.sh @@ -8,8 +8,8 @@ if [[ ${C_IMGNDIR} != "/" ]]; then echo "WEBUSER = $WEBUSER" echo "WEBSVR = $WEBSVR" echo "WEBDIR = $WEBDIR" - - if [[ $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "cray" ]]; then + + if [[ $MY_MACHINE = "wcoss2" ]]; then /usr/bin/rsync -ave ssh --exclude *.ctl.${Z} --delete-during ${C_IMGNDIR}/ \ ${WEBUSER}@${WEBSVR}.ncep.noaa.gov:${WEBDIR}/ fi diff --git a/src/Conventional_Monitor/parm/ConMon_config b/src/Conventional_Monitor/parm/ConMon_config index 5db07c98..201b4cbd 100644 --- a/src/Conventional_Monitor/parm/ConMon_config +++ b/src/Conventional_Monitor/parm/ConMon_config @@ -39,22 +39,16 @@ export C_IMGNDIR=${TANKDIR}/imgn/${CONMON_SUFFIX}/${RUN}/conmon # MAIL_TO and MAIL_CC specifies the default # distribution for warning messages. # -# export DO_DATA_RPT=${DO_DATA_RPT:-1} + export DO_DATA_RPT=${DO_DATA_RPT:-1} -# export MAIL_TO=${MAIL_TO:-"edward.safford@noaa.gov"} -# if [[ -e /u/${LOGNAME}/bin/get_cc_list.pl ]]; then -# cc_list=`/u/${LOGNAME}/bin/get_cc_list.pl --nr ${CONMON_SUFFIX}_${RUN} --mon ConMon` -# else -# cc_list="" -# fi -# export MAIL_CC=${MAIL_CC:=${cc_list}} - - - #----------------------------------------------------- - # The grib2 flag indicates if the data files are in - # grib2 format (1) or grib (0) - # -# export grib2=${grib2:-1} + export MAIL_TO=${MAIL_TO:-"edward.safford@noaa.gov"} + if [[ -e /u/${LOGNAME}/bin/get_cc_list.pl ]]; then + cc_list=`/u/${LOGNAME}/bin/get_cc_list.pl --nr ${CONMON_SUFFIX}_${RUN} --mon ConMon` + else + cc_list="" + fi + MAIL_CC="" + export MAIL_CC=${MAIL_CC:=${cc_list}} #--------------------------------------------------------------------- @@ -101,21 +95,21 @@ export C_LOGDIR=${MON_LOGDIR}/${CONMON_SUFFIX}/${RUN}/conmon # export C_DE_PARM=${C_DE_PARM:-${CONMON_DATA_EXTRACT}/parm} # export C_DE_SCRIPTS=${C_DE_SCRIPTS:-${CONMON_DATA_EXTRACT}/ush} # -# export CONMON_IMAGE_GEN=${CONMON_IMAGE_GEN:-${MY_CONMON}/image_gen} + export CONMON_IMAGE_GEN=${CONMON_IMAGE_GEN:-${MY_CONMON}/image_gen} # export C_IG_EXEC=${C_IG_EXEC:-${CONMON_IMAGE_GEN}/exec} -# export C_IG_GSCRIPTS=${C_IG_GSCRIPTS:-${CONMON_IMAGE_GEN}/gscripts} + export C_IG_GSCRIPTS=${C_IG_GSCRIPTS:-${CONMON_IMAGE_GEN}/gscripts} # export C_IG_PARM=${C_IG_PARM:-${CONMON_IMAGE_GEN}/parm} -# export C_IG_SCRIPTS=${C_IG_SCRIPTS:-${CONMON_IMAGE_GEN}/ush} -# export C_IG_FIX=${C_IG_FIX:-${CONMON_IMAGE_GEN}/fix} + export C_IG_SCRIPTS=${C_IG_SCRIPTS:-${CONMON_IMAGE_GEN}/ush} + export C_IG_FIX=${C_IG_FIX:-${CONMON_IMAGE_GEN}/fix} # export C_IG_HTML=${C_IG_HTML:-${CONMON_IMAGE_GEN}/html} # export C_IG_SAVE_WORK=${C_IG_SAVE_WORK:-1} # switch to save plot work directories # # export CONMON_PARM=${CONMON_PARM:-${MY_CONMON}/parm} -# + export HOMEconmon_shared=${HOMEconmon_shared:-${MY_CONMON}/nwprod/conmon_shared} export HOMEgdas_conmon=${HOMEgdas_conmon:-${MY_CONMON}/nwprod/gdas_conmon} -# export HOMEgfs_conmon=$HOMEgdas_conmon -# + export HOMEgfs_conmon=$HOMEgdas_conmon + export USHconmon=${USHconmon:-${HOMEconmon_shared}/ush} export EXECconmon=${EXECconmon:-${GSI_MON_BIN}} diff --git a/ush/find_last_cycle.sh b/ush/find_last_cycle.sh index 4b9af5f6..d6663926 100755 --- a/ush/find_last_cycle.sh +++ b/ush/find_last_cycle.sh @@ -85,6 +85,9 @@ case $monitor in oznmon) search="*ieee_d*" ;; + conmon) + search="time_vert" + ;; esac