<div dir="ltr"><div>Example shapefiles_14 is close to what you want.  Please notice these two lines.  Their function is to select a particular subset of all the state outlines in the example shapefile, then apply a binary mask to the base grid "tc_lev0" so that only grid points over the listed states are retained.  All grid points outside this list of states are set to missing.  This demonstrates how to access a subset of a shape file, instead of all regions together,<br><br>   opt@shape_names = (/"Texas","New Mexico","Colorado","Kansas","Oklahoma"/)<br>   tc_mask  = shapefile_mask_data(tc_lev0,shp_filename1,opt)<br><br>For your application, use this masking function to select one region at a time.  Start with a master grid with ERA5 coordinates, set to all zero or missing values.  Loop over each region value or region number.  Call the function shapefile_mask_data inside the loop, selecting the grid points for only one region each time. U<span style="font-family:arial,sans-serif">se the resulting binary mask to add the current region number to the master grid.  When the loop is complete, write the master grid with all region numbers to a Netcdf file.</span></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 26, 2019 at 3:51 PM Amy Hendricks via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello NCL geniuses,<div><br></div><div>I am trying to write a shapefile to netcdf. The shapefile consists of circumpolar Treshnikov regions, and I would like to create a netCDF file that has the region values like tresh(lon,lat) = [region# from shapefile] on the ERA5 grid. All the examples I'm finding are for creating binary masks, and the ncl_convert2nc does not seem to work, at least it doesn't return anything useable. </div><div><br></div><div>Attached are the ERA5 netCDF file, Treshnikov shapefile, as well as the result of ncl_convert2nc. </div><div><br></div><div>Thank you in advance,</div><div><br></div><div>Amy<br></div></div></blockquote></div></div>