[ncl-talk] Problem with contour map shading
Priyanka Silva
priyankakeraminiya6 at gmail.com
Thu Apr 20 01:26:30 MDT 2017
Hi all,
I want to shade the areas exceeding 95% confidence level in my correlation
plot only for the ocean, but when I plot I could see the shading on the
land too. How can I remove the shading on the land?
My script and plot are as follows.
Greatly appreciate your help.
Thank you.
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"
begin
;*******************************************************************************
;Seasonal mean precipitation averaged over the domain
;*****************************************************************************
f = "mon.precip.nc"
fin = addfile(f, "r")
time = fin->time
ymd = cd_calendar(time,2)
iTim = ind (ymd.ge.19790101.and.ymd.lt.20130101)
preci = fin->precip(iTim,{6:10},{79:82})
;printVarSummary(precip)
;-------------------------------------------------------------------------
p = month_to_season(preci,"JJA")
printVarSummary(p)
;--------------------------------------------------------------------------
index =dim_avg_Wrap (dim_avg_Wrap (p (time|:,lat|:,lon|:)))
printVarSummary(index)
;************************************************************************
; correlation between the precipitation and the global SST
;************************************************************************
f1 = "HadISST_sst.nc"
fin1 = addfile(f1, "r")
time1 = fin1->time
ymd1 = cd_calendar(time1,2)
iTim1 = ind (ymd1.ge.19790101.and.ymd1.lt.20130101)
sst = fin1->sst(iTim1,:,:)
;;------------------------------------------------------------------------
s = month_to_season(sst,"JJA")
;printVarSummary(s)
;-------------------------------------------------------------------------
ccr = escorc(index,s(latitude|:,longitude|:,time|:))
copy_VarCoords(sst(0,:,:),ccr)
printVarSummary(ccr)
;------------------------------------------------------------------------
siglvl = 0.05
Prob = rtest(ccr(latitude|:,longitude|:),34,0)
Prob!0 = "lat"
Prob!1 = "lon"
Prob&lat = ccr&latitude
Prob&lon = ccr&longitude
printVarSummary(Prob)
;-------------------------------------------------------------------------
wks = gsn_open_wks("x11","Correlation")
gsn_define_colormap(wks,"BlWhRe")
;-------------------------------------------------------------------------
res = True
res at cnFillOn = True
res at cnLinesOn = False
res at cnLevelSelectionMode = "ManualLevels"
res at cnMinLevelValF = -.8
res at cnMaxLevelValF = .8
res at cnLevelSpacingF = 0.1
res at gsnSpreadColors = True
res at mpPerimOn = False
res at mpCenterLonF =180
res at tiMainString = ""
res at gsnLeftString = "JJA"
res at mpFillOn = False
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
res1 at mpLandFillColor ="gray"
res1 at gsnShadeDotSizeF =3
;-----------------------------------------------------------------------------
plot = gsn_csm_contour_map(wks,ccr,res)
opt = True
opt at gsnShadeFillType = "pattern" ; pattern fill
opt at gsnShadeLow = 17 ; use pattern 17
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]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170420/e6c40c78/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 97171 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170420/e6c40c78/attachment.png
More information about the ncl-talk
mailing list