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

Automated Nightly Commit - Sat Oct 17 00:00:13 EDT 2015

parent 30802a8f
......@@ -11,9 +11,9 @@ undef ( "calc_meanvar" )
function calc_meanvar( \
i_inPath [1] : string, \
i_varName [1] : string, \
i_plotName [1] : string, \
i_minYear [1] : numeric, \
i_maxYear [1] : numeric, \
i_meanNotVar [1] : logical \
i_maxYear [1] : numeric \
)
begin ; calc_meanvar
print_clock( "Calculating for " + i_inPath )
......@@ -23,9 +23,9 @@ begin ; calc_meanvar
maxTime = cd_inv_calendar( i_maxYear, 12, 31, 18, 0, 0, timeUnits, 0 )
inFile = addfile( i_inPath, "r" )
allData = inFile->$i_varName$({minTime:maxTime},:,:)
allData = inFile->$i_varName$({minTime:maxTime},{-65:65},:)
if( i_meanNotVar ) then
if( i_plotName.eq."mean" ) then
retVal = dim_avg_n_Wrap( allData, 0 )
else
retVal = dim_variance_n_Wrap( allData, 0 )
......
......@@ -12,27 +12,35 @@ load "/home/carl/projects/olr_cdr/compare/sub.calc_meanvar.ncl"
undef ( "draw_meanvar" )
function draw_meanvar( \
io_wks [1] : graphic, \
i_meanNotVar [1] : logical, \
i_plotVar [1] : string, \
i_res [1] : logical, \
i_cntRes [1] : logical \
)
begin ; draw_meanvar
; These are some parameters that could be useful to have up top
varName = "olr"
if( ( i_plotVar.eq."mean" ).or.( i_plotVar.eq."variance" ) ) then
varName = "olr"
else
varName = i_plotVar
end if
minYear = 1981
maxYear = 2010
if( i_meanNotVar ) then
if( i_plotVar.eq."mean" ) then
fileName = "olr.total.nc"
units = "W m-2"
else
else if( i_plotVar.eq."variance" ) then
fileName = "olr.anom.nc"
units = "(W m-2)^2"
else
fileName = "olr.std.waves.nc"
units = "(W m-2)^2"
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, minYear, maxYear, i_meanNotVar )
avhrrData = calc_meanvar( avhrrPath, varName, minYear, maxYear, i_meanNotVar )
hirsData = calc_meanvar( hirsPath, varName, i_plotVar, minYear, maxYear )
avhrrData = calc_meanvar( avhrrPath, varName, i_plotVar, minYear, maxYear )
hirsRegrid = copy_Gridding( avhrrData, hirsData )
diffData = hirsRegrid - avhrrData
......@@ -47,26 +55,33 @@ begin ; draw_meanvar
res@mpMaxLatF = 60
res@gsnMajorLonSpacing = 45
res@gsnMinorLonSpacing = 15
res@gsnLeftString = str_upper( i_plotVar )
res@gsnRightString = minYear + " - " + maxYear
res@cnFillPalette = "colorbrewer_coldhot"
res@pmLabelBarOrthogonalPosF = 0
res@pmLabelBarOrthogonalPosF = 0.4
if( i_res ) then
copy_VarAtts( i_res, res )
end if
cntRes = True
if( i_cntRes ) then
copy_VarAtts( i_cntRes, cntRes )
end if
cntRes@gsnContourNegLineDashPattern = 0
cntRes@cnLinePalette = "gray" + ispan(70,10,1)
cntRes@cnMonoLineColor = False
cntRes@cnLineLabelsOn = True
cntRes@cnMaxLevelCount = 8
if( i_cntRes ) then
copy_VarAtts( i_cntRes, cntRes )
end if
retVal = cjs_draw_shaded_map( io_wks, diffData, res )
cjs_add_contours( io_wks, retVal, hirsData, cntRes )
printMinMax( hirsData, True )
printMinMax( diffData, True )
return(retVal)
end; draw_meanvar
......@@ -28,7 +28,7 @@ begin ; main
plotType = "png"
plotDpi = 200
plotName = "figures/total_meanvar_map"
plotName = "figures/mean_var_map"
; ...allows png or gif to work
if( ( plotType.eq."png" ).or.( plotType.eq."gif" ) ) then
......@@ -40,19 +40,17 @@ begin ; main
; ...open the workstation
wks = gsn_open_wks( plotTypeLocal, plotName )
meanNotVar = True
plotVar = "mean"
res = True
res@gsnLeftString = "Mean"
res@fontHeightF = 0.015
res@cnLevels := ispan(-5,5,1) * 5
cntRes = True
res@cnLevels = ispan(-5,5,1) * 5
meanPlot = draw_meanvar( wks, meanNotVar, res, cntRes )
meanPlot = draw_meanvar( wks, plotVar, res, cntRes )
meanNotVar = False
res = True
res@gsnLeftString = "Variance"
plotVar = "variance"
res@cnLevels := ispan(-5,5,1) * 50
cntRes = True
res@cnLevels = ispan(-5,5,1) * 50
varPlot = draw_meanvar( wks, meanNotVar, res, cntRes )
varPlot = draw_meanvar( wks, plotVar, res, cntRes )
; Customize panel
......
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; meanvar.ncl
; Carl Schreck (cjschrec@ncsu.edu)
; September 2014
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Description: Compare maps of variance or mean
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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/lib.cjs_graphics.ncl"
load "$CJS_NCL_LIB/lib.array.ncl"
load "$CJS_NCL_LIB/print_clock.ncl"
load "/home/carl/projects/olr_cdr/compare/sub.calc_meanvar.ncl"
load "/home/carl/projects/olr_cdr/compare/sub.draw_meanvar.ncl"
begin ; main
print_clock( "Here we go!" )
; These are some parameters that could be useful to have up top
plotType = "png"
plotDpi = 200
plotName = "figures/wave_var_map"
; ...allows png or gif to work
if( ( plotType.eq."png" ).or.( plotType.eq."gif" ) ) then
plotTypeLocal = "eps"
else
plotTypeLocal = plotType
end if
; ...open the workstation
wks = gsn_open_wks( plotTypeLocal, plotName )
plotVar = "low"
res = True
cntRes = True
res@cnLevels = ispan(-5,5,1) * 50
lowPlot = draw_meanvar( wks, plotVar, res, cntRes )
plotVar = "mjo"
res = True
cntRes = True
res@cnLevels = ispan(-5,5,1) * 5
mjoPlot = draw_meanvar( wks, plotVar, res, cntRes )
plotVar = "kelvin"
res = True
cntRes = True
res@cnLevels = ispan(-5,5,1) * 50
kelvinPlot = draw_meanvar( wks, plotVar, res, cntRes )
plotVar = "er"
res = True
cntRes = True
res@cnLevels = ispan(-5,5,1) * 50
erPlot = draw_meanvar( wks, plotVar, res, cntRes )
; Customize panel
panRes = True
panRes@gsnPanelYWhiteSpacePercent = 5
gsn_panel( wks, (/ lowPlot, mjoPlot, kelvinPlot, erPlot /), (/ 4, 1 /), panRes )
print_clock( "Convert the image, if necessary" )
delete(wks)
if( isStrSubset( plotType, "png" ).or.isStrSubset( plotType, "gif" ) ) then
system( "convert -trim -border 5x5 -bordercolor white " \
+ "+repage -density " + plotDpi + " " \\
+ plotName + ".eps " + plotName + "." + plotType )
end if
print_clock( "Thank you, come again." )
end; main
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