pydata / pydata/xarray

NaN-sized chunks

Open
#2,801 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-arrays
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

It would be nice to have support for NaN-sized dask chunks, e.g. x[x > 2].
There are two problems:

  1. x[x > 2] silently resolves the dask graph. It definitely shouldn't. There needs to be some discussion on what needs to happen to indices on the NaN-sized dimension; I can think of 3 options:
  • silently drop any index that would become undefined
  • drop any index that would become undefined and issue a warning
  • hard crash if there is any index that would become undefined
  • redesign IndexVariable so that it can contain dask data (probably much more complicated than the 3 above).
    The above design decision is anyway for when there is an index; dims without indices should just work.
  1. This crashes:
>>> xarray.DataArray(a.data[a.data > 2]).compute()

ValueError: replacement data must match the Variable's shape

I didn't investigate but I suspect it should be trivial to fix. I'm not sure why there is a check at all? Any such health check should be in dask only IMHO.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by reproducing the two examples with xarray.DataArray and chunked data, then investigate how boolean indexing handles NaN-sized dimensions. Completion requires avoiding silent graph resolution, supporting dimensions without indices, and resolving the listed indexed-dimension behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.