Commit b6252cfe authored by Carl Schreck's avatar Carl Schreck
Browse files

Automated Nightly Commit - Sat Jul 14 00:00:09 EDT 2018

parent c0ec4d42
#!/bin/bash --login
#if [ -z "$1" ]; then
# QUEUE=`pick_queue`
#else
# QUEUE=$1
#fi
QUEUE=allnodes
echo $QUEUE
NCL_SCRIPT=pct_allRmm
NCL_DIR=`pwd`
LOG_DIR=$NCL_DIR/log
mkdir -p $LOG_DIR
for shdVar in air air850 prate hgt500
do
for midMonth in {1..12}
do
for epoch in 1980s 2000s all
do
JOB_NAME=$NCL_SCRIPT"_"$shdVar"_"$epoch"_"$midMonth
echo $JOB_NAME `date`
LOG_FILE=$LOG_DIR/$JOB_NAME.log
ERR_FILE=$LOG_DIR/$JOB_NAME.err
NCL_OPTION="shdVar=\"$shdVar\" epoch=\"$epoch\" midMonth=$midMonth"
rm $LOG_FILE $ERR_FILE
bsub \
-J $JOB_NAME \
-o $LOG_FILE \
-e $ERR_FILE \
-q $QUEUE \
-n 1 -R "span[hosts=1]" -W 48:00 \
-sp 75 \
~/template/run_ncl.sh $NCL_DIR $NCL_SCRIPT "$NCL_OPTION"
done
done
done
......@@ -6,14 +6,6 @@
; Description: Make a lagged composite based on RMM phases
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"
load "$CJS_NCL_LIB/print_clock.ncl"
load "$CJS_NCL_LIB/lib.composites.ncl"
load "$CJS_NCL_LIB/lib.time.ncl"
......@@ -22,11 +14,14 @@ load "$CJS_NCL_LIB/lib.cjs_graphics.ncl"
function plotOne( \
wks, \
shdVar, \
keepPhase, \
variableInd, \
rmmThresh, \
lag[*], \
months \
months, \
minYear, \
maxYear \
)
begin
print_clock( "Phase " + keepPhase )
......@@ -44,20 +39,20 @@ begin
maxLat = 60
timeUnits = "days since 1800-01-01 00:00:00"
minTime = cd_inv_calendar( 1979, 06, 01, 00, 0, 0, timeUnits, 0 )
maxTime = cd_inv_calendar( 2015, 05, 31, 00, 0, 0, timeUnits, 0 )
minTime = cd_inv_calendar( minYear, 01, 01, 00, 0, 0, timeUnits, 0 )
maxTime = cd_inv_calendar( maxYear, 12, 31, 00, 0, 0, timeUnits, 0 )
shdVar = "t850"
shdLevels = (/ -70, -60, -50, -40, 40, 50, 60, 70 /)
if( shdVar.eq."precip" ) then
shdPath = "/home/carl/data/persiann/north_america.5dayAnom.nc"
else if( shdVar.eq."rain" ) then
shdPath = "/home/carl/data/trmm/trmm3b42.7dayAnom.nc"
else
shdPath = "/home/carl/data/cfsr/7dayAnom/" + shdVar + ".7dayAnom.nc"
; if( shdVar.eq."precip" ) then
; shdPath = "/home/carl/data/persiann/north_america.5dayAnom.nc"
; else if( shdVar.eq."rain" ) then
; shdPath = "/home/carl/data/trmm/trmm3b42.7dayAnom.nc"
; else
; shdPath = "/home/carl/data/cfsr/7dayAnom/" + shdVar + ".7dayAnom.nc"
shdPath = "/home/carl/data/ncep2/7dayAnom/" + shdVar + ".7dayAnom.nc"
; shdPath = "/home/carl/data/cfsr/7dayAnom/" + shdVar + ".7dayAnom.2005.2015.nc"
end if
end if
; end if
; end if
ptileThresh = 33
; reading RMM data
......@@ -89,7 +84,7 @@ begin
compDates = rmmTime(rmmAmpAndPhaseInd)
print( (/ compDates@long_name /) )
; print( (/ compDates@long_name /) )
print( "Number of dates: " + dimsizes(compDates) )
; print( cd_string( compDates, "" ) )
......@@ -106,7 +101,7 @@ begin
res@gsnLeftString = varName + " phase " + keepPhase
res@gsnRightString = shdData@nEvents + " events"
if( any( shdVar.eq.(/ "precip", "rain" /) ) ) then
if( any( shdVar.eq.(/ "precip", "rain", "prate" /) ) ) then
res@cnFillPalette = "MPL_BrBG"
else
res@cnFillPalette = reverse_colormap("MPL_RdBu")
......@@ -199,17 +194,38 @@ begin
print_clock( "Here we go!" )
; These are some parameters that could be useful to have up top
if( .not.isvar("midMonth") ) then
midMonth = 7
end if
if( .not.isvar("shdVar") ) then
shdVar = "air850"
end if
if( .not.isvar("epoch") ) then
epoch = "all"
end if
fontHeightF = 0.02
months = (/ 6, 7, 8 /)
; months = (/ 6, 7, 8, 9 /)
months = midMonth + (/ -1, 0, 1 /)
months = where( months.gt.12, months-12, months )
months = where( months.lt.1, months+12, months )
monthAbbrev = month_abbrev(months)
if( epoch.eq."all" ) then
minYear = 1979
maxYear = 2017
else if( epoch.eq."1980s" ) then
minYear = 1979
maxYear = 1993
else if( epoch.eq."2000s" ) then
minYear = 2003
maxYear = 2017
end if
end if
end if
monthLetter = (/ "","J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D" /)
monthAbbrev = str_concat( monthLetter(months) )
months@minYear = minYear
months@maxYear = maxYear
plotType = "png"
plotDpi = 300
lag = 0
lag@units = "days"
......@@ -218,41 +234,34 @@ begin
eofNotCpc = True
rmmThresh = 1.0
plotName = "figures/mjo." + shdVar
if( variableInd.lt.0 ) then
plotName = "figures/mjo." + monthAbbrev
txString = "RMM > " + rmmThresh + " Days " + (lag-3) + " to " + (lag+3)
txString = "RMM > " + rmmThresh \
+ " Days " + (lag-3) + " to " + (lag+3) \
+ " " + minYear + " to " + maxYear
else
varNames = (/ "olr", "u850", "u200" /)
varName = str_upper(varNames(variableInd))
plotName = "figures/mjo." + varName + "." + monthAbbrev
plotName = "figures/mjo."
txString = varName + " RMM > " + rmmThresh \
+ " Days " + (lag-3) + " to " + (lag+3)
end if
plotName = plotName + ".1979.2015"
print_clock( "Drawing the plot" )
; ...allows png or gif to work
if( ( plotType.eq."png" ).or.( plotType.eq."gif" ) ) then
plotTypeLocal = "eps"
else
plotTypeLocal = plotType
end if
plotName = plotName + "." + monthAbbrev + "." + minYear + "." + maxYear
print( (/ plotName /) )
print( (/ txString /) )
; ...open the workstation
wks = gsn_open_wks( plotTypeLocal, plotName )
; gsn_define_colormap( wks, "colorbrewer_wetdry" )
; gsn_reverse_colormap( wks )
gsn_define_colormap( wks, "posneg_carl" )
wks = cjs_open_wks( plotType, plotName )
plots = new( 8, graphic )
do p = 1,8
plots(p-1) = plotOne( wks, p, variableInd, rmmThresh, lag, months )
plots(p-1) = plotOne( wks, shdVar, p, variableInd, rmmThresh, lag, \
months, minYear, maxYear )
end do
; Customize panel
panRes = True
panRes@txString = ""
panRes@txString = txString
panRes@gsnPanelBottom = 0.05
panRes@gsnPanelYWhiteSpacePercent = 10
panRes@gsnPanelXWhiteSpacePercent = 5
......@@ -260,12 +269,12 @@ begin
panRes@gsnPanelLabelBar = True
panRes@lbTitleString = "%"
panRes@lbTitlePosition = "Right"
panRes@lbTitlePosition = "Bottom"
panRes@lbTitleDirection = "Across"
panRes@lbOrientation = "Horizontal"
panRes@pmLabelBarOrthogonalPosF = -.010
panRes@lbTitleFontHeightF = fontHeightF * 0.8
panRes@lbLabelFontHeightF = fontHeightF * 0.8
panRes@lbTitleFontHeightF = 0.015
panRes@lbLabelFontHeightF = 0.015
; gsn_panel( wks, plots, (/ 4, 4 /), panRes )
......@@ -274,13 +283,7 @@ begin
print_clock( "Convert the image, if necessary" )
delete(wks)
if( ( plotType.eq."png" ).or.( plotType.eq."gif" ) ) then
system( "convert -trim -border 5x5 -bordercolor white " \
+ "+repage -density " + plotDpi + " " \\
+ plotName + ".eps " + plotName + "." + plotType )
system( "rm -f " + plotName + ".eps" )
end if
cjs_close_wks( plotType, plotName, False )
print_clock( "Thank you, come again." )
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment