<div dir="ltr">Meina,<div><br></div><div>Thanks for letting me know about the function <span id="gmail-m_8074794512453578162:3ni.2" style="font-size:14px;color:rgb(51,51,51);font-family:verdana,sans-serif">shapefile</span><span style="font-size:14px;color:rgb(51,51,51);font-family:verdana,sans-serif">_mask_data. I had not used this before, and like you, I did not realize that it was also good for 1-D point data. That function is the better approach because it is much simpler than hand crafting the all that geometry code in your own program.</span></div><div><span style="font-size:14px;color:rgb(51,51,51);font-family:verdana,sans-serif"><br></span></div><div><font color="#333333" face="verdana, sans-serif">--Dave</font></div><div><font color="#333333" face="verdana, sans-serif"><br></font></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 24, 2017 at 12:54 PM, Meina Wang <span dir="ltr"><<a href="mailto:mnawang@ucdavis.edu" target="_blank">mnawang@ucdavis.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Dear Dave,</div><div style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"><br></div><div><font face="arial, helvetica, sans-serif" style="color:rgb(0,0,0)">Thank you very much for your detailed explanation. I went though the examples for <span id="m_8074794512453578162:3ni.1">shapefiles</span> and found the function "</font><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13px;margin:0px;padding:0px;line-height:16px"><span id="m_8074794512453578162:3ni.2">shapefile</span>_mask_data"</span><b style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13px;margin:0px;padding:0px;line-height:16px"> </b><span style="margin:0px;padding:0px"><font face="arial, helvetica, sans-serif"><font color="#333333"><span style="line-height:16px">to filtered out the data outside specific <span id="m_8074794512453578162:3ni.3">shapefile</span>. I previously didn't realized this function also works for 1D unstructured data as well besides gridded 2D data, and it did what you've demonstrated for reading the lat/<span id="m_8074794512453578162:3ni.4">lon</span> from <span id="m_8074794512453578162:3ni.5">shapefile</span> and determining if each station is within the <span id="m_8074794512453578162:3ni.6">shapefile</span>. So this function worked for my case with no problem. Thank you very much again for your kind reply :)</span></font></font></span></div><div><span style="margin:0px;padding:0px"><font face="arial, helvetica, sans-serif"><font color="#333333"><span style="line-height:16px"><br></span></font></font></span></div><div><span style="margin:0px;padding:0px"><font face="arial, helvetica, sans-serif"><font color="#333333"><span style="line-height:16px">Best regards,</span></font></font></span></div><div><span style="margin:0px;padding:0px"><font face="arial, helvetica, sans-serif"><font color="#333333"><span style="line-height:16px"><span id="m_8074794512453578162:3ni.7">Meina</span></span></font></font></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 24, 2017 at 11:43 AM, Dave Allured - NOAA Affiliate <span dir="ltr"><<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Meina,<div><br></div><div>Read the geometry data from the shape file. The geometry data is essentially a set of one or more polygon outlines in lat/lon coordinates. Now select the polygon that defines your area to mask. Then use the NCL function gc_inout to determine whether each station is within the masked area.</div><div><br></div><div>Please see NCL example shapefiles_13 for a demonstration of how to read the geometry and apply polygons to select station point data. That is a general example for a shape file containing multiple features and multiple polygons per feature. If your shape file contains only one feature or one polygon, you can simplify your program and eliminate one or two of the loops from the example.</div><div><br></div><div> <a href="http://www.ncl.ucar.edu/Applications/shapefiles.shtml" target="_blank">http://www.ncl.ucar.edu/Appli<wbr>cations/shapefiles.shtml</a><span class="m_8074794512453578162HOEnZb"><font color="#888888"><br></font></span></div><span class="m_8074794512453578162HOEnZb"><font color="#888888"><div><br></div><div>--Dave</div></font></span><div><div class="m_8074794512453578162h5"><div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 22, 2017 at 11:57 PM, Meina Wang <span dir="ltr"><<a href="mailto:mnawang@ucdavis.edu" target="_blank">mnawang@ucdavis.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Dear NCL users,</div><div style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"><br></div><div style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">I wanted to use shapefile to mask the station observational data (1D) in the grey area (sample plot attached below), and would like to pick out the station data in the grey area (for calculation purpose later). I'm wondering if there is a way to do this using shapefile in ncl? Any suggestion is much appreciated. Thank you.</div><div style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"><br></div><div style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Best,</div><div style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Meina</div></div></blockquote></div></div></div></div></div></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_8074794512453578162gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><font size="2" color="#000000" style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif">Meina Wang</font><div><font size="2" color="#000000" style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif">PhD candidate in Atmospheric Science</font></div><div><font size="2" color="#000000" style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif">Department of Land, Air and Water Resources</font></div><div><font size="2" color="#000000" style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif">University of California, Davis</font></div><div><font size="2" color="#000000" style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif">Davis, CA 95616</font></div></div></div></div></div>
</font></span></div>
</blockquote></div><br></div></div>