Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Carl Schreck
OLR CDR
Commits
b651f507
Commit
b651f507
authored
Oct 17, 2015
by
Carl Schreck
Browse files
Automated Nightly Commit - Sat Oct 17 00:00:13 EDT 2015
parent
30802a8f
Changes
4
Hide whitespace changes
Inline
Side-by-side
compare/sub.calc_meanvar.ncl
View file @
b651f507
...
...
@@ -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 )
...
...
compare/sub.draw_meanvar.ncl
View file @
b651f507
...
...
@@ -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_
meanN
otVar [1] :
logical
, \
i_
pl
otVar
[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
compare/total_meanvar.ncl
View file @
b651f507
...
...
@@ -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 )
meanN
otVar =
True
pl
otVar =
"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
...
...
compare/wave_meanvar.ncl
0 → 100644
View file @
b651f507
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment