[ncl-talk] creating netcdf mask from shapefile

Mary Haley haley at ucar.edu
Thu Oct 26 22:00:15 MDT 2017


Hi Amy,

You didn't say which example you were trying to use, but if you are using
the shapefile_mask_data function, you should be able to specify an integer
variable instead of a string variable to specify which values to mask.

As an example, look at shapefiles_21.ncl, which sets opt at shape_var to
"NAME_1" and opt at shape_names to a list of US state names. I updated this
example to show that you can also use "ID_1" as the shapefile variable
name, and a list of integers for opt at shape_names.

This example does have one line I had to fix. This line:

    features at _FillValue = "missing"

should be changed to:

    features at _FillValue = default_fillvalue(typeof(features))

You can see the updated script at:

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

--Mary


On Thu, Oct 26, 2017 at 6:17 PM, Amy Hendricks <ashendricks at alaska.edu>
wrote:

> Howdy NCL experts,
>
> I'm trying to create a netcdf mask from a shapefile, however, the shape
> names are integers. All of the examples on the shapefiles examples page
> show how to mask with string shape names -- how do I convert the integer
> shape names to strings for creating a mask?
>
> Cheers,
>
> Amy
>
>
> _______________________________________________
> 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/20171026/ca708c24/attachment.html>


More information about the ncl-talk mailing list