[ncl-talk] masking query

Yuqiang Zhang yuqiangzhang.thu at gmail.com
Tue Oct 7 06:27:56 MDT 2014


Hi Kunal,

 

https://www.ncl.ucar.edu/Applications/mask.shtml

 

Have you tried to find the info on NCL’s website? They have great resources and examples on it. 

 

Regards,

Yuqiang

 

From: ncl-talk-bounces at ucar.edu [mailto:ncl-talk-bounces at ucar.edu] On Behalf Of Kunal Bali
Sent: Tuesday, October 07, 2014 8:23 AM
To: ncl-talk at ucar.edu
Subject: [ncl-talk] masking query

 

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/2127e906/attachment.html 


More information about the ncl-talk mailing list