Commit 7669a00d authored by Carl Schreck's avatar Carl Schreck
Browse files

Automated Nightly Commit - Thu Jun 23 00:00:14 EDT 2016

parent 3da6bd95
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; draw_diff_series.ncl
; Carl Schreck (cjschrec@ncsu.edu)
; February 2016
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Description: Draw times series of differences in two datasets over a region
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
load "$CJS_NCL_LIB/lib.cjs_graphics.ncl"
load "$CJS_NCL_LIB/lib.array.ncl"
load "$CJS_NCL_LIB/print_clock.ncl"
begin ; main
print_clock( "Here we go!" )
; These are some parameters that could be useful to have up top
plotType = "png"
plotName = "figures/blank"
plotDpi = 200
fontHeightF = 0.02
timeUnits = "days since 1800-01-01 00:00:00"
minTime = cd_inv_calendar( 2008, 01, 01, 00, 0, 0, timeUnits, 0 )
maxTime = cd_inv_calendar( 2009, 12, 31, 18, 0, 0, timeUnits, 0 )
minLat = -90
maxLat = 90
print_clock( "Reading AVHRR" )
inPath = "/home/carl/data/olr/compare/avhrr/olr.total.nc"
inFile = addfile( inPath, "r" )
avhrrData = inFile->olr({minTime:maxTime},{minLat:maxLat},:)
print_clock( "Reading HIRS" )
inPath = "/home/carl/data/olr/compare/hirs/olr.total.nc"
inFile = addfile( inPath, "r" )
hirsData = inFile->olr({minTime:maxTime},{minLat:maxLat},:)
print_clock( "Differencing" )
hirsRegrid = copy_Gridding( avhrrData, hirsData )
diffData = hirsRegrid - avhrrData
copy_VarCoords( avhrrData, diffData )
; stdData = dim_stddev_n_Wrap( diffData, (/ 1, 2 /) )
stdData = sqrt( dim_avg_n( diffData^2, (/ 1, 2 /) ) )
copy_VarCoords( diffData(:,0,0), stdData )
print_clock( "Opening the workstation" )
; ...allows png or gif to work
if( isStrSubset( plotType, "png" ).or.isStrSubset( plotType, "gif" ) ) then
plotTypeLocal = "eps"
else
plotTypeLocal = plotType
end if
wks = gsn_open_wks( plotTypeLocal, plotName )
; Customize base plot
res = True
res@gsnYRefLine = avg(stdData)
res@tmXBLabelAngleF = 45
res@tmXBLabelJust = "CenterRight"
res@xyLineColor = "transparent"
resTick = True
month_axis_labels( minTime, 3, 1, 1, res, resTick )
plot = cjs_draw_xy( wks, stdData&time, stdData, res )
draw( plot )
frame( wks )
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 )
if( .not.isStrSubset( plotType, "e" ) ) then
system( "rm -f " + plotName + ".eps" )
end if
end if
print_clock( "Thank you, come again." )
end; main
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; correlation.ncl
; Carl Schreck (carl.schreck@noaa.gov)
; September 2011
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Description: Plot the point-by-point correlation between two fields
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
load "$CJS_NCL_LIB/lib.cjs_graphics.ncl"
load "$CJS_NCL_LIB/lib.array.ncl"
load "$CJS_NCL_LIB/print_clock.ncl"
begin
print_clock( "Here we go!" )
; These are some parameters that could be useful to have up top
plotType = "png"
plotName = "figures/histo2d"
plotDpi = 200
fontHeightF = 0.02
; shdLevels = ispan(-7,7,1)
shdLevels = -999
minLon = 000
maxLon = 360
minLat = -30
maxLat = 30
centerLon = 180
timeUnits = "days since 1800-01-01 00:00:00"
minTime = cd_inv_calendar( 1979, 01, 01, 00, 0, 0, timeUnits, 0 )
maxTime = cd_inv_calendar( 2013, 12, 31, 18, 0, 0, timeUnits, 0 )
hirsBin = ispan( 210, 350, 5 )
avhrrBin = ispan( 210, 350, 5 )
print_clock( "Reading the data" )
print_clock( "Reading AVHRR" )
inPath = "/home/carl/data/olr/compare/avhrr/olr.total.nc"
inFile = addfile( inPath, "r" )
avhrrData = inFile->olr({minTime:maxTime},{minLat:maxLat},:)
print_clock( "Reading HIRS" )
inPath = "/home/carl/data/olr/compare/hirs/olr.total.nc"
inFile = addfile( inPath, "r" )
hirsData = inFile->olr({minTime:maxTime},{minLat:maxLat},:)
print_clock( "Regridding" )
hirsRegrid = copy_Gridding( avhrrData, hirsData )
hirs1d = ndtooned( hirsRegrid )
avhrr1d = ndtooned( avhrrData )
copy_VarAtts( hirsData, hirs1d )
copy_VarAtts( avhrrData, avhrr1d )
; Customize base plot
res = True
res@gsnDraw = False
res@gsnFrame = False
res@gsnLeftString = ""
res@gsnRightString = ""
; ...standardize the font sizes
res@cnInfoLabelFontHeightF = fontHeightF
res@gsnLeftStringFontHeightF = fontHeightF
res@gsnRightStringFontHeightF = fontHeightF
res@lbTitleFontHeightF = fontHeightF
res@lbLabelFontHeightF = fontHeightF
res@tiMainFontHeightF = fontHeightF * 1.3
res@tiYAxisFontHeightF = fontHeightF
res@tiXAxisFontHeightF = fontHeightF
res@tmXBLabelFontHeightF = fontHeightF
res@tmYLLabelFontHeightF = fontHeightF
; ...shading resources
res@cnFillOn = True
res@cnFillMode = "CellFill"
res@cnRasterSmoothingOn = True
res@cnMonoFillColor = False
res@cnInfoLabelOn = False
res@cnLineLabelsOn = False
res@cnLinesOn = False
res@cnLineColor = "gray"
res@cnMissingValFillPattern = "SolidFill"
res@cnMissingValFillColor = "gray"
; ...set the contour levels
if( shdLevels(0).eq.-999 ) then
res@cnMaxLevelCount = 8
else
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = shdLevels
end if
res@gsnSpreadColors = True
res@gsnSpreadColorStart = 10
res@gsnSpreadColorEnd = 18
; ...labelbar resources
res@lbLabelBarOn = True
res@lbLabelAutoStride = True
res@lbOrientation = "Vertical"
res@lbTitlePosition = "Right"
res@lbTitleDirection = "Across"
; res@lbTitleString = data@units
; res@pmLabelBarOrthogonalPosF = fontHeightF * 5
; res@pmLabelBarHeightF = fontHeightF * 2
res@plotPercent = True
res@setZeroToMissing = True
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
; ...open the workstation
wks = gsn_open_wks( plotTypeLocal, plotName )
gsn_merge_colormaps( wks, "posneg_carl", "default" )
plot = cjs_draw_hist2d( wks, hirs1d, avhrr1d, hirsBin, avhrrBin, res )
draw( plot )
frame( wks )
print_clock( "Convert the image, if necessary" )
delete(wks)
if( ( plotType.eq."png" ).or.( plotType.eq."gif" ) ) then
system( "convert -trim +repage -density " + plotDpi + " " \\
+ plotName + ".eps " + plotName + "." + plotType )
; system( "rm -f " + plotName + ".eps" )
end if
print_clock( "Thank you, come again." )
end
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