#!/bin/tcsh -f # +-======-+ # Copyright (c) 2003-2007 United States Government as represented by # the Admistrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE, # REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN # COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT AS # REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT AGENCY"). # THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN # INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT DISTRIBUTIONS OR # REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO USES, REPRODUCES, # DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED # HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION, ACCEPTING IN FULL THE # RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT. # # Government Agency: National Aeronautics and Space Administration # Government Agency Original Software Designation: GSC-15354-1 # Government Agency Original Software Title: GEOS-5 GCM Modeling Software # User Registration Requested. Please Visit http://opensource.gsfc.nasa.gov # Government Agency Point of Contact for Original Software: # Dale Hithon, SRA Assistant, (301) 286-2691 # # +-======-+ if ( ! $?GEOSUTIL ) then echo " " echo Environment variable GEOSUTIL must be defined before use! echo Set GEOSUTIL to the directory path of the GEOS_util module echo " " exit 1 endif @ nmax = $#argv # Usage # ----- if( $nmax == 0 ) then echo " " echo "Usage:" echo "-----" echo "quickplot -source SOURCE_DIRECTORY" echo " -season SEASON" echo " [-cmpexp CMPEXP_DIRECTORY]" echo " [-begdate BEGDATE]" echo " [-enddate ENDDATE]" echo " [-type TYPE]" echo " [-plots PLOTS]" echo " [-noplot NOPLOTS]" echo " [-plotsdir PLOTSDIR]" echo " [-hist HISTORY_DIRECTORY]" echo " [-rc HISTORY.rc]" echo " [-clim CLIM]" echo " [-taylor TAYLOR]" echo " [-ana ANALYSIS]" echo " [-std STD_DEV ]" echo " [-gradsx GRADSX]" echo " " echo "where: SOURCE_DIRECTORY: is the source directory for experiment" echo " SEASON: is the season to plot (eg. DJF, JAN)" echo " CMPEXP_DIRECTORY: are the experiment directory(s) to be used for comparison (Default: None)" echo " BEGDATE: is the YYYYMM to begin time average (Default: Begin Date in File)" echo " ENDDATE: is the YYYYMM to end time average (Default: End Date in File)" echo " TYPE: 1 for quickplot1, 2 for quickplot2 (Default: BOTH)" echo " PLOTS: prog surf moist turb rad gwd (Default: ALL)" echo " NOPLOTS: Any plot(s) you wish to skip (useful with ALL) (Default: NONE)" echo " PLOTSDIR: is the directory to write plots into (Default: SOURCE_DIRECTORY/plots)" echo " HISTORY_DIRECTORY: is the directory containing the HISTORY.rc file (Default: SOURCE_DIRECTORY)" echo " HISTORY.rc: is the full path (including filename) " echo " of the desired rc file to use (Default: SOURCE_DIRECTORY/HISTORY.rc)" echo " CLIM: Logical for using Climatology or Actual Dates (Default: CLIM = TRUE)" echo " TAYLOR: Logical for producing Taylor Plots (Default: TAYLOR = TRUE)" echo " ANALYSIS: Logical for producing Analysis Contour Levels (Default: ANALYSIS = FALSE)" echo " STD_DEV: Logical for producing Standard Deviation Plots (Default: STD_DEV = FALSE)" echo " GRADSX: GrADS executable to use for processing (Default: GRADSX = gradsnc4)" echo " " exit 1 endif # Set Variables # ------------- set debug = false set type = ALL set plots = ALL set plotsdir = NULL set hist = xxx set rc = HISTORY.rc set clim = true set taylor = true set analysis = false set std_dev = false set begdate = NULL set enddate = NULL set cmpexp = NULL set move = false set gradsx = gradsnc4 set noplot = "" # Parse command line # ------------------ @ n = 1 while( $n <= $nmax ) if( "$argv[$n]" == "-source" ) then @ n = $n + 1 set source = $argv[$n] endif if( "$argv[$n]" == "-plotsdir" ) then @ n = $n + 1 set plotsdir = $argv[$n] endif if( "$argv[$n]" == "-hist" ) then @ n = $n + 1 set hist = $argv[$n] endif if( "$argv[$n]" == "-rc" ) then @ n = $n + 1 set rc = $argv[$n] endif if( "$argv[$n]" == "-begdate" ) then @ n = $n + 1 set begdate = $argv[$n] endif if( "$argv[$n]" == "-enddate" ) then @ n = $n + 1 set enddate = $argv[$n] endif if( "$argv[$n]" == "-clim" ) then @ n = $n + 1 set clim = $argv[$n] endif if( "$argv[$n]" == "-type" ) then @ n = $n + 1 set type = $argv[$n] endif if( "$argv[$n]" == "-taylor" ) then @ n = $n + 1 set taylor = $argv[$n] endif if( "$argv[$n]" == "-gradsx" ) then @ n = $n + 1 set gradsx = $argv[$n] endif if( "$argv[$n]" == "-std" ) set std_dev = true if( "$argv[$n]" == "-ana" ) set analysis = true if( "$argv[$n]" == "-debug" ) set debug = true if( "$argv[$n]" == "-move" ) set move = true if( "$argv[$n]" == "-cmpexp" ) then @ n = $n + 1 set cmpexp = "" set next = $argv[$n] set bit = `echo $next | cut -c1-1` while( "$bit" != "-" ) set cmpexp = `echo $cmpexp $next` @ n = $n + 1 if( $n <= $nmax ) then set next = $argv[$n] set bit = `echo $next | cut -c1-1` else set bit = "-" endif end @ n = $n - 1 endif if( "$argv[$n]" == "-plots" ) then @ n = $n + 1 set plots = "" set next = $argv[$n] set bit = `echo $next | cut -c1-1` while( "$bit" != "-" ) set plots = `echo $plots $next` @ n = $n + 1 if( $n <= $nmax ) then set next = $argv[$n] set bit = `echo $next | cut -c1-1` else set bit = "-" endif end @ n = $n - 1 endif if( "$argv[$n]" == "-noplot" ) then @ n = $n + 1 set noplot = "" set next = $argv[$n] set bit = `echo $next | cut -c1-1` while( "$bit" != "-" ) set noplot = `echo $noplot $next` @ n = $n + 1 if( $n <= $nmax ) then set next = $argv[$n] set bit = `echo $next | cut -c1-1` else set bit = "-" endif end @ n = $n - 1 endif if( "$argv[$n]" == "-season" ) then @ n = $n + 1 set seasons = "" set next = $argv[$n] set bit = `echo $next | cut -c1-1` while( "$bit" != "-" ) set seasons = `echo $seasons $next` @ n = $n + 1 if( $n <= $nmax ) then set next = $argv[$n] set bit = `echo $next | cut -c1-1` else set bit = "-" endif end @ n = $n - 1 endif @ n = $n + 1 end # Prepare Environment # --------------------- setenv SOURCE $source setenv CLIM $clim setenv TAYLOR $taylor setenv ANALYSIS $analysis setenv STD_DEV $std_dev setenv TBEG $begdate setenv TEND $enddate setenv GRADSX $gradsx if( $hist == xxx ) set hist = $source if( $rc == HISTORY.rc ) then setenv HISTORYRC ${hist}/$rc else setenv HISTORYRC $rc endif if( $cmpexp[1] != "NULL" ) then setenv CMPEXP `echo $cmpexp NULL` else setenv CMPEXP `echo $cmpexp` endif if( $TBEG != NULL ) setenv CLIM false if( $TEND != NULL ) setenv CLIM false # Break Large Plot Segments into Smaller Plot Segments (for speed) # ---------------------------------------------------------------- set plotz = "" if( $plots[1] != ALL ) then foreach plot ($plots) if( $plot == moist ) set plotz = `echo $plotz moist.1 moist.2 moist.3 moist.4` if( $plot == tend ) set plotz = `echo $plotz tend.1 tend.2 tend.3 tend.4 tend.5` if( $plot == turb ) set plotz = `echo $plotz turb.1 turb.2` if( $plot == surf ) set plotz = `echo $plotz surf.1 surf2.misc surf2.cld` if( $plot == gwd ) set plotz = `echo $plotz gwd` if( $plot == rad ) set plotz = `echo $plotz rad.1 rad.sw rad.lw` if( $plot == energy ) set plotz = `echo $plotz energy` if( $plot == tseries ) set plotz = `echo $plotz tseries` if( $plot == taylor ) set plotz = `echo $plotz taylor` if( $plot == quad ) set plotz = `echo $plotz hquad zquad` if( $plot == gmichem ) set plotz = `echo $plotz gmi.1` if( $plot == gocart ) set plotz = `echo $plotz gocart.1` if( $plot == prog ) then set plotz = `echo $plotz residual` set HEXPORTS = "SLP U V T ZLE HE Q RH2 OMEGA CHI PSI" foreach HEXPORT ($HEXPORTS) set plotz = `echo $plotz progh_$HEXPORT` end set VEXPORTS = "ZLE SLP U V T Q RH2" foreach VEXPORT ($VEXPORTS) set plotz = `echo $plotz linez1_$VEXPORT` end set VEXPORTS = "U V T RH2" foreach VEXPORT ($VEXPORTS) set plotz = `echo $plotz progz1_$VEXPORT` end set VEXPORTS = "U V T Q RH2 ZLE OMEGA" foreach VEXPORT ($VEXPORTS) set plotz = `echo $plotz progz2_$VEXPORT` end endif if( $plot == progh ) then set HEXPORTS = "SLP U V T ZLE HE Q RH2 OMEGA CHI PSI" foreach HEXPORT ($HEXPORTS) set plotz = `echo $plotz progh_$HEXPORT` end endif if( $plot == progz ) then set VEXPORTS = "ZLE SLP U V T Q RH2" foreach VEXPORT ($VEXPORTS) set plotz = `echo $plotz linez1_$VEXPORT` end set VEXPORTS = "U V T RH2" foreach VEXPORT ($VEXPORTS) set plotz = `echo $plotz progz1_$VEXPORT` end set VEXPORTS = "U V T Q RH2 ZLE OMEGA" foreach VEXPORT ($VEXPORTS) set plotz = `echo $plotz progz2_$VEXPORT` end endif if( $plot == linez ) then set VEXPORTS = "ZLE SLP U V T Q RH2" foreach VEXPORT ($VEXPORTS) set plotz = `echo $plotz linez1_$VEXPORT` end endif if( $plot == residual ) set plotz = `echo $plotz residual` end foreach skip ( $noplot ) set plotz = `echo $plotz | sed -e "s/$skip//"` end else set plotz = "taylor moist.1 moist.2 moist.3 moist.4 tend.1 tend.2 tend.3 tend.4 tend.5 turb.1 turb.2 surf.1 surf2.misc surf2.cld gwd rad.1 rad.sw rad.lw energy tseries hquad zquad prog.1" # Allow user to skip specific plot(s) # ----------------------------------- foreach skip ( $noplot ) set plotz = `echo $plotz | sed -e "s/$skip//"` end if ( "$plotz" =~ *prog.1* ) then set plotz = `echo $plotz residual` set HEXPORTS = "SLP U V T ZLE HE Q RH2 OMEGA CHI PSI" foreach HEXPORT ($HEXPORTS) set plotz = `echo $plotz progh_$HEXPORT` end set VEXPORTS = "ZLE SLP U V T Q RH2" foreach VEXPORT ($VEXPORTS) set plotz = `echo $plotz linez1_$VEXPORT` end set VEXPORTS = "U V T RH2" foreach VEXPORT ($VEXPORTS) set plotz = `echo $plotz progz1_$VEXPORT` end set VEXPORTS = "U V T Q RH2 ZLE OMEGA" foreach VEXPORT ($VEXPORTS) set plotz = `echo $plotz progz2_$VEXPORT` end endif foreach skip ( $noplot ) set plotz = `echo $plotz | sed -e "s/$skip//"` end endif if( $plotz[1] != "" ) set plots = `echo $plotz` echo " " echo "plots = " $plots echo "season = " $seasons echo "debug = " $debug echo " " # Extract EXPID from Source Directory (assuming last node) # -------------------------------------------------------- set expid = `basename $source` # Make Output Directory for Plots # ------------------------------- if( $plotsdir != NULL ) then set plots_dir = $plotsdir else set plots_dir = $source/plots endif if( ! -e $plots_dir ) mkdir -p $plots_dir # Configure QUICKPLOT to Computing Platform # ----------------------------------------- cd $plots_dir $GEOSUTIL/plots/configure source $plots_dir/.quickplotrc echo " GRADS = " $GRADS echo " ARCH = " `uname` echo " HOST = " `hostname` echo " GEOSUTIL = " $GEOSUTIL echo " SOURCE = " $SOURCE echo "VERIFICATION = " $VERIFICATION echo " CLIM = " $CLIM echo " TAYLOR = " $TAYLOR echo " ANALYSIS = " $ANALYSIS echo " STD_DEV = " $STD_DEV echo " " # Run Grads-Based Quickplot Utility # --------------------------------- set tmpdirs = "" foreach plot ($plots) echo "Processing $plot of type $type" set datetime = `date +%Y%m%d_%H%M%S` if( ! -e $plots_dir/$plot.$datetime.$type ) mkdir -p $plots_dir/$plot.$datetime.$type cd $plots_dir/$plot.$datetime.$type # Check Format of HISTORY.rc # -------------------------- set test = `grep COLLECTIONS $HISTORYRC` if( "$test" != "" ) then /bin/cp $GEOSUTIL/plots/chckhist.new chckhist else /bin/cp $GEOSUTIL/plots/chckhist.old chckhist endif set tmpdirs = `echo $tmpdirs $plot.$datetime.$type` if( $debug == true ) then if($type != 2) then $GEOSUTIL/plots/landscape.script -expid $expid \ -source $source \ -plot $plot \ -output $plots_dir \ -geosutil $GEOSUTIL \ -grads $GRADS \ -debug \ -season $seasons endif if($type != 1) then $GEOSUTIL/plots/portrait.script -expid $expid \ -source $source \ -plot $plot \ -output $plots_dir \ -geosutil $GEOSUTIL \ -grads $GRADS \ -debug \ -season $seasons endif else if($type != 2) then $GEOSUTIL/plots/landscape.script -expid $expid \ -source $source \ -plot $plot \ -output $plots_dir \ -geosutil $GEOSUTIL \ -grads $GRADS \ -batch \ -season $seasons & sleep 5 endif if($type != 1) then $GEOSUTIL/plots/portrait.script -expid $expid \ -source $source \ -plot $plot \ -output $plots_dir \ -geosutil $GEOSUTIL \ -grads $GRADS \ -batch \ -season $seasons & sleep 5 endif endif end wait # Sleep for 3 minutes to ensure all plots are converted # ----------------------------------------------------- if( $debug == false ) then sleep 3m else sleep 1m endif # Reset Environment # ----------------- cd $plots_dir /bin/rm -r $tmpdirs # Move gif images to server # ------------------------- if( $move == true ) then if( -e `which moveplot` ) ssh discover07 "cd $plots_dir ; moveplot" endif