[ncl-talk] Problems in shading areas exceeding 95% confidence level
Adam Phillips
asphilli at ucar.edu
Tue Jun 6 14:42:57 MDT 2017
Hi Dinuka,
Try adding these resources to your script:
res at mpFillOn = True
res at mpFillColors = (/-1,0,-1,-1/)
res at mpFillDrawOrder = "PostDraw"
The above should tell NCL to color the oceans white, and to apply the map
fill at the end (and thus hopefully overlaying the stippling over the
ocean).
If that does not work let ncl-talk know.
Adam
On Mon, Jun 5, 2017 at 3:39 AM, Dinuka Silva <dinu.kera at gmail.com> wrote:
> Hello,
> I'm having problems in shading areas exceeding 95% confidence level. I
> want to plot correlation between precipitation and T2m temperature only for
> land area. So I masked T2m temperature for land and plot the correlation
> map. I also want to shade the areas exceeding 95% significance level.
> I could shade the areas exceeding 95% confidence level on land but all
> the ocean areas are also shaded (missing value area). How can I remove the
> shading on ocean. I use ncl version 6.3.0.
> My ncl code and plot are as follows.
>
> Thank You.
> Dinuka
>
>
>
> 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/diagnostics_cam.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> ;----------------------------------------------------------------
> begin
> f = "mon.precip.nc"
> fin1 = addfile(f, "r")
> time3 = fin1->time
> ;---------------------------------------------------------------------
> ymd3 = cd_calendar(time3,2)
> iTim2 = ind (ymd3.ge.19790101.and.ymd3.lt.20130101)
> ;--------------------------------------------------------------------
> preci = fin1->precip(iTim2,{6:10},{79:82})
> printVarSummary(preci)
> pano = rmMonAnnCycTLL(preci)
> ;----------------------------------------------------------------------
> p = month_to_season(pano,"JJA")
> printVarSummary(p)
> index =dim_avg_Wrap (dim_avg_Wrap (p (time|:,lat|:,lon|:)))
> ;***********************************************************************
> ; T2M over land
> ;**********************************************************************
> ECMWF = "/home/dinu/ecmwf/monthly/"
> files = systemfunc ("ls "+ECMWF+"t2/t2.mon.*.nc")
> fin = addfiles (files, "r")
> time = fin[:]->time
> ;----------------------------------------------------------------
> ymd = cd_calendar(time,2)
> iTim = ind (ymd.ge.19790101.and.ymd.lt.20130101)
> ;----------------------------------------------------------------
> T2 = fin[:]->t2(iTim,:,:)
> T2 = T2-273.15
> T2 at units = "C"
> ;------------------------------------------------------------
> f1 = systemfunc("ls /home/dinu/data/landsea.nc")
> a = addfile(f1, "r")
>
> ;a = addfile("landsea.nc","r")
> lsdata = a->LSMASK
> lsm = landsea_mask(lsdata,T2&lat,T2&lon)
> t2 = mask(T2,lsm.eq.0,False)
> copy_VarCoords(T2,t2)
> ;-------------------------------------------------------------
> Temp = month_to_season(t2,"JJA")
> ;***********************************************************
> ***************
> ; Correlation Rainfall and T2M
> ;***********************************************************
> ***************
> ccr = escorc(index,Temp(lat|:,lon|:,time|:))
> copy_VarCoords(t2(0,:,:),ccr)
> printVarSummary(ccr)
> ;------------------------------------------------------------------------
> siglvl = 0.05
> Prob = rtest(ccr(lat|:,lon|:),34,0)
>
> Prob!0 = "lat"
> Prob!1 = "lon"
> Prob&lat = ccr&lat
> Prob&lon = ccr&lon
> printVarSummary(Prob)
> ;___________________________________________________________
> _______________
> wks =gsn_open_wks("X11","")
> gsn_define_colormap(wks,"BlueDarkRed18")
>
> res = True
> res at cnLinesOn = False
> res at cnFillOn = True ; turn color on
> res at gsnSpreadColors = True
> res at cnLineLabelsOn = False
> res at tiMainString = " "
> res at cnLevelSelectionMode = "ManualLevels" ; manually set cn levels
> res at cnMinLevelValF = -0.4 ; min level
> res at cnMaxLevelValF = 0.4 ; max level
> res at cnLevelSpacingF = 0.1 ; contour level spacing
> ;res at cnLabelAutoSrtide = True
> res at mpCenterLonF =180
> res at gsnDraw = False
> res at gsnFrame = False
>
> res1 = True
> res1 at gsnAddCyclic = False
> res1 at gsnDraw = False
> res1 at gsnFrame = False
> res1 at cnLevelSelectionMode = "ManualLevels"
> res1 at cnMinLevelValF = 0.00
> res1 at cnMaxLevelValF = 1.05
> res1 at cnLevelSpacingF = 0.05
> res1 at cnInfoLabelOn = False
> res1 at cnLinesOn = False
> res1 at cnLineLabelsOn = False
> res1 at cnFillScaleF = 0.6 ; add extra density
> ;************************************************************************
>
> plot = gsn_csm_contour_map(wks,ccr,res)
> plot = gsn_csm_contour_map(wks,ccr,res)
>
> opt = True
> opt at gsnShadeFillType = "pattern" ; pattern fill
> opt at gsnShadeLow = 17 ; use pattern 17
> opt at gsnShadeDotSizeF = 0.3
>
>
> plot1 = gsn_csm_contour(wks,Prob, res1)
> plot1 = gsn_contour_shade(plot1,0.05,0.75,opt)
>
> overlay (plot, plot1)
> draw(plot)
> frame (wks)
>
> end
>
> [image: Inline image 1]
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170606/495d8f2f/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 113798 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170606/495d8f2f/attachment.png
More information about the ncl-talk
mailing list