Commit 5fbf5e9a authored by Carl Schreck's avatar Carl Schreck
Browse files

Automated Nightly Commit - Thu Jul 7 00:00:17 EDT 2016

parent 2b72c220
#!/bin/bash --login
if [ -z "$1" ]; then
QUEUE=`pick_queue`
else
QUEUE=$1
fi
echo $QUEUE
NCL_SCRIPT=wave_meanvar
NCL_DIR=`pwd`
LOG_DIR=$NCL_DIR/log
mkdir -p $LOG_DIR
JOB_NAME=$NCL_SCRIPT
echo $JOB_NAME `date`
LOG_FILE=$LOG_DIR/$JOB_NAME.log
ERR_FILE=$LOG_DIR/$JOB_NAME.err
NCL_OPTION=""
rm $LOG_FILE $ERR_FILE
bsub \
-J $JOB_NAME \
-o $LOG_FILE \
-e $ERR_FILE \
-q $QUEUE \
-n 1 -W 3:00 \
-sp 75 \
~/template/run_ncl.sh $NCL_DIR $NCL_SCRIPT "$NCL_OPTION"
......@@ -7,6 +7,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
load "/home/carl/projects/olr_cdr/compare/sub.calc_meanvar.ncl"
load "$CJS_NCL_LIB/lib.composites.ncl"
undef ( "draw_meanvar" )
......@@ -18,6 +19,11 @@ function draw_meanvar( \
)
begin ; draw_meanvar
; These are some parameters that could be useful to have up top
nTests = 1000
pThresh = 0.95
calcDims = 0
if( ( i_plotVar.eq."mean" ).or.( i_plotVar.eq."variance" ) ) then
varName = "olr"
else
......@@ -28,28 +34,42 @@ begin ; draw_meanvar
if( i_plotVar.eq."mean" ) then
fileName = "olr.total.nc"
units = "W m-2"
calcDims@operation = i_plotVar
else if( i_plotVar.eq."variance" ) then
fileName = "olr.anom.nc"
units = "(W m-2)^2"
calcDims@operation = i_plotVar
else
fileName = "olr.std.waves.nc"
units = "%"
calcDims@operation = "variance"
end if
end if
hirsPath = "/home/carl/data/olr/compare/hirs/" + fileName
avhrrPath = "/home/carl/data/olr/compare/avhrr/" + fileName
hirsData = calc_meanvar( hirsPath, varName, i_plotVar, minYear, maxYear )
avhrrData = calc_meanvar( avhrrPath, varName, i_plotVar, minYear, maxYear )
timeUnits = "days since 1800-01-01 00:00:00"
minTime = cd_inv_calendar( minYear, 01, 01, 00, 0, 0, timeUnits, 0 )
maxTime = cd_inv_calendar( maxYear, 12, 31, 18, 0, 0, timeUnits, 0 )
hirsFile = addfile( hirsPath, "r" )
hirsData = hirsFile->$varName$({minTime:maxTime},{-65:65},:)
avhrrFile = addfile( avhrrPath, "r" )
avhrrData = avhrrFile->$varName$({minTime:maxTime},{-65:65},:)
if( units.eq."%" ) then
hirsData = hirsData * 100
avhrrData = avhrrData * 100
end if
hirsRegrid = copy_Gridding( avhrrData, hirsData )
diffData = hirsRegrid - avhrrData
diffData = bootstrap_diff( hirsRegrid, avhrrData, nTests, pThresh, calcDims )
copy_VarCoords( avhrrData, diffData )
if( i_plotVar.eq."mean" ) then
plotData = dim_avg_n_Wrap( hirsData, calcDims )
else
plotData = dim_variance_n_Wrap( hirsData, calcDims )
end if
if( units.eq."%" ) then
diffData = diffData * 100
plotData = plotData * 100
end if
; Customize base plot
res = True
......@@ -64,6 +84,7 @@ begin ; draw_meanvar
res@cnFillPalette = "colorbrewer_coldhot"
res@pmLabelBarOrthogonalPosF = 0.4
res@cnMissingValFillColor = "gray80"
if( i_res ) then
copy_VarAtts( i_res, res )
......@@ -82,9 +103,9 @@ begin ; draw_meanvar
end if
retVal = cjs_draw_shaded_map( io_wks, diffData, res )
cjs_add_contours( io_wks, retVal, hirsData, cntRes )
cjs_add_contours( io_wks, retVal, plotData, cntRes )
printMinMax( hirsData, True )
printMinMax( plotData, True )
printMinMax( diffData, True )
return(retVal)
......
......@@ -43,12 +43,12 @@ begin ; main
plotVar = "mean"
res = True
res@fontHeightF = 0.015
res@cnLevels := ispan(-5,5,1) * 2
res@cnLevels := ispan(-5,5,1) * 3
cntRes = True
meanPlot = draw_meanvar( wks, plotVar, res, cntRes )
plotVar = "variance"
res@cnLevels := ispan(-5,5,1) * 50
res@cnLevels := ispan(-5,5,1) * 75
cntRes = True
varPlot = draw_meanvar( wks, plotVar, res, cntRes )
......@@ -65,6 +65,9 @@ begin ; main
system( "convert -trim -border 5x5 -bordercolor white " \
+ "+repage -density " + plotDpi + " " \\
+ plotName + ".eps " + plotName + "." + plotType )
if( .not.isStrSubset( plotType, "e" ) ) then
; system( "rm -f " + plotName + ".eps" )
end if
end if
......
......@@ -9,6 +9,7 @@
load "$CJS_NCL_LIB/lib.cjs_graphics.ncl"
load "$CJS_NCL_LIB/lib.array.ncl"
load "$CJS_NCL_LIB/lib.kf.ncl"
load "$CJS_NCL_LIB/lib.composites.ncl"
load "$CJS_NCL_LIB/print_clock.ncl"
......@@ -21,6 +22,10 @@ begin ; main
plotDpi = 200
fontHeightF = 0.02
nTests = 10
pThresh = 0.95
calcDims = (/ 0, 1 /)
print_clock( "Reading hirs" )
inPath = "/home/carl/data/olr/compare/hirs/olr.wk99.nc"
......@@ -30,6 +35,19 @@ begin ; main
hirsSymNorm = inFile->symNormPower({-20:20},:)
hirsAntiNorm = inFile->antiNormPower({-20:20},:)
hirsSymAll = inFile->symAllPower(:,:,{-20:20},:)
hirsAntiAll = inFile->antiAllPower(:,:,{-20:20},:)
hirsBack = conform( hirsSymAll, inFile->background({-20:20},:), (/ 2, 3 /) )
hirsSymAllLog = log10(hirsSymAll)
hirsAntiAllLog = log10(hirsAntiAll)
hirsSymAllNorm = hirsSymAll / hirsBack
hirsAntiAllNorm = hirsAntiAll / hirsBack
copy_VarMeta( hirsSymAll, hirsSymAllLog )
copy_VarMeta( hirsAntiAll, hirsAntiAllLog )
copy_VarMeta( hirsSymAll, hirsSymAllNorm )
copy_VarMeta( hirsAntiAll, hirsAntiAllNorm )
print_clock( "Reading avhrr" )
inPath = "/home/carl/data/olr/compare/avhrr/olr.wk99.nc"
inFile = addfile( inPath, "r" )
......@@ -38,21 +56,33 @@ begin ; main
avhrrSymNorm = inFile->symNormPower({-20:20},:)
avhrrAntiNorm = inFile->antiNormPower({-20:20},:)
diffSymLog = hirsSymLog - avhrrSymLog
copy_VarCoords( hirsSymLog, diffSymLog )
avhrrSymAll = inFile->symAllPower(:,:,{-20:20},:)
avhrrAntiAll = inFile->antiAllPower(:,:,{-20:20},:)
avhrrBack = conform( avhrrSymAll, inFile->background({-20:20},:), (/ 2, 3 /) )
avhrrSymAllLog = log10(avhrrSymAll)
avhrrAntiAllLog = log10(avhrrAntiAll)
avhrrSymAllNorm = avhrrSymAll / avhrrBack
avhrrAntiAllNorm = avhrrAntiAll / avhrrBack
copy_VarMeta( avhrrSymAll, avhrrSymAllLog )
copy_VarMeta( avhrrAntiAll, avhrrAntiAllLog )
copy_VarMeta( avhrrSymAll, avhrrSymAllNorm )
copy_VarMeta( avhrrAntiAll, avhrrAntiAllNorm )
diffSymLog = bootstrap_diff( hirsSymAllLog, avhrrSymAllLog, \
nTests, pThresh, calcDims )
printMinMax( diffSymLog, True )
diffAntiLog = hirsAntiLog - avhrrAntiLog
copy_VarCoords( hirsAntiLog, diffAntiLog )
diffAntiLog = bootstrap_diff( hirsAntiAllLog, avhrrAntiAllLog, \
nTests, pThresh, calcDims )
printMinMax( diffAntiLog, True )
diffSymNorm = hirsSymNorm - avhrrSymNorm
copy_VarCoords( hirsSymNorm, diffSymNorm )
diffSymNorm = bootstrap_diff( hirsSymAllNorm, avhrrSymAllNorm, \
nTests, pThresh, calcDims )
printMinMax( diffSymNorm, True )
diffAntiNorm = hirsAntiNorm - avhrrAntiNorm
copy_VarCoords( hirsAntiNorm, diffAntiNorm )
diffAntiNorm = bootstrap_diff( hirsAntiAllNorm, avhrrAntiAllNorm, \
nTests, pThresh, calcDims )
printMinMax( diffAntiNorm, True )
......@@ -90,6 +120,7 @@ begin ; main
res@cnLevels = ispan( -5, 5, 1 ) * 0.02
res@gsnLeftString = "Log Anti-symmetric"
print_clock( res@gsnLeftString )
printVarSummary(diffAntiLog)
plotAntiLog = kf_draw( wks, diffAntiLog(freq|:,k|:), \
"None", False, True, res )
cjs_add_contours( wks, plotAntiLog, hirsAntiLog(freq|:,k|:), cntRes )
......@@ -132,7 +163,7 @@ begin ; main
+ "+repage -density " + plotDpi + " " \\
+ plotName + ".eps " + plotName + "." + plotType )
if( .not.isStrSubset( plotType, "e" ) ) then
; system( "rm -f " + plotName + ".eps" )
system( "rm -f " + plotName + ".eps" )
end if
end if
......
Supports Markdown
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