#!/bin/csh -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 # # +-======-+ # This script performs post-processing of files which have been created from: gcm_run.j # It performs the following tasks: # # 1) Parses files within the ../holding/$stream directories to the appropriate YYYYMM # 2) Performs monthly means if the YYYYMM directories are complete (ie, contains all required files) # 3) Spawns ARCHIVE job if monthly means are successful. # 4) Spawns PLOT job if DJF or JJA has just been completed. # # ------------------------------------------------------------------------- @ nmax = $#argv # Usage # ----- if( $nmax == 0 ) then echo " " echo "Usage:" echo "-----" echo "gcmpost -source SOURCE_DIRECTORY" echo " where: SOURCE_DIRECTORY is the source directory for experiment" echo " " echo " <-recover YYYYMM Optional Argument to Recover and Repeat YYYYMM>" echo " <-ddf clim Optional Argument to Use clim.tabl for plots>" echo " " exit 1 endif # Process Input String # -------------------- set EXPID = 'NULL' set NCPUS = 'NULL' set CLIMO = 'FALSE' set DDF = 'NULL' setenv RECDATE "NULL" @ n = 1 while( $n <= $nmax ) if( "$argv[$n]" == "-source" ) then @ n = $n + 1 setenv SOURCE $argv[$n] endif if( "$argv[$n]" == "-recover" ) then @ n = $n + 1 setenv RECDATE $argv[$n] endif if( "$argv[$n]" == "-ncpus" ) then @ n = $n + 1 set NCPUS = $argv[$n] endif if( "$argv[$n]" == "-expid" ) then @ n = $n + 1 set EXPID = $argv[$n] endif if( "$argv[$n]" == "-clim" ) then set CLIMO = 'TRUE' endif @ n = $n + 1 end # Determine Machine ID # -------------------- setenv ARCH ` uname` setenv HOST `hostname` set name = `echo $HOST` ; if ( ($name =~ pfe*) || ($name =~ p4fe*) || ($name =~ r[0-9]*i[0-9]*n[0-9]*) ) setenv HOST pleiades set name = `echo $HOST | cut -b 1-8` ; if( $name == 'columbia' ) setenv HOST $name set name = `echo $HOST | cut -b 1-8` ; if( $name == 'discover' ) setenv HOST $name set name = `echo $HOST | cut -b 1-4` ; if( $name == 'borg' ) setenv HOST discover if( $name == 'cfe1' ) setenv HOST columbia if( $name == 'cfe2' ) setenv HOST columbia if( $name == 'e1' ) setenv HOST palm if( $name == 'e2' ) setenv HOST palm if( $name == 'e3' ) setenv HOST palm # Extract EXPID from SOURCE (assuming last node) # ----------------------------------------------- if( $EXPID == "NULL" ) then set expid = `basename $SOURCE` else set expid = $EXPID endif # Determine Number of Nodes if running in BATCH # --------------------------------------------- if( $NCPUS == "NULL" ) then if ($?PBS_NODEFILE & $?BATCHNAME) then set BATCHJOB = `qstat | grep $BATCHNAME | grep $LOGNAME | cut -d' ' -f1` set numjobs = $#BATCHJOB if( $numjobs != 0 ) then set NCPUS = `qstat -f $BATCHJOB[1] | grep -i Resource_List.ncpus | cut -d'=' -f2` endif endif endif echo Use: NCPUS = $NCPUS # Set Architecture Speicific Variables # ------------------------------------ if( $ARCH == 'Linux' ) then if( $HOST == 'pleiades' ) then setenv MASTOR lou setenv MASDIR $expid setenv BATCHQ normal endif if( $HOST == 'columbia' ) then setenv MASTOR lou.nas.nasa.gov setenv MASDIR $expid setenv BATCHQ normal endif if( $HOST == 'palm' ) then setenv MASTOR palm.nccs.nasa.gov setenv MASDIR /archive/u/$LOGNAME/GEOS5.0/$expid setenv BATCHQ general endif if( $HOST == 'discover' ) then setenv MASTOR palm setenv MASDIR /archive/u/$LOGNAME/GEOS5.0/$expid setenv BATCHQ general endif endif setenv GROUP `cat $HOME/.GROUProot` set check_plot = FALSE set scpvar = "bbscp -z" # Check for Post-Processing Executables # ------------------------------------- set execs = "time_ave" foreach exec ($execs) if( ! -e $GEOSUTIL/post/${exec}.x ) then echo "Error! Post-Processing Utility ${exec}.x is not found." exit 7 endif end # Determine Collection Names and Archive Locations from HISTORY RC File # --------------------------------------------------------------------- set collections = `$GEOSUTIL/post/get_streams $SOURCE/HISTORY.rc` set archives = `$GEOSUTIL/post/get_archive $SOURCE/HISTORY.rc` # Count Number of "Dots" in Collection Name to Find Location of Date Node # ----------------------------------------------------------------------- @ m = 0 set ndots = '' foreach collection ( $collections ) @ n = 0 @ b = 1 set bit = `echo ${collection} | cut -b $b` while( "${bit}" != '' ) if( "${bit}" == '.' ) then @ n = $n + 1 endif @ b = $b + 1 set bit = `echo ${collection} | cut -b $b` end set ndots = `echo $ndots $n` @ m = $m + 1 end # Check for RECDATE Option # ------------------------ if( $RECDATE != "NULL" ) then foreach collection ( $collections ) if( -e $SOURCE/holding/$collection/$RECDATE ) then cd $SOURCE/holding/$collection if( -e $RECDATE.tmp ) /bin/rm -r $RECDATE.tmp /bin/mv $RECDATE $RECDATE.tmp /bin/mv `ls -1 $RECDATE.tmp/${expid}*${collection}* | grep -v monthly | grep -v diurnal | grep -v daily` . /bin/rm -r $RECDATE.tmp endif end endif # Move Current Files within Holding Directory to proper YYYYMM Sub-Directories # ---------------------------------------------------------------------------- set dates = '' set numdates = '' @ nstream = 0 foreach collection ( $collections ) @ nstream = $nstream + 1 @ date_node = $ndots[$nstream] + 3 cd $SOURCE/holding/$collection set locals = `ls -1 ${expid}*${collection}* | grep -v monthly | grep -v diurnal` set numlocs = $#locals set numdate = 0 if( $numlocs != 0 ) then # Extract Extension (last node) from Typical Local File # ----------------------------------------------------- @ loc = 1 while( $loc != 0 ) set dum = `echo $locals[1] | cut -d "." -f$loc` if( .$dum != . ) then set ext = $dum @ loc = $loc + 1 else @ loc = 0 endif end set date0 = xxxx foreach local ( $locals ) set date = `echo $local | cut -d "." -f${date_node} | cut -c1-6` if( $date != $date0 ) then @ numdate = $numdate + 1 set dates = `echo $dates $date` set date0 = $date endif if(! -e $SOURCE/holding/$collection/$date ) mkdir -p $SOURCE/holding/$collection/$date /bin/mv $local $SOURCE/holding/$collection/$date end else @ numdate = $numdate + 1 set date = 0 set dates = `echo $dates $date` endif set numdates = `echo $numdates $numdate` end echo $numdates echo $dates # Process Monthly Means # --------------------- @ m = 1 @ begloc = 1 @ count = 0 foreach collection ( $collections ) @ endloc = $begloc + $numdates[$m] - 1 set streamdates = `echo $dates[${begloc}-${endloc}]` if( $streamdates[1] != 0 ) then foreach date ( $streamdates ) echo $collection $streamdates Current Date: $date if( -e $SOURCE/holding/$collection/$date ) then cd $SOURCE/holding/$collection/$date set locals = `ls -1 ${expid}*${collection}* | grep -v monthly | grep -v diurnal` set num = `ls -1 $locals | wc -l` echo "Is it time to perform Time-Average on Local Files?:" echo "--------------------------------------------------" echo " Collection: $collection" echo " Date: $date" echo "Number of Files: $num" echo "" echo $locals echo "" if( $num > 0 ) then # Find Dates within first local file # ---------------------------------- set file = $locals[1] set filedate = `$GEOSUTIL/post/getdates $file` set begdate = $filedate[1] set begtime = $filedate[2] set enddate = $filedate[3] set endtime = $filedate[4] set ndt = $filedate[5] # Decrement First Date by one Time Increment # ------------------------------------------ set prevdate = `$GEOSUTIL/post/tick $begdate $begtime -$ndt` set prvdate = $prevdate[1] set prvtime = $prevdate[2] # Check to see if Decremented Date passed Month Boundary # ------------------------------------------------------ set prvmon = `echo $prvdate | cut -c5-6` set begmon = `echo $begdate | cut -c5-6` # Find Dates within last local file # --------------------------------- set file = $locals[$num] set filedate = `$GEOSUTIL/post/getdates $file` set begdate = $filedate[1] set begtime = $filedate[2] set enddate = $filedate[3] set endtime = $filedate[4] set ndt = $filedate[5] # Increment Last Date by one Time Increment # ----------------------------------------- set nextdate = `$GEOSUTIL/post/tick $enddate $endtime $ndt` set nxtdate = $nextdate[1] set nxttime = $nextdate[2] # Check to see if Incremented Date passed Month Boundary # ------------------------------------------------------ set endmon = `echo $enddate | cut -c5-6` set nxtmon = `echo $nxtdate | cut -c5-6` echo "Beginning Month within Local Files: ${begmon} (-$ndt Month: ${prvmon})" echo " Ending Month within Local Files: ${begmon} (+$ndt Month: ${nxtmon})" if( $prvmon != $begmon && $endmon != $nxtmon ) then echo " Performing time average ..." if(! -e time_ave.rc ) ln -s $GEOSUTIL/post/time_ave.rc . if( $NCPUS == "NULL" | $NCPUS == 1 | !($?RUN_CMD) ) then $GEOSUTIL/post/time_ave_nompi.x -hdf $locals -rc time_ave.rc \ -tag $expid.$collection.monthly \ -d $expid.$collection.diurnal else $RUN_CMD $NCPUS $GEOSUTIL/post/time_ave.x -hdf $locals -rc time_ave.rc \ -tag $expid.$collection.monthly \ -d $expid.$collection.diurnal endif @ count = $count + 1 if( $count == 9 ) then @ count = 1 wait endif else echo " End of Month not yet reached." endif endif endif # End IFTEST for -e $SOURCE/holding/$collection/$date due to possible deletion from other archive job end endif @ begloc = $endloc + 1 @ m = $m + 1 end wait # Move and Archive Monthly Means and Dailies # ------------------------------------------ @ m = 1 @ begloc = 1 @ nstream = 0 foreach collection ( $collections ) @ nstream = $nstream + 1 @ date_node = $ndots[$nstream] + 3 @ endloc = $begloc + $numdates[$m] - 1 set streamdates = `echo $dates[${begloc}-${endloc}]` if( $streamdates[1] != 0 ) then foreach date ( $streamdates ) if( -e $SOURCE/holding/$collection/$date ) then set locdir = $SOURCE/holding/$collection/$date cd $SOURCE/holding/$collection/$date set num = `ls -1 $expid.$collection.monthly.* | wc -l` if( $num != 0 ) then set check_plot = TRUE /bin/rm -f archive_commands touch archive_commands echo "set success = TRUE" >> archive_commands echo "@ npasses = 3" >> archive_commands echo "cd $SOURCE/holding/$collection/$date" >> archive_commands # Tar and Archive Dailies # ----------------------- set locals = `ls -1 ${expid}*${collection}* | grep -v monthly | grep -v diurnal` tar cf $expid.${collection}.daily.$date.$ext.tar $locals set locals = $expid.${collection}.daily.$date.$ext.tar @ daily_date_node = $date_node + 1 # Since daily is simply appended to collection name foreach local ($locals) set fdate = `echo $local | cut -d "." -f${daily_date_node}` # Assumed date format: YYYYMMDD_HHMMSS set year = `echo $fdate | cut -c1-4` set month = `echo $fdate | cut -c5-6` set day = `echo $fdate | cut -c7-8` set hour = `echo $fdate | cut -c10-11` set archive = `echo $archives[$m] | sed -e "s/%c/$collection/ g" | \ sed -e "s/%y4/$year/ g" | \ sed -e "s/%m2/$month/ g" | \ sed -e "s/%d2/$day/ g" | \ sed -e "s/%h2/$hour/ g"` if( $HOST == 'pleiades' ) then echo "ssh bridge2 ssh ${MASTOR} mkdir -p ${MASDIR}/$archive " >> archive_commands echo "ssh bridge2 $scpvar $locdir/$local ${MASTOR}:${MASDIR}/$archive " >> archive_commands endif if( $HOST == 'columbia' ) then echo "ssh ${MASTOR} mkdir -p ${MASDIR}/$archive " >> archive_commands echo "scp $local ${MASTOR}:${MASDIR}/$archive " >> archive_commands endif if( $HOST == 'discover' ) then echo " ssh $MASTOR mkdir -p ${MASDIR}/$archive " >> archive_commands echo 'echo " "' >> archive_commands echo "echo 'Archiving: '$local" >> archive_commands echo '@ n = 1' >> archive_commands echo 'while( $n <= $npasses )' >> archive_commands echo "$scpvar $local ${MASTOR}:${MASDIR}/$archive | set archive_status = "'`sed -e "s/ / /g"`' >> archive_commands echo 'if ( .$archive_status[4] == .OK ) then' >> archive_commands echo 'echo " Attempt "''$n ... PASS ' >> archive_commands echo '@ n = 999' >> archive_commands echo "else" >> archive_commands echo 'echo " Attempt "''$n ... FAIL!' >> archive_commands echo 'if( $n == $npasses ) set success = FALSE' >> archive_commands echo '@ n = $n + 1' >> archive_commands echo "endif" >> archive_commands echo "end" >> archive_commands echo 'unset archive_status' >> archive_commands endif end echo "wait" >> archive_commands # Archive Monthlies (non diurnal files) # ------------------------------------- @ monthly_date_node = $date_node + 1 # Since monthly is simply appended to collection name set locals = `ls -1 ${expid}*${collection}* | grep monthly | grep -v diurnal` foreach local ($locals) set fdate = `echo $local | cut -d "." -f${monthly_date_node}` # Assumed date format: YYYYMMDD_HHMMSS set year = `echo $fdate | cut -c1-4` set month = `echo $fdate | cut -c5-6` set day = `echo $fdate | cut -c7-8` set hour = `echo $fdate | cut -c10-11` set archive = `echo $archives[$m] | sed -e "s/%c/$collection/ g" | \ sed -e "s/%y4/$year/ g" | \ sed -e "s/%m2/$month/ g" | \ sed -e "s/%d2/$day/ g" | \ sed -e "s/%h2/$hour/ g"` /bin/cp $local $SOURCE/$collection if( $HOST == 'pleiades' ) then echo "ssh bridge2 ssh ${MASTOR} mkdir -p ${MASDIR}/$archive" >> archive_commands echo "ssh bridge2 scp $locdir/$local ${MASTOR}:${MASDIR}/$archive" >> archive_commands endif if( $HOST == 'columbia' ) then echo "ssh ${MASTOR} mkdir -p ${MASDIR}/$archive" >> archive_commands echo "scp $local ${MASTOR}:${MASDIR}/$archive" >> archive_commands endif if( $HOST == 'discover' ) then echo " ssh $MASTOR mkdir -p ${MASDIR}/$archive " >> archive_commands echo 'echo " "' >> archive_commands echo "echo 'Archiving: '$local" >> archive_commands echo '@ n = 1' >> archive_commands echo 'while( $n <= $npasses )' >> archive_commands echo "$scpvar $local ${MASTOR}:${MASDIR}/$archive | set archive_status = "'`sed -e "s/ / /g"`' >> archive_commands echo 'if ( .$archive_status[4] == .OK ) then' >> archive_commands echo 'echo " Attempt "''$n ... PASS ' >> archive_commands echo '@ n = 999' >> archive_commands echo "else" >> archive_commands echo 'echo " Attempt "''$n ... FAIL!' >> archive_commands echo 'if( $n == $npasses ) set success = FALSE' >> archive_commands echo '@ n = $n + 1' >> archive_commands echo "endif" >> archive_commands echo "end" >> archive_commands echo 'unset archive_status' >> archive_commands endif end # Archive Monthlies (diurnal files) # --------------------------------- @ monthly_date_node = $date_node + 1 # Since diurnal is simply appended to collection name set locals = `ls -1 ${expid}*${collection}* | grep diurnal | grep -v monthly` set num = `/bin/ls -1 $locals | wc -l` if( $num != 0 ) then foreach local ($locals) set fdate = `echo $local | cut -d "." -f${monthly_date_node}` # Assumed date format: YYYYMMDD_HHMMSS set year = `echo $fdate | cut -c1-4` set month = `echo $fdate | cut -c5-6` set day = `echo $fdate | cut -c7-8` set hour = `echo $fdate | cut -c10-11` set archive = `echo $archives[$m] | sed -e "s/%c/$collection/ g" | \ sed -e "s/%y4/$year/ g" | \ sed -e "s/%m2/$month/ g" | \ sed -e "s/%d2/$day/ g" | \ sed -e "s/%h2/$hour/ g"` mkdir -p $SOURCE/$collection/diurnal /bin/cp $local $SOURCE/$collection/diurnal if( $HOST == 'pleiades' ) then echo "ssh bridge2 ssh ${MASTOR} mkdir -p ${MASDIR}/$archive" >> archive_commands echo "ssh bridge2 scp $locdir/$local ${MASTOR}:${MASDIR}/$archive" >> archive_commands endif if( $HOST == 'columbia' ) then echo "ssh ${MASTOR} mkdir -p ${MASDIR}/$archive" >> archive_commands echo "scp $local ${MASTOR}:${MASDIR}/$archive" >> archive_commands endif if( $HOST == 'discover' ) then echo " ssh $MASTOR mkdir -p ${MASDIR}/$archive " >> archive_commands echo 'echo " "' >> archive_commands echo "echo 'Archiving: '$local" >> archive_commands echo '@ n = 1' >> archive_commands echo 'while( $n <= $npasses )' >> archive_commands echo "$scpvar $local ${MASTOR}:${MASDIR}/$archive | set archive_status = "'`sed -e "s/ / /g"`' >> archive_commands echo 'if ( .$archive_status[4] == .OK ) then' >> archive_commands echo 'echo " Attempt "''$n ... PASS ' >> archive_commands echo '@ n = 999' >> archive_commands echo "else" >> archive_commands echo 'echo " Attempt "''$n ... FAIL!' >> archive_commands echo 'if( $n == $npasses ) set success = FALSE' >> archive_commands echo '@ n = $n + 1' >> archive_commands echo "endif" >> archive_commands echo "end" >> archive_commands echo 'unset archive_status' >> archive_commands endif end endif # Archive Restarts (First Stream Only) # ------------------------------------ if( $nstream == 1 ) then echo " " >> archive_commands if( $HOST == 'pleiades' ) then echo "ssh bridge2 ssh ${MASTOR} mkdir -p ${MASDIR}/restarts/Y${year}" >> archive_commands echo "ssh bridge2 $scpvar $SOURCE/restarts/*${year}${month}* ${MASTOR}:${MASDIR}/restarts/Y${year}" >> archive_commands echo "ssh bridge2 $scpvar $SOURCE/GEOSgcm.x ${MASTOR}:${MASDIR}" >> archive_commands echo "ssh bridge2 $scpvar $SOURCE/HISTORY.rc ${MASTOR}:${MASDIR}" >> archive_commands echo "ssh bridge2 $scpvar $SOURCE/AGCM.rc ${MASTOR}:${MASDIR}" >> archive_commands echo "ssh bridge2 $scpvar $SOURCE/CAP.rc ${MASTOR}:${MASDIR}" >> archive_commands endif if( $HOST == 'columbia' ) then echo "ssh ${MASTOR} mkdir -p ${MASDIR}/restarts/Y${year}" >> archive_commands echo "scp $SOURCE/restarts/*${year}${month}* ${MASTOR}:${MASDIR}/restarts/Y${year}" >> archive_commands echo "scp $SOURCE/GEOSgcm.x ${MASTOR}:${MASDIR}" >> archive_commands echo "scp $SOURCE/HISTORY.rc ${MASTOR}:${MASDIR}" >> archive_commands echo "scp $SOURCE/AGCM.rc ${MASTOR}:${MASDIR}" >> archive_commands echo "scp $SOURCE/CAP.rc ${MASTOR}:${MASDIR}" >> archive_commands endif if( $HOST == 'discover' ) then echo " ssh $MASTOR mkdir -p ${MASDIR}/restarts/Y${year}" >> archive_commands echo "$scpvar $SOURCE/restarts/*${year}${month}* ${MASTOR}:${MASDIR}/restarts/Y${year}" >> archive_commands echo "$scpvar $SOURCE/GEOSgcm.x ${MASTOR}:${MASDIR}" >> archive_commands echo "$scpvar $SOURCE/HISTORY.rc ${MASTOR}:${MASDIR}" >> archive_commands echo "$scpvar $SOURCE/AGCM.rc ${MASTOR}:${MASDIR}" >> archive_commands echo "$scpvar $SOURCE/CAP.rc ${MASTOR}:${MASDIR}" >> archive_commands endif echo "/bin/rm $SOURCE/restarts/*${year}${month}*" >> archive_commands endif echo "cd ../" >> archive_commands echo 'if( $success == TRUE ) then' >> archive_commands echo ' /bin/rm -r '$date >> archive_commands echo 'echo " Successfully Archived: "'$SOURCE/holding/$collection/$date >> archive_commands echo 'else' >> archive_commands echo 'echo " FAILED to Archive: "'$SOURCE/holding/$collection/$date >> archive_commands echo " qsub $SOURCE/archive/gcm_archive.$collection.$date.j" >> archive_commands echo 'endif' >> archive_commands echo "exit" >> archive_commands # Submit Archive Job # ------------------ cat $SOURCE/archive/gcm_archive.j archive_commands > $SOURCE/archive/gcm_archive.$collection.$date.j cd $SOURCE/archive /bin/rm -f sedfile /bin/mv -f gcm_archive.$collection.$date.j tmpfile cat > sedfile << EOF s/OUTPUT/gcm_archive.$collection.$date.o/g EOF sed -f sedfile tmpfile > gcm_archive.$collection.$date.j chmod +x gcm_archive.$collection.$date.j qsub gcm_archive.$collection.$date.j /bin/rm -f sedfile /bin/rm -f tmpfile endif endif # End IFTEST for -e $SOURCE/holding/$collection/$date due to possible deletion from other archive job end endif @ begloc = $endloc + 1 @ m = $m + 1 end wait ####################################################################### # Create Grads Data Description File (DDF) for Monthly Means ####################################################################### @ nstream = 0 foreach collection ( $collections ) @ nstream = $nstream + 1 @ date_node = $ndots[$nstream] + 4 cd $SOURCE/${collection} set monthlies = `/bin/ls -1 $expid.${collection}.monthly* | grep -v clim` set num = `/bin/ls -1 $monthlies | wc -l` if( $num != 0 ) then # Create DDF File # --------------- /bin/rm -f xdf.tabl # Extract Extension (last node) from Monthly Mean File # ---------------------------------------------------- @ m = 1 while( $m != 0 ) set dum = `echo $monthlies[1] | cut -d "." -f$m` if( .$dum != . ) then set ext = $dum @ m = $m + 1 else @ m = 0 endif end set date = `echo $monthlies[1] | cut -d "." -f${date_node}` set year = `echo $date | cut -c1-4` set month = `echo $date | cut -c5-6` set day = `echo $date | cut -c7-8` set hour = `echo $date | cut -c10-11` set expdsc = `grep EXPDSC: $SOURCE/HISTORY.rc | cut -d" " -f2` if( $month == "01" ) set MON = JAN if( $month == "02" ) set MON = FEB if( $month == "03" ) set MON = MAR if( $month == "04" ) set MON = APR if( $month == "05" ) set MON = MAY if( $month == "06" ) set MON = JUN if( $month == "07" ) set MON = JUL if( $month == "08" ) set MON = AUG if( $month == "09" ) set MON = SEP if( $month == "10" ) set MON = OCT if( $month == "11" ) set MON = NOV if( $month == "12" ) set MON = DEC echo DSET $SOURCE/${collection}/$expid.${collection}.monthly.%y4%m2.$ext > xdf.tabl echo TITLE $expdsc >> xdf.tabl echo OPTIONS template >> xdf.tabl echo TDEF time $num LINEAR 00:00Z01$MON$year 1mo >> xdf.tabl endif # Endif for monthlies NUM = 0 check # Update Climatology Files # ------------------------ if( $num > 12 && ( $RECDATE == "NULL" || $CLIMO == "TRUE" ) ) then set date = `echo $monthlies[$num] | cut -d "." -f${date_node}` set month = `echo $date | cut -c5-6` $GEOSUTIL/post/gcmclim.script -source $SOURCE -collection $collection -month $month endif end # End ForEach Output Stream Loop ####################################################################### # Submit Quickplot Job # -------------------- # Note: $num, $monthlies, and ${date_node} # are from last output stream examined ####################################################################### if( $check_plot == "TRUE" ) then cd $SOURCE/plot if(! -e plot.rc ) ln -s $GEOSUTIL/post/plot.rc . set STATUS = `grep PLOT_STATUS: plot.rc | cut -d'#' -f1 | cut -d':' -f2 | tr "[:lower:]" "[:upper:]"` set SEASONS = `grep PLOT_SEASONS: plot.rc | cut -d'#' -f1 | cut -d':' -f2 | tr "[:lower:]" "[:upper:]"` set FREQUENCY = `grep PLOT_FREQUENCY: plot.rc | cut -d'#' -f1 | cut -d':' -f2 | tr "[:lower:]" "[:upper:]"` set CMPEXP = `grep PLOT_CMPEXP: plot.rc | cut -d'#' -f1 | cut -d':' -f2 ` if( $STATUS == "ON" && $num > 0 ) then # At least 1 monthly mean exists set date = `echo $monthlies[$num] | cut -d "." -f${date_node}` set month = `echo $date | cut -c5-6` set year = `echo $date | cut -c1-4` set decade = `echo $year | cut -c3-4` if( $month == "01" ) set MON = JAN if( $month == "02" ) set MON = FEB if( $month == "03" ) set MON = MAR if( $month == "04" ) set MON = APR if( $month == "05" ) set MON = MAY if( $month == "06" ) set MON = JUN if( $month == "07" ) set MON = JUL if( $month == "08" ) set MON = AUG if( $month == "09" ) set MON = SEP if( $month == "10" ) set MON = OCT if( $month == "11" ) set MON = NOV if( $month == "12" ) set MON = DEC set season = '' foreach case ($SEASONS) if( $MON == $case ) set season = `echo $season $case ` if( $MON == "FEB" && $case == "DJF" && $num > 2 ) set season = `echo $season $case ` if( $MON == "MAY" && $case == "MAM" && $num > 2 ) set season = `echo $season $case ` if( $MON == "AUG" && $case == "JJA" && $num > 2 ) set season = `echo $season $case ` if( $MON == "OCT" && $case == "SON" && $num > 2 ) set season = `echo $season $case ` if( $MON == "DEC" && $case == "ANN" && $num > 11 ) set season = `echo $season $case ` endif end if( $season[1] != '' ) then if( $CMPEXP != "" ) set CMPEXP = `echo -cmpexp $CMPEXP` if( $FREQUENCY == "CLIM" ) then set plotsdir = $SOURCE/plots_CLIM set date = `echo $monthlies[1] | cut -d "." -f${date_node}` set year = `echo $date | cut -c1-4` set month = `echo $date | cut -c5-6` set begdate = ${year}${month} set date = `echo $monthlies[$num] | cut -d "." -f${date_node}` set year = `echo $date | cut -c1-4` set month = `echo $date | cut -c5-6` set enddate = ${year}${month} else set plotsdir = $SOURCE/plots_Y${year} if( $#season == 1 ) then if( $season == $MON ) then set begdate = ${year}${month} set enddate = ${year}${month} else if( $season == "ANN" ) then @ ndt = 11 * 30 * 86400 else @ ndt = 2 * 30 * 86400 endif set nymd = ${year}${month}15 set date = `$GEOSUTIL/post/tick $nymd 000000 -$ndt` set begdate = `echo $date[1] | cut -c1-6` set enddate = ${year}${month} endif else if( $season[1] == "ANN" || $season[2] == "ANN" ) then @ ndt = 11 * 30 * 86400 else @ ndt = 2 * 30 * 86400 endif set nymd = ${year}${month}15 set date = `$GEOSUTIL/post/tick $nymd 000000 -$ndt` set begdate = `echo $date[1] | cut -c1-6` set enddate = ${year}${month} endif endif set ntypes = "1 2 3" foreach type ($ntypes) if( $type == "1" || $type == "2" ) then set types = " -type $type " set plots = "" set noplot = " -noplot tseries residual taylor" if( $DDF == "NULL" ) then set begdate = NULL # To force using xdf.tabl set enddate = NULL # To force using xdf.tabl endif else set types = "" set plots = " -plots tseries residual taylor" set noplot = "" set begdate = NULL set enddate = NULL endif set bname = `echo ${expid}${MON}${decade}_${type} | cut -b1-15` set FILE = gcm_plot.$bname.j /bin/rm -f FILE /bin/rm -f $FILE /bin/rm -f sedfile /bin/rm -f tmpfile echo ./quickplot -source $SOURCE -season $season $types $plots $noplot -clim false $CMPEXP \ -plotsdir $plotsdir \ -begdate $begdate \ -enddate $enddate -move > tmpfile cat gcm_plot.j tmpfile > FILE cat > sedfile << EOF s/${expid}_PLT/$bname/g s/OUTPUT/gcm_plot.$bname.o/g EOF sed -f sedfile FILE > $FILE qsub $FILE /bin/rm -f FILE /bin/rm -f sedfile /bin/rm -f tmpfile end # End type Loop endif # End season test endif # End num test endif # End check_plot test