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

Will Hobbs Will.Hobbs at utas.edu.au
Tue Feb 17 22:32:55 MST 2015


Check that the dimensions of 't' and the dimensions of 'msk' are the same

Will

From: Adv <advita6 at gmail.com<mailto:advita6 at gmail.com>>
Date: Wednesday, 18 February 2015 4:27 PM
To: "ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>" <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>>
Subject: [ncl-talk] Sub: How to mask ocean part in my plot. ..

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<http://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




University of Tasmania Electronic Communications Policy (December, 2014).
This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150218/089243ad/attachment.html 


More information about the ncl-talk mailing list