[ncl-talk] Fwd: Problem with contour map shading
Priyanka Silva
priyankakeraminiya6 at gmail.com
Thu Apr 20 23:21:50 MDT 2017
Still I have the same problem.
---------- Forwarded message ----------
From: Barry Lynn <barry.h.lynn at gmail.com>
Date: Thu, Apr 20, 2017 at 4:59 PM
Subject: Re: [ncl-talk] Problem with contour map shading
To: Priyanka Silva <priyankakeraminiya6 at gmail.com>
Cc: ncl-talk <ncl-talk at ucar.edu>
Hi Priyanka:
Try the "mask" routine.
range_only = snowh_rate_dom ; trick to keep
cv's and atts
range_only = mask(snowh_rate_dom,(snowh_rate_dom.ge.0.1),True)
I think you can add a conditional about whether you are over land and/or
ocean.
Barry
On Thu, Apr 20, 2017 at 10:26 AM, Priyanka Silva <
priyankakeraminiya6 at gmail.com> wrote:
> 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]
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
--
Barry H. Lynn, Ph.D
Senior Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581
C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
US 914 432 3108
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170421/3561a0f9/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/20170421/3561a0f9/attachment.png
More information about the ncl-talk
mailing list