[ncl-talk] masking query
Kunal Bali
kunal.bali9 at gmail.com
Tue Oct 7 06:22:55 MDT 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141007/f0da0101/attachment.html
More information about the ncl-talk
mailing list