home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 946546464

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/5647#issuecomment-946546464 https://api.github.com/repos/pydata/xarray/issues/5647 946546464 IC_kwDOAMm_X844aycg 4160723 2021-10-19T09:47:04Z 2021-10-19T09:47:04Z MEMBER

I've used the following key type to find matching indexes:

python CoordNamesAndDims = FrozenSet[Tuple[Hashable, Tuple[Hashable, ...]]] MatchingIndexKey = Tuple[CoordNamesAndDims, Type[Index]]

where the order of coordinates doesn't matter. For PandasMultiIndex this is wrong, we should use a Tuple instead of a FrozenSet (assuming that the coordinate names are properly ordered in obj.xindexes), but I'm wondering if using a Tuple wouldn't be too restrictive in some other cases.

Are there potential custom indexes where the order of coordinates doesn't matter? Maybe a good example is a meta-index for staggered grids where the cell center coordinate and the cell edges coordinates might be given in any order.

Possible solutions to address this:

  1. Xarray indexes may reorder the coordinate variables, possibly via Index.create_variables(), to ensure consistent order
  2. Xarray indexes must implement the Index.matching_key abstract property in order to support re-indexing and alignment.

Option 2 is more flexible but option 1 might be enough. Option 1 may also be great for clearer indexes and coordinates sections in Xarray objects repr.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  955936490
Powered by Datasette · Queries took 0.789ms · About: xarray-datasette