Closed bekozi closed 7 years ago
NetCDFs created with and without CRAs. If you'd like to take a look, they are here: https://www.dropbox.com/sh/sn1sijgi6a2hoo1/AABmxt8A_CACPTztDI3tk_4Ta?dl=0.
I am pondering how best to hold multiple geometry variables in a single file. For this example, I gave each "CF geometry collection" a unique string identifier. You'll notice a number duplicate dimensions with the same length. We could write a function to re-index coordinate arrays and stack the coordinate variables. This would make for a cleaner CDL, but it would add complexity if a client wished to break the geometries into separate files...or whatever.
Script used to generated NetCDFs: https://github.com/bekozi/netCDF-CF-simple-geometry/blob/master/misc/create_cdl_bull_creek.py
Note, data variables still need to be added to files.
Added GeoJSON properties as data variables in the example netCDF. I was vexed how to use the time series approach as these properties have no associated time. Some standard attributes are used to link data variables with their coordinate index variable in the meantime. Here is CDL for the CRA case:
benkoziol:[tmp]$ ncdump -h bull_creek_NCSG_CRA.nc
netcdf bull_creek_NCSG_CRA {
dimensions:
catchments_node = 4275 ;
catchments_geom = 20 ;
catchments_node_index = 4276 ;
flowlines_node = 515 ;
flowlines_geom = 20 ;
flowlines_node_index = 515 ;
upstream_node = 20 ;
upstream_geom = 20 ;
upstream_node_index = 20 ;
variables:
int64 catchments_coordinate_index(catchments_node_index) ;
catchments_coordinate_index:cf_role = "simple_geom" ;
catchments_coordinate_index:geom_type = "multipolygon" ;
catchments_coordinate_index:stop_encoding = "cra" ;
catchments_coordinate_index:coordinates = "catchments_x catchments_y" ;
catchments_coordinate_index:multipart_break_value = -1LL ;
catchments_coordinate_index:hole_break_value = -2LL ;
catchments_coordinate_index:outer_ring_order = "anticlockwise" ;
catchments_coordinate_index:closure_convention = "last_node_equals_first" ;
int64 catchments_geom_stop(catchments_geom) ;
catchments_geom_stop:continuous_ragged_dimension = "catchments_node_index" ;
double catchments_x(catchments_node) ;
double catchments_y(catchments_node) ;
double catchments_AreaSqKM(catchments_geom) ;
catchments_AreaSqKM:cf_simple_geom = "catchments_coordinate_index" ;
int64 catchments_COMID(catchments_geom) ;
catchments_COMID:cf_simple_geom = "catchments_coordinate_index" ;
int64 flowlines_coordinate_index(flowlines_node_index) ;
flowlines_coordinate_index:cf_role = "simple_geom" ;
flowlines_coordinate_index:geom_type = "linestring" ;
flowlines_coordinate_index:stop_encoding = "cra" ;
flowlines_coordinate_index:coordinates = "flowlines_x flowlines_y flowlines_z" ;
flowlines_coordinate_index:multipart_break_value = -1LL ;
int64 flowlines_geom_stop(flowlines_geom) ;
flowlines_geom_stop:continuous_ragged_dimension = "flowlines_node_index" ;
double flowlines_x(flowlines_node) ;
double flowlines_y(flowlines_node) ;
double flowlines_z(flowlines_node) ;
int64 flowlines_COMID(flowlines_geom) ;
flowlines_COMID:cf_simple_geom = "flowlines_coordinate_index" ;
char flowlines_GNIS_NAME(flowlines_geom) ;
flowlines_GNIS_NAME:cf_simple_geom = "flowlines_coordinate_index" ;
int64 upstream_coordinate_index(upstream_node_index) ;
upstream_coordinate_index:cf_role = "simple_geom" ;
upstream_coordinate_index:geom_type = "point" ;
upstream_coordinate_index:stop_encoding = "cra" ;
upstream_coordinate_index:coordinates = "upstream_x upstream_y upstream_z" ;
upstream_coordinate_index:multipart_break_value = -1LL ;
int64 upstream_geom_stop(upstream_geom) ;
upstream_geom_stop:continuous_ragged_dimension = "upstream_node_index" ;
double upstream_x(upstream_node) ;
double upstream_y(upstream_node) ;
double upstream_z(upstream_node) ;
int64 upstream_COMID(upstream_geom) ;
upstream_COMID:cf_simple_geom = "upstream_coordinate_index" ;
char upstream_GNIS_NAME(upstream_geom) ;
upstream_GNIS_NAME:cf_simple_geom = "upstream_coordinate_index" ;
// global attributes:
:_NCProperties = "version=1|netcdflibversion=4.4.1|hdf5libversion=1.8.17" ;
}
What's the story on this ticket? I get the sense that it's done... ?
Encode all geometries in a single NetCDF3 & 4 file with CDL. Use case data located here.