[ncl-talk] using shapefile to mask out values
Mary Haley
haley at ucar.edu
Mon Oct 27 23:46:03 MDT 2014
Hi Lei,
Thanks for providing the files. I couldn't tell what the problem was, but
I suggest using the fairly nwe shapefile_mask_data function instead. It
makes your code simpler. This code is provided on the shapefiles examples
page, but I'll attach it here, along with a modified version of your script.
--Mary
On Mon, Oct 27, 2014 at 11:39 AM, Lei Meng <dream916 at gmail.com> wrote:
> I attached my shapefile and netcdf data file as well as the original ncl
> script. Thanks for your time on this.
>
> Lei
>
> On 10/27/14, 1:17 PM, Mary Haley wrote:
>
> Lei,
>
> Without knowing anything about your data, or how the China shapefile is
> structured, I don't know why you have missing values inside the outline.
> Are you getting any errors from running this script? Is the shapefile a
> "polygon" shapefile or a "polyline" shapefile? If it is a "polyline"
> shapefile, then you may have some areas that aren't fully enclosed, and
> hence "gc_inout" won't work properly.
>
> It would help if you could also provide the "total_china.shp" and "
> simple.nc" data files.
>
> Thanks,
>
> --Mary
>
>
> On Fri, Oct 24, 2014 at 3:33 PM, dream916 <dream916 at gmail.com> wrote:
>
>> Dear All,
>>
>> I tried to use a China shapefile to mask out values outside of China
>> for a crop dataset. I found that some values inside were also masked out. I
>> attached the screenshot of the shapefile, a pdf file showing the output
>> (top) and the original data (bottom), and my ncl code. After masking, some
>> pixels inside China were assigned missing value. Any suggestions? Thank you,
>>
>> Lei
>>
>> _______________________________________________
>> ncl-talk mailing list
>> 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/20141027/a8b0e94f/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_Cropland_mod.ncl
Type: application/octet-stream
Size: 3870 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141027/a8b0e94f/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glcrop_example3.png
Type: image/png
Size: 151338 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141027/a8b0e94f/attachment.png
More information about the ncl-talk
mailing list