[ncl-talk] Sub: Plot is empty..
Adv
advita6 at gmail.com
Sun Jul 12 20:54:46 MDT 2015
Hi ,
Could someone point out the error in this script? It plots no values. Many
times i checked, the values are proper. I think graphical part has issues.
;****************************************************
;****************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
;***************************************************
;***************************************************
begin
;***************************************************
;prec*.25x.25cpc1948-present-usa grid
;others*2.25x2.25cpc1948-present-globalgrid
f1 = addfile("tas_Amon_CCSM4_historical_r3i1p1_185001-200512.nc", "r")
; note the "s" of addfile
u1 = f1->tas
printVarSummary(u1) ; [time| 720]x[lat|
91]x[lon| 180]
;;;;;;1961-2005;;;;;;;;;;;;;;;;;
ua1=u1(lat|:,lon|:,time|1332:)
ua11=u1(time|1332:,lat|:,lon|:)
printVarSummary(ua1) ; [time| 720]x[lat|
91]x[lon| 180]
ua11 = ua11-273.15
ua11 at units= "degC"
;return
yyyymm = cd_calendar(ua11&time, -1)
yyyy = yyyymm/100
dimx = dimsizes(ua11)
ntim = dimx(0) ; all years and months
year = ispan(yyyy(0), yyyy(ntim-2), 1)
print(year)
nyrs = dimsizes(year)
print(nyrs)
;return
;delete(u)
xann1 = month_to_annual(ua11 , 1) ; [year| 60]x[lat|
91]x[lon| 180]
printVarSummary(xann1)
xann1&year = year
rc1 = regCoef(year,xann1(lat|:,lon|:,year|:))
copy_VarCoords(ua11(0,:,:), rc1)
rc1=rc1*45
tval1 = onedtond(rc1 at tval , dimsizes(rc1))
printVarSummary(tval1)
df1 = onedtond(rc1 at nptxy, dimsizes(rc1)) - 2
printVarSummary(df1)
b = 0.5
t4=onedtond(0.5,dimsizes(rc1))
prob1 = (1-betainc(df1/(df1+tval1^2),df1/2.0,t4))
print(prob1)
printVarSummary(prob1)
copy_VarCoords(rc1,prob1)
printVarSummary(prob1)
;return
print(prob1)
print(min(prob1))
print(max(prob1))
printVarSummary(prob1)
;**************************************************
; plot parameters
;**************************************************
wks =
gsn_open_wks("x11","NorthernPlains_Significant_AirTemp_1961-2005")
; Open ps file
gsn_define_colormap(wks,"gui_default") ; assign colormap
plot = new(1,graphic) ; create a plot array
res = True
res at gsnDraw = False ; don't draw
res at gsnFrame = False ; don't advance frame
res at cnInfoLabelOn = False ; turn off cn info label
res at cnLinesOn = False ; turn off contour lines
res at cnFillOn = True ; color plot desired
res at cnLineLabelsOn = False
res at lbLabelBarOn = False ; turn off individual cb's
res at txFontHeightF = 0.030 ; adjust font height of
gsnLeftString/gsnRightString titles
res at cnLevelSelectionMode = "ExplicitLevels" ; set
explicit contour levels
; res at cnLevels = (/ 10,20,30,40,50,60,70,80,90,100/)
res at cnLevels = (/ 0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.1/)
res at vpWidthF = 0.90 ; change aspect ratio of
plot
res at vpHeightF = 0.90
res at vpXF = 0.05
res at vpYF = 0.95
; map resources for projection
res at mpGridAndLimbOn = False
res at gsnTickMarksOn = False
;***************************************************
res at mpLimitMode = "LatLon"
res at mpMinLatF = 40.
res at mpMaxLatF = 49.
res at mpMinLonF = 242.
res at mpMaxLonF = 264.
res at mpCenterLonF = 252
res at mpPerimOn = True ; draw box around
map
res at mpGeophysicalLineThicknessF = 3.0
res at mpGeophysicalLineColor = "Black"; (/22/)
;res at mpNationalLineThicknessF = 3.0
res at mpOutlineBoundarySets = "GeophysicalAndUSStates" ; add state boundaries
res at mpNationalLineColor = res at mpGeophysicalLineColor
res at mpUSStateLineThicknessF = 3.0
res at mpUSStateLineColor = res at mpGeophysicalLineColor
res at gsnAddCyclic = False
; to take advantage of NCL's automatic labeling, we need to assign som
attributes:
plot(0) = gsn_csm_contour_map_ce(wks,prob1,res)
;return
;************************************************
; create panel
;************************************************
resP = True ; modify the panel plot
resP at gsnFrame = False ; don't advance the frame,
so we can use gsn_text_ndc
resP at gsnPanelLabelBar = True ; add common colorbar
resP at lbLabelFontHeightF = 0.015 ; set font height of Label
Bar labels
resP at gsnPanelBottom = 0.2 ; shrink panel plot by
setting bottom edge of plot
resP at gsnPanelTop = 0.9 ; shrink panel plot by
setting top edge of plot
resP at pmLabelBarWidthF = 0.7 ; make thinner
resP at pmLabelBarHeightF = 0.09
resP at gsnPanelYWhiteSpacePercent = 5. ; increase spacing along
Y-axis between panel plots
resP at txString = "NorthernPlains_AirTemperature_Significant_1961-2005"
gsn_panel(wks,plot,(/1,1/),resP) ; now draw as one plot
end
Thank you,
Adv
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150712/8f264f67/attachment.html
More information about the ncl-talk
mailing list