cf_xarray.geometry.cf_to_shapely

cf_xarray.geometry.cf_to_shapely(ds, *, container='geometry_container')[source]

Convert geometries stored in a CF-compliant way to shapely objects stored in a single variable.

Parameters:
dsxr.Dataset

Must contain a geometry_container variable with attributes giving the geometry specifications. Must contain all variables needed to reconstruct the geometries listed in these specifications.

Returns:
da: xr.DataArray

A 1D DataArray of shapely objects. It has the same dimension as the node_count or the coordinates variables, or features if those were not present in ds.

References

Please refer to the CF conventions document: http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#geometries