home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 908496157

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/5697#issuecomment-908496157 https://api.github.com/repos/pydata/xarray/issues/5697 908496157 IC_kwDOAMm_X842Jo0d 4160723 2021-08-30T16:35:54Z 2021-08-30T16:35:54Z MEMBER

So does this mean custom indexes have to implement vectorized or pointwise indexing on their own?

No I don't think so (sorry my thoughts are still confusing), we would still use the current implementation in Xarray for positional (vectorized, pointwise, etc.) indexing.

Currently label-based indexers go through these normalization steps before passing them to Index.query:

  1. cast floating-point labels to coordinate dtype (maybe_cast_to_coords_dtype())
  2. convert DataArray objects to unlabelled data (via .variable.data)

The dimension (positional) indexers returned by Index.query may be also converted before passing them to .isel:

  1. back to Variable or DataArray objects for advanced indexing

I think that PandasIndex should take care of 1. Casting floating-point labels (casting any object to a numpy array as a side effect) may be undesirable for other, custom indexes.

For 2 and 3, I'm not exactly sure what to do. We should probably avoid 2 since dimension labels are useful (e.g., it is used in .xoak.sel) and let the indexes handle that. This means that indexes should also handle 3. For pandas multi-indexes, this would allow us raising a more meaningful error message since they don't support DataArray or Variable objects as level indexers. It is also better to handle 2 and 3 in a per-case basis since a general solution for 3 is tricky with the new data model (non-dimensional indexes).

This means a lot of flexibility for custom indexes but also a great responsibility.

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