Skip to content

assign_coords downgrades GeometryIndex to PandasIndex #13

@martinfleis

Description

@martinfleis

If you call assign_coords on a DataArray with one or more GeometryIndex, they all get downgraded to PandasIndex.

This also needs to be fixed before I can move on with #11 as it currently breaks transformation of multiple coordinates at the same time.

In [2]: geom_dataset = xarray.Dataset(
   ...:     coords={"geom": numpy.array([shapely.Point(1, 2), shapely.Point(3, 4)]), "value": [1, 2]}
   ...:     ).drop_indexes("geom").set_xindex("geom", GeometryIndex, crs=26915)
   ...: geom_dataset.xindexes
Out[2]: 
Indexes:
    value    PandasIndex
    geom     GeometryIndex (crs=EPSG:26915)

In [3]: geom_dataset.assign_coords(new=['a', 'b']).xindexes
Out[3]: 
Indexes:
    value    PandasIndex
    geom     PandasIndex
    new      PandasIndex

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions