[ncl-talk] Issue with Masking with shapefile

Amit Kumar amitkumar.777 at hotmail.com
Wed Aug 3 05:26:12 MDT 2016


Hi,

I'm truing to do masking using shapefile, script is attached.

I'm getting following error:

(0)    shapefile_mask_data: Error: not a valid rectilinear, curvilinear, or unstructured grid

so I made following changes:

opt             = True
  opt at return_mask = True
  shp_mask = shapefile_mask_data(var(0,:,:),filename,opt)
shp_mask_3d = conform_dims(dimsizes(var),shp_mask,(/1,2/))

var_shp_mask = where(shp_mask_3d.eq.1,var,var at _FillValue)
copy_VarMeta(var,var_shp_mask)

;---For shapefile plot, use the shapefile outlines.
  res at mpOutlineOn  = False

;---Create plot of original data masked by shapefile outlines
  res at tiMainString = "Original data masked by shapefile outlines"
  var_shp_plot = gsn_csm_contour_map(wks,var_shp_mask,res)
  dum = gsn_add_shapefile_polylines(wks,var_shp_plot,filename,False)
 draw(plot)
 frame(wks)
 end

after these changes earlier error is rectified but now I'm getting following error:

fatal:Number of subscripts do not match number of dimensions of variable,(3) Subscripts used, (2) Subscripts expected

Please suggest how to proceed further.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160803/bcf94e40/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hem_shp_mask_1.ncl
Type: application/octet-stream
Size: 2863 bytes
Desc: hem_shp_mask_1.ncl
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160803/bcf94e40/attachment.obj 


More information about the ncl-talk mailing list