<div dir="ltr"><div class="gmail_default" style="font-size:small">Frank,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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). </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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).</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_latlon.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_latlon.shtml</a><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">See the attached example script, and try running it with different values for "delta_kilometers".</div><div class="gmail_default" style="font-size:small">
<p class=""> delta_kilometers = 300</p></div><div class="gmail_default" style="font-size:small">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. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The original "shapefile_mask_data" actually does this kind of checking, so you can look at that for more informatioin.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I also attached a PNG showing the original results where you just mask based on the shapefile area.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 24, 2014 at 10:54 PM, Kreienkamp Frank <span dir="ltr"><<a href="mailto:Frank.Kreienkamp@dwd.de" target="_blank">Frank.Kreienkamp@dwd.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="DE" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="EN-US">Hello,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">i have two questions about the interaction of ncl and shape files.
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">1)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">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?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">2)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">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.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks in advance<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></span></p><span class="HOEnZb"><font color="#888888">
<p class="MsoNormal"><span lang="EN-US">Frank</span><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</font></span></div>
</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>