8000 Explicit indexes in xarray · Issue #1 · xarray-contrib/pint-xarray · GitHub
[go: up one dir, main page]

Skip to content
Explicit indexes in xarray #1
Open
@TomNicholas

Description

@TomNicholas

Part of xarray's roadmap is to elevate indexes to be an explicit part of their data model. The task is discussed here and there's an overview of the project here. This would allow users to index their arrays with custom index classes, rather than being forced to use pandas.Index.

This is relevant to pint-xarray integration because it would mean we could do unit-aware label-based indexing, i.e.

da.sel(x=10 * Unit('m'))

At the moment that won't work because the indexers get coerced to pandas.Index internally within xarray, which isn't unit-aware.

To get this working we probably need to create our own custom index class, an IndexQuantity. While the default implementation would either wrap or subclass pandas.index, we should also consider how to write it in such a way that alternative indexers could be wrapped, such as periodic indexers or cKDtree indexers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    indexingRelated to indexing xarray objects with unit-aware indexersupstream changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0