::::::::::::::
pl.qnet.ncl
::::::::::::::
;
; Plot OAFLUX
;
; http://www.ncl.ucar.edu/Support/talk_archives/2009/1870.html
;
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
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"
begin
latS =-89
latN =89
lonL =0
lonR =359
diri = "./"
var = "qnet"
ys=2000
ye=2009
fili1 = "qnet_"+ys+".nc"
setfileoption ("nc", "MissingToFillValue", False) ; turn off default behavior
f = addfiles (diri+fili1, "r")
xShort = f[:]->$var$(:,{latS:latN},{lonL:lonR})
; fix non standard attributes
x = short2flt( xShort )
printVarSummary(xShort)
x = short2flt( xShort )
printVarSummary( x )
printMinMax( x, True )
dsizes = new( (/3/),integer)
dsizes = dimsizes(x)
nlat=dsizes(1)
nlon=dsizes(2)
x2D = new( (/nlat,nlon/),float)
x2D(:,:)=x(1,:,:)
x2D(:,:)=0.0
x2D&lat@units = "degrees_north"
x2D&lon@units = "degrees_east"
printVarSummary(x2D)
do iy=ys,ye
print(iy)
; QNET
var = "qnet"
fili = "qnet_"+iy+".nc"
setfileoption ("nc", "MissingToFillValue", False) ; turn off default behavior
f = addfiles (diri+fili, "r")
xShort = f[:]->$var$(:,{latS:latN},{lonL:lonR}) ; fix non standard attributes
xShort@_FillValue = doubletoshort(xShort@missing_value)
delete(xShort@missing_value) ; delete badly typed attribute
xShort@missing_value = xShort@_FillValue ; assign correct type
; fix non-udunits for lat and lon
xShort&lat@units = "degrees_north"
xShort&lon@units = "degrees_east"
x = short2flt( xShort )
do i=0,11
do j=0,nlat-1
do k=0,nlon-1
x2D(j,k)=x2D(j,k)+x(i,j,k)
end do ;k
end do ;j
end do ;i
end do ;iy
x2D(:,:)=x2D(:,:)/12.0/(ye-ys+1)
x2D(:,:)=(-1.0)*x2D(:,:) ; Upward POSITIVE
wks = gsn_open_wks("ps","qnet_oaflux_"+ys+"-"+ye)
gsn_define_colormap(wks,"BlueDarkRed18")
res = True
; res@gsnFrame = False
res@vpWidthF = 0.5*1.9
res@vpHeightF = 0.32*1.9
res@vpXF = .1*0.1
; res@vpYF = .75
res@mpProjection = "Robinson" ; choose projection
res@mpFillOn = False
res@mpGridAndLimbOn = True ; turn on lat/lon lines
res@mpPerimOn = False
res@mpGridLatSpacingF = 90 ; change latitude line spacing
res@mpGridLonSpacingF = 180. ; change longitude line spacing
res@mpGridLineColor = "transparent" ; trick ncl into drawing
; res@gsnAddCyclic = False ; Turn off longitudinal cyclic point ; perimeter
res@mpCenterLonF = 200.
res@cnFillOn = True ; color plot desired
res@cnLinesOn = False ; turn off/on contour lines
res@cnLineLabelsOn = False ; turn off contour lines
res@cnLineColor = "Background"
res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
res@cnMinLevelValF = -150. ; set min contour level
res@cnMaxLevelValF = 150. ; set max contour level
res@cnLevelSpacingF = 50. ; set contour spacing
res@lbLabelFontHeightF = 0.02
res@pmLabelBarHeightF = 0.07
res@pmLabelBarWidthF = 0.6
res@pmLabelBarOrthogonalPosF = 0.025
res@gsnLeftString = ""
res@gsnCenterString = ""
res@gsnRightString = ""
plot = gsn_csm_contour_map(wks,x2D,res) ; Draw a contour plot.
end