xarray-contrib / xvec

Vector data cubes for Xarray
https://xvec.readthedocs.io
MIT License
93 stars 9 forks source link

Explore usage of xarray.Coordinates #51

Open martinfleis opened 1 year ago

martinfleis commented 1 year ago

I remember that when writing some pieces of our code, I would have welcome xarray.Coordinates object. Now that it is available, we should explore whether it could simplify some bits of our code.

benbovy commented 1 year ago

xarray.Coordinates is mostly useful as an intermediate object to pass to a Dataset or DataArray (either via their __init__ or assign_coords method), for example if one wants Xarray 1-d dimension coordinates with no default index or coordinates created from an existing (non-Xarray) index object (like Coordinates.from_pandas_multiindex).

Here I'm not sure if building indexed coordinates from an existing shapely.STRtree object would be a common case? We also have Dataset.xvec.set_geom_indexes that replaces existing indexes, if any.