[ncl-talk] plot the dot on the grids with significant trends
WUJIE
393069045 at qq.com
Sun Sep 9 10:40:53 MDT 2018
Hi NCL users,
I am trying to plot the spatial distribution of the trends in annual evaporation. My plan is to show trends for all grids but cover those grids with dots if its trends are significant (i.e. p<0.05).
I calculate rc using the NCL guide and use rc_sig to show only the sigificant trend. I have tested the way to derive rc is correct. I then tried the procedure gsn_coordinates but I got a very big PDF which shows all black. Does any one can help me on this?
If what I did is not correct, could you please give me some clues for drawing such plots?
Thanks so much
Jie.
;----ATTACH CODES HERE-----
;-----------read data and calculate rc------
Ea = ncfile->Ea ; mm/month
Ea_annual = month_to_annual (Ea, 0) ; monthly to annaul
Ea_annual!0 = "time"
Ea_annual&time =(/ispan(1980,2015,1)/)
Ea_annual_0 = Ea_annual (lat|:,lon|:,time|:) ;re-order to make time as rightmost
time = Ea_annual_0&time
rc = regCoef(time,Ea_annual_0) ;tends with /plat,plon/
rc at long_name = "Trend of annual Ea" ; trend
rc at units = "(mm yr~S~-1~N~)"
printVarSummary(rc)
printMinMax (rc, True)
;-----make all data become (plat,plon)------
tval = onedtond(rc at tval , dimsizes(rc))
df = onedtond(rc at nptxy, dimsizes(rc)) - 2 ;The FillValue grid will be =0 for nptxy. So df may<0
df at _FillValue=-9999
df = where(df.le.0,df at _FillValue,df)
b = tval ; b must be same size as tval (and df)
b = 0.5
;----betainc (x,a,b): 0<x<1, a>0,b>0)-----
;----ony if this value<0.05, means p<0.05----
prob = betainc(df/(df+tval^2), df/2.0, b)
copy_VarCoords(Ea_annual_0(:,:,0), prob)
;-----only significant rc with p<0.05-------
rc_sig = new ((/plat,plon/),float)
rc_sig at _FillValue=-9999
copy_VarCoords(Ea_annual_0(:,:,0), rc_sig)
rc_sig= where(prob.lt.0.05,rc,rc_sig at _FillValue)
HERE SKIP SOME LINES
;---plot------------------
plot=new(1,graphic)
plot = gsn_csm_contour_map_overlay(wks,rc,Basin,res,res2)
pres = True
pres at gsMarkerSizeF = 0.007 ; default is 0.007
gsn_coordinates(wks,plot,rc_sig,pres)
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180910/e0c5a13c/attachment.html>
More information about the ncl-talk
mailing list