<div dir="ltr"><div><a href="http://www.ncl.ucar.edu/Applications/binning.shtml">http://www.ncl.ucar.edu/Applications/binning.shtml</a><br><br></div>See Example 2:<br><br><pre> freq = count
freq = (count/npts)*100 ; comment this
</pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 7, 2018 at 9:05 PM, Lyndz <span dir="ltr"><<a href="mailto:olagueralyndonmark429@gmail.com" target="_blank">olagueralyndonmark429@gmail.com</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 class="gmail_extra">Hi Sir Rick,</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thank you for the fast response.</div><div class="gmail_extra">I wanted to create a 5degree by 5degree grid NetCDF file from the shapefile, where each grid box contains the "count"(frequency) of unique TC tracks per category.</div><div class="gmail_extra">I'm just wondering if this is possible to do in NCL.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Sincerely,</div><div class="gmail_extra"><br></div><div class="gmail_extra">Lyndz</div><div><div class="h5"><div class="gmail_extra"><br></div><div class="gmail_extra"><div><div class="m_-6417443193172863545gmail_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"><div><br></div></div></div></div></div></div></div></div></div></div></div><div class="gmail_quote">On Sun, Apr 8, 2018 at 3:34 AM, Rick Brownrigg <span dir="ltr"><<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@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><div><div>Hi Lyndz,<br><br></div>I'm not sure there is a "correct" way to do this. NetCDF is really good at representing regular arrays of data, whereas polylines/polygons tend to have varying numbers of coordinate pairs -- what would lat and lon variables look like in that case, and what would be the meaning of lat/lon dimensions? NCL makes a shapefile *look* like a NetCDF file by packing the coordinate information for all features into the x/y variables, but then one has to utilize the geometry and segments variables to unpack coordinates for each feature. The shapefiles examples page show many examples of doing this:<br><br> <a href="http://ncl.ucar.edu/Applications/shapefiles.shtml" target="_blank">http://ncl.ucar.edu/Applicatio<wbr>ns/shapefiles.shtml</a><br><br></div>If you are working with NCL, you are probably better off leaving your data as a shapefile<i>. </i>I take it however that you have other reasons for wanting a NetCDF file?<br><br></div><div>Finally, I might comment that the conversion result may not be correct -- its suspect to me that the "num_points" value is exactly twice the value of "num_features" -- I wonder if maybe just the end-points of the tracks where what got captured in the conversion?<br></div><div><br></div>Rick<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-6417443193172863545h5">On Fri, Apr 6, 2018 at 11:30 PM, Lyndz <span dir="ltr"><<a href="mailto:olagueralyndonmark429@gmail.com" target="_blank">olagueralyndonmark429@gmail.c<wbr>om</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_-6417443193172863545h5"><div dir="ltr"><div><div class="m_-6417443193172863545m_8432888801720720690m_-2027423418176086207gmail_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>Dear NCL experts,</div><div><br></div><div>I would like to convert the following shapefile to a netcdf file.</div><div>I created the shapefile from a csv file containing jtwc tc tracks (see attached csv2shp.py)<br></div><div>Also attached is the csv file.</div><div><br></div><div>When I used the ncl_convert2nc the netcdf file has no lat-lon dimension. Here's the output of the ncdump. Is it also possible to divide the TC categories by dividing the Vmax values? </div><div><br></div><div><br></div><div>I'll appreciate any suggestion on how to do this correctly.</div><div><br></div><div><br></div><div><div>netcdf par_jtwc_above_ts_1979-1993 {</div><div>dimensions:</div><div><span style="white-space:pre-wrap"> </span>geometry = 2 ;</div><div><span style="white-space:pre-wrap"> </span>segments = 2 ;</div><div><span style="white-space:pre-wrap"> </span>num_features = 1050 ;</div><div><span style="white-space:pre-wrap"> </span>num_segments = 1050 ;</div><div><span style="white-space:pre-wrap"> </span>num_points = 2100 ;</div><div>variables:</div><div><span style="white-space:pre-wrap"> </span>int geometry(num_features, geometry) ;</div><div><span style="white-space:pre-wrap"> </span>int segments(num_segments, segments) ;</div><div><span style="white-space:pre-wrap"> </span>double x(num_points) ;</div><div><span style="white-space:pre-wrap"> </span>double y(num_points) ;</div><div><span style="white-space:pre-wrap"> </span>int SN(num_features) ;</div><div><span style="white-space:pre-wrap"> </span>int CY(num_features) ;</div><div><span style="white-space:pre-wrap"> </span>int Y1(num_features) ;</div><div><span style="white-space:pre-wrap"> </span>int M1(num_features) ;</div><div><span style="white-space:pre-wrap"> </span>int D1(num_features) ;</div><div><span style="white-space:pre-wrap"> </span>int H1(num_features) ;</div><div><span style="white-space:pre-wrap"> </span>int VMax1(num_features) ;</div><div><span style="white-space:pre-wrap"> </span>int Y2(num_features) ;</div><div><span style="white-space:pre-wrap"> </span>int M2(num_features) ;</div><div><span style="white-space:pre-wrap"> </span>int D2(num_features) ;</div><div><span style="white-space:pre-wrap"> </span>int H2(num_features) ;</div><div><span style="white-space:pre-wrap"> </span>int VMax2(num_features) ;</div><div><br></div><div>// global attributes:</div><div><span style="white-space:pre-wrap"> </span>:segs_numPnts = 1 ;</div><div><span style="white-space:pre-wrap"> </span>:segs_xyzIndex = 0 ;</div><div><span style="white-space:pre-wrap"> </span>:geom_numSegs = 1 ;</div><div><span style="white-space:pre-wrap"> </span>:geom_segIndex = 0 ;</div><div><span style="white-space:pre-wrap"> </span>:geometry_type = "polyline" ;</div><div><span style="white-space:pre-wrap"> </span>:layer_name = "par_jtwc_above_ts_1979-1993" ;</div><div><span style="white-space:pre-wrap"> </span>:creation_date = "Sat Apr 7 14:11:24 JST 2018" ;</div><div><span style="white-space:pre-wrap"> </span>:NCL_Version = "6.4.0" ;</div><div><span style="white-space:pre-wrap"> </span>:system = "Linux localhost.localdomain 3.10.0-327.36.3.el7.x86_64 #1 SMP Mon Oct 24 16:09:20 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux" ;</div><div><span style="white-space:pre-wrap"> </span>:Conventions = "None" ;</div><div><span style="white-space:pre-wrap"> </span>:title = "NCL: convert-OGR-to-netCDF" ;</div><div>}</div></div><div><br></div><div><br></div><div>Sincerely,</div><div><br></div><div>Lyndz</div><div><br></div></div></div></div></div></div></div></div></div></div></div>
</div>
<br></div></div>______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>