Consider adding nonzero/flatnonzero to dask.array
See original GitHub issueThis would need to eagerly evaluated, or perhaps return an imperative value, because the result shape is not known apriori.
This sort of thing could be useful for https://github.com/pydata/xarray/pull/815 if you want to mask out a small region of a very large array. For example, imagine you have a tiled digital elevation model dataset at high resolution covering the globe, and now you want to extract out the region corresponding to California. There are certainly more intelligent indexing strategies for geospatial data, but I could see something like ds.sel_where(ds.region_enum == CALIFORNIA)
being convenient.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:22 (22 by maintainers)
Top Results From Across the Web
dask.array.nonzero - Dask documentation
Returns a tuple of arrays, one for each dimension of a , containing the indices of the non-zero elements in that dimension. The...
Read more >dask.array.flatnonzero - Dask documentation
Return indices that are non-zero in the flattened version of a. This docstring was copied from numpy.flatnonzero. Some inconsistencies with the Dask version ......
Read more >Source code for dask.array.routines
Consider removing it in a future version of dask. import cupy xp = cupy ... adjust_chunks={0: 1}, # one row for each block...
Read more >Dask and the __array_function__ protocol
In short, the protocol allows a NumPy function call to dispatch the appropriate NumPy-like library implementation, depending on the array type ...
Read more >dask.array.count_nonzero - Dask documentation
Counts the number of non-zero values in the array a . ... For example, any number is considered truthful if it is nonzero,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you don’t want to evaluate the entire result then you’ll need to know which chunks to look for, in advance. Generally this isn’t doable. Dask.array isn’t good when the structure of the computation depends on the values of the array.
Unknown dimension lengths are fine
On Wed, Mar 29, 2017 at 1:10 PM, jakirkham notifications@github.com wrote: