[ncl-talk] Issue with shapefile_mask_data

Mary Haley haley at ucar.edu
Tue Aug 9 02:15:19 MDT 2016


Amit,

In order for the shapefile_mask_data function to "see" your lat /lon
arrays, you must attach them to the data variable. This is only required if
you have curvilinear or unstructured data.

You have curvilinear data (which means your lat/lon arrays are both 2D and
the same size as your data array), so you can do this:

  var             = doubletofloat(a->HEM_MNT)
  var at lat2d       = a->latitude
  var at lon2d       = a->longitude
  opt             = True
  opt at return_mask = True
  shp_mask = shapefile_mask_data(var(0,:,:),filename,opt)

Also, see example #14 at:

http://www.ncl.ucar.edu/Applications/shapefiles.shtml

--Mary



On Tue, Aug 9, 2016 at 6:50 AM, Amit Kumar <amitkumar.777 at hotmail.com>
wrote:

> Hi All,
>
> I want to do shape file masking but I'm getting
> shapefile_mask_data: Error: not a valid rectilinear, curvilinear, or
> unstructured grid
>
> My variable description by ncl_filedump is as follows:
>
> Variable: f
> Type: file
>    dimensions:
>       time = 1
>       lon = 2805
>       lat = 2816
>    variables:
>       double time ( time )
>          units :    hours since 0001-01-01 00:00:00.0
>          calendar :    gregorian
>
>       double latitude ( lat, lon )
>          units :    degrees_north
>
>       double longitude ( lat, lon )
>          units :    degrees_east
>
>       double HEM_MNT ( time, lat, lon )
>          coordinates :    latitude longitude
>          fillvalue :    -9.e+33
>          missing_value :    -9e+33
>          _FillValue :    -9e+33
>
>
> and my script section for masking is as follows:
>
>   var                 = doubletofloat(a->HEM_MNT)
>   lat                 =  a->latitude
>   lon                 =  a->longitude
>   opt             = True
>   opt at return_mask = True
>   shp_mask = shapefile_mask_data(var(0,:,:),filename,opt)  -------> error
> in this line
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160809/b111a558/attachment.html 


More information about the ncl-talk mailing list