[ncl-talk] ncl and shape

jagan TNAU jagan at tnau.ac.in
Wed Nov 26 18:14:45 MST 2014


Hello Mary,

In the PNG delta_kilometers=300 fills the entire shapefile region of
interest but it also fills beyond the ploygon. Is it not possible to fill
only the polygon by using some areaFill functions of ncl.

On Wed, Nov 26, 2014 at 10:16 PM, Mary Haley <haley at ucar.edu> wrote:

> Frank,
>
> I'm not sure if this is the best solution, but I modified
> shapefile_mask_data to mask both on whether the grid point falls inside the
> shapefile area (using gc_inout as before) *and* whether it is within a
> certain kilometer distance from the shapefile border (using gc_latlon).
>
> gc_latlon returns the great circle distance between a series of lat/lon
> points, and you can use it to return the distance in meters, kilometers,
> degrees, or radians. I used option 4 (kilometers).
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_latlon.shtml
>
> See the attached example script, and try running it with different values
> for "delta_kilometers".
>
>   delta_kilometers = 300
> Note that this script can take awhile to run if you have a lot of data
> points, or a lot of shapefile areas to check against.
>
> It is possible to make this script much more efficient by limiting the
> area that is actually checked.  For example, inside the big "do
> n=0,natlon1d-1" loop in the shapefile_mask_data" function, you could add a
> "if" check for lat1d or lon1d being less than/greater than some min/max
> lat/lon box, and then "break" out of that loop if the condition is not
> met.  This way, you don't get into the tedious checking with gc_inout
> and/or gc_latlon.
>
> The original "shapefile_mask_data" actually does this kind of checking, so
> you can look at that for more informatioin.
>
> I've attached the modified function, and example script (based on
> shapefiles_16.ncl), with PNGs showing the results with 100, 200, and 300 km.
>
> I also attached a PNG showing the original results where you just mask
> based on the shapefile area.
>
> --Mary
>
>
> On Mon, Nov 24, 2014 at 10:54 PM, Kreienkamp Frank <
> Frank.Kreienkamp at dwd.de> wrote:
>
>>  Hello,
>>
>>
>>
>> i have two questions about the interaction of ncl and shape files.
>>
>>
>>
>> 1)
>>
>> Using ‘shapefile_mask_data’ I can mask out grid points lying inside a
>> shape file.  One result is shown in the attached png-file. Is it possible
>> to define an extention, that I get all grid point inside and additional the
>> grid point which are close (  xx km)  to the shape-polygon-border?
>>
>>
>>
>> 2)
>>
>> I am looking for a function which cuts out and draws the complete region.
>> In the shown example i have white areas based along the
>> shape-polygon-border. But I want to have the complete area inside the
>> shape-polygon-border colored.
>>
>>
>>
>> Thanks in advance
>>
>> Frank
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
With regards

Dr.R.Jagannathan
Professor of Agronomy
Agro Climate Research Centre
Tamil Nadu Agricultural University
Coimbatore - 641 003 India

PHONE:  Mob: +91 94438 89891

DO NOT PRINT THIS E-MAIL UNLESS NECESSARY. THE ENVIRONMENT CONCERNS US ALL.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141127/c17e6d54/attachment.html 


More information about the ncl-talk mailing list