<div dir="ltr"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Dear Mary,</div><div dir="ltr"><br></div><div dir="ltr">Thank you so much for this.</div><div dir="ltr"><br></div><div dir="ltr">Lyndz<br><div><br></div></div></div></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 10, 2018 at 7:08 AM Mary Haley <<a href="mailto:haley@ucar.edu">haley@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Whoops, wrong PNG! Here's the correct one.</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 Tue, Oct 9, 2018 at 4:06 PM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.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 dir="ltr"><div class="gmail_default" style="font-size:small">Lyndz,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'm going through some old emails and didn't see a response to this one.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You were almost there, but in order to mask lat/lon values against one or more shapefile outlines, you must provide a data array that has the lat/lon arrays attached to it.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Since you don't have a data array associated with your lat/lon pairs, you can simply create a dummy array, and then attach the lat/lon to it. For example:</div><div class="gmail_default"><div class="gmail_default"> data1d=asciiread("jma.csv",-1,"float")</div><div class="gmail_default"> shp_filename="Bicol_region.shp"</div><div class="gmail_default"> print_shapefile_info(shp_filename)</div><div class="gmail_default"> lat = data1d(0::2)</div><div class="gmail_default"> lon = data1d(1::2)</div><div class="gmail_default"><br></div><div class="gmail_default">;---Create dummy data array so we can attach lat/lon attributes to it. </div><div class="gmail_default"> npts = dimsizes(lat)</div><div class="gmail_default"> data = new(npts,float)</div><div class="gmail_default"> data@lat1d = lat</div><div class="gmail_default"> data@lon1d = lon</div><div class="gmail_default"><br></div><div class="gmail_default">;---Return a mask array (0s and 1s) indicating which lat/lon pairs fall inside the shapefile region </div><div class="gmail_default"> opt = True</div><div class="gmail_default"> opt@return_mask = True</div><div class="gmail_default"> data_mask = shapefile_mask_data(data,shp_filename,opt)</div><div class="gmail_default"><br></div><div class="gmail_default">I've attached a full script that creates a plot and draws all the lat/lon pairs in red, with the ones inside the shapefile regions (only two of them) in blue.</div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div><div class="gmail_default"><br></div></div><div class="gmail_default" style="font-size:small"><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-1426845043533427242h5">On Thu, Sep 13, 2018 at 1:51 AM, Lyndz <span dir="ltr"><<a href="mailto:olagueralyndonmark429@gmail.com" target="_blank">olagueralyndonmark429@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-1426845043533427242h5"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr" class="m_-1426845043533427242m_-929447468316341987m_-141422599481284550gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hello,</div><div><br></div><div>I am trying to filter Tropical Cyclone (TC) lat-lon points from a csv file using a shapefile and display the tracks. </div><div><br></div><div>I'm reading the csv file and shapefile like this:</div><div><br></div><div> data=asciiread("jma.csv",(/1519,2/),"float")<br></div><div> load "./shapefile_utils.ncl"</div><div> shp_filename="Bicol_region.shp" </div><div> data_mask = shapefile_mask_data(data,shp_filename,True)</div><div><div><br></div><div>Error: shapefile_mask_data: Error: not a valid rectilinear, curvilinear, or uns</div><div>tructured grid</div></div><div><br></div><div>I think I am missing a step after reading the csv file. Attached are the shapefile and csv file.</div><div><br></div><div>Any suggestions on how to do this correctly in NCL?</div><div><br></div><div>Sincerely,</div><div><br></div><div>Lyndz</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</blockquote></div>