[ncl-talk] masking query

Alan Brammer abrammer at albany.edu
Tue Oct 7 07:31:19 MDT 2014


Assuming this is a contuintation of the questions from Aug 30th.your mask
consists of these values. As found in the ncl website.

 *0=ocean, 1=land, 2=lake, 3=small island, 4=ice shelf*.

totc_ocean_only = mask(totc,lsm.ge.0,True)

You should be using logic that matches what you want. .ge.0 is masking
everything. Try different options. Eg.  .eq. 0  .gt.0  until you work out
the logic that suits your needs.

Good luck,
Alan
On 7 Oct 2014 08:23, "Kunal Bali" <kunal.bali9 at gmail.com> wrote:

> Dear NCL users
>
> Here i am trying to display the data only over OCEAN regions. I don't want
> to include the land data.But i am not getting the exact results. The result
> is coming over both land and ocean regions.
>
> I want only ocean data.
>
> Here is my script
> ;----------------------------------------------------------------------
>
> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> begin
> ;---Read data
>   a   = addfile("/home/kunal/Pictures/NCL_Scripts/04-01.nc","r")
>   totc = a->TotCH4_A
>   printVarSummary(totc)
>
> ;---Open workstation and change color map
>
>     wks_type = "pdf"
>     wks_type at wkPaperSize = "A4"
>     wks = gsn_open_wks(wks_type,"sample2")
>
>
> ;---Set some resources
>   res                   = True
>
>   res at gsnMaximize       = True     ; maximize plot in frame
>
>   res at cnFillOn          = True     ; turn on contour fill
>   res at cnLinesOn         = False    ; turn off contour lines
>   res at cnLineLabelsOn    = False    ; turn off line labels
>
>   res at tiMainString      = "MAP"
>
>   res at gsnAddCyclic      = False
>
>   plot = gsn_csm_contour_map(wks,totc,res)
>
> ;---Mask totc using land/sea mask file
>   mfile          = addfile("/usr/local/lib/ncl/lib/ncarg/data/cdf/
> landsea.nc","r")
>   lsmask         = mfile->LSMASK
>   lsm            = landsea_mask(lsmask,totc&Latitude,totc&Longitude)
>   totc_ocean_only = mask(totc,lsm.ge.0,True)
>   copy_VarMeta(totc,totc_ocean_only)
>
>   res at tiMainString      = "mask"
>   plot = gsn_csm_contour_map(wks,totc_ocean_only,res)
> end
>
>
> Thank You
>
> Kunal Bali
> Research Scholar
> Radio & Atmospheric Science Division
> CSIR - National Physical Laboratory
> New Delhi - 110012
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141007/aa57e3f2/attachment.html 


More information about the ncl-talk mailing list