[ncl-talk] Sub: How to mask ocean part in my plot. ..

Adv advita6 at gmail.com
Tue Feb 17 22:27:11 MST 2015


Hi,
I would like to plot correlation only over Northern US. Could someone help
me.? My script plots over ocean part too. So i wan't to mask ocean. I tried
to use mask file with mask function.

Error looks like
fatal:mask: dimension sizes  of parameter 0 and parameter 1 do not match
fatal:Execute: Error occurred at or near line 95 in file testcorr.ncl

Help and suggestions are appreciated.

Thanks


t=t(lat|:,lon|:)
printVarSummary(t)
copy_VarMeta(a,t)

 in = addfile("lsmask.nc","r")
 msk=in->mask
printVarSummary(in)

; use mask function to mask out land and then ocean data
; ocean=0,land=1,sea_ice=2
;************************************************
  land_only  = t                               ; trick to keep cv's and atts
  ocean_only = t

  land_only  = mask(t,msk(0,:,:),1)   ; Return the values of ts where oro=1
;  ocean_only = mask(ts,oro,0)   ; Return the values of ts where oro=0

wks = gsn_open_wks("ps","proj")          ; open a ncgm file
  gsn_define_colormap(wks,"gui_default")

;**************************************************
  res                       = True
  res at gsnFrame              = False               ; don't advance frame yet
  res at mpDataBaseVersion     = "Ncarg4_1"          ; higher res data base
  res at vpWidthF              = 0.90                ; change aspect ratio of
plot
  res at vpHeightF             = 0.90
  res at vpXF                  = 0.05
  res at vpYF                  = 0.95
  res at mpProjection      = "LambertConformal"      ; choose projection
  res at mpLambertParallel1F    = 33.0                ; two parallels
  res at mpLambertParallel2F    = 45.0
  res at mpLambertMeridianF     = -95.0               ; central meridian
  res at mpLimitMode            = "LatLon"
  res at mpMinLatF              = 24.0                ; map area
  res at mpMaxLatF              = 50.0                ; latitudes
  res at mpMinLonF              = -125.0              ; and
  res at mpMaxLonF              = -65.0
  res at mpFillOn              = True                ; turn on map fill

 res at mpLandFillColor       = "Background"        ; set to white
  res at mpPerimOn             = False               ; don't draw box around
map
  res at mpGridAndLimbOn       = False
  res at mpPerimOn         = False             ; turn off box around plot

  res at cnLinesOn         = False             ; turn off contour lines

  res at gsnSpreadColors     = True            ; use full range of color map
;  res at gsnSpreadColorStart = 2
;  res at gsnSpreadColorEnd   = -3
;  res at lbLabelFontHeightF  = 0.015           ; label bar font height

  res at tiMainString       = "Example of Orthographic Projection"   ; add a
title
;  res at tiMainFontHeightF  = .018                               ; font height

  plot = gsn_csm_contour_map(wks,t,res)  ; create the plot
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150217/9fb644e4/attachment.html 


More information about the ncl-talk mailing list