[ncl-talk] convert polyline shapefile to netcdf via ncl_convert2nc
Rick Brownrigg
brownrig at ucar.edu
Sat Apr 7 12:34:24 MDT 2018
Hi Lyndz,
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:
http://ncl.ucar.edu/Applications/shapefiles.shtml
If you are working with NCL, you are probably better off leaving your data
as a shapefile*. *I take it however that you have other reasons for wanting
a NetCDF file?
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?
Rick
On Fri, Apr 6, 2018 at 11:30 PM, Lyndz <olagueralyndonmark429 at gmail.com>
wrote:
> Dear NCL experts,
>
> I would like to convert the following shapefile to a netcdf file.
> I created the shapefile from a csv file containing jtwc tc tracks (see
> attached csv2shp.py)
> Also attached is the csv file.
>
> 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?
>
>
> I'll appreciate any suggestion on how to do this correctly.
>
>
> netcdf par_jtwc_above_ts_1979-1993 {
> dimensions:
> geometry = 2 ;
> segments = 2 ;
> num_features = 1050 ;
> num_segments = 1050 ;
> num_points = 2100 ;
> variables:
> int geometry(num_features, geometry) ;
> int segments(num_segments, segments) ;
> double x(num_points) ;
> double y(num_points) ;
> int SN(num_features) ;
> int CY(num_features) ;
> int Y1(num_features) ;
> int M1(num_features) ;
> int D1(num_features) ;
> int H1(num_features) ;
> int VMax1(num_features) ;
> int Y2(num_features) ;
> int M2(num_features) ;
> int D2(num_features) ;
> int H2(num_features) ;
> int VMax2(num_features) ;
>
> // global attributes:
> :segs_numPnts = 1 ;
> :segs_xyzIndex = 0 ;
> :geom_numSegs = 1 ;
> :geom_segIndex = 0 ;
> :geometry_type = "polyline" ;
> :layer_name = "par_jtwc_above_ts_1979-1993" ;
> :creation_date = "Sat Apr 7 14:11:24 JST 2018" ;
> :NCL_Version = "6.4.0" ;
> :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" ;
> :Conventions = "None" ;
> :title = "NCL: convert-OGR-to-netCDF" ;
> }
>
>
> Sincerely,
>
> Lyndz
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180407/4317147d/attachment.html>
More information about the ncl-talk
mailing list