On Fri, Sep 19, 2014 at 3:17 PM, Ben Koziol - NOAA Affiliate <
[email protected]> wrote:

> Storing geometries inside netCDF is something I've also been thinking
> about. I even went as far as to start writing some code to do this for
> polygons (https://github.com/bekozi/ncvec) using ragged arrays.
>

This seems like the "right" way to do it to me -- if you have a bunch of
related things that aren't the same size, what you really want it in a
ragged array.

Not CF I know...
>

CF kinda-sorts support ragged arrays:

http://cfconventions.org/Data/cf-conventions/cf-conventions-1.6/build/cf-conventions.html#Example%20H.2.4.1

At least you could do polygons in a similar fashion, and maybe propose an
addition to CF.


> I also have some Python code for converting polygons from a watersheds
> shapefile into the UGRID format (
> https://github.com/ugrid-conventions/ugrid-conventions/blob/v0.9.0/ugrid-conventions.md#2d-flexible-mesh-mixed-triangles-quadrilaterals-etc-topology).
> The major limitation here is that UGRID expects no gaps between the "faces"
> which limits its ability to store multi-geometries (i.e. Hawaii).
>

It also expects each "face" to have the same number of vertices, more or
less. But it's a good idea to leverage that -- let's keep things as
consistent as possible.

And you may be abel to do it pretty much in UGRID, but storing:

nodes: these would be all the vertices of all the polygons
boundary_node_connectivity: this would specify the segments that define the
polygons

then use a polygon_index variable, or something, that would be n_boundaries
in length, and specify which segments belonged to which polygon.

Though, unless your goal is interoperability with UGRID for one reason or
another, probably better to use a ragged-array approach.

-Chris

-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
CF-metadata mailing list
[email protected]
http://mailman.cgd.ucar.edu/mailman/listinfo/cf-metadata

Reply via email to