Is your feature request related to a problem? Please describe.
The xarray.where(cond, x, y) function will always load xand y chunks regardless of the values in a given cond. (Assuming that the sizes and chunks in cond, x, and y are all the same.)
If data cubes are opened via special chunk stores backed by some data API (such as the SentinelHubChunkStore in xcube-sh), we want to avoid fetching x or y chunks if a related cond chunk consists entirely of zeros or ones.
This can drastically reduce processing time and number of API requests, for example when in EO data only land surfaces are required and data comprises mostly water or clouds. In the case of Sentinel Hub it will also reduce the costs for users.
Describe the solution you'd like
A special xcube.where(cond, x, y) so that x or y chunks are not loaded if a related cond chunk is all zero or one.
Describe alternatives you've considered
May also post an xarray feature request.
Additional context
See class SentinelHubChunkStore in chunkstore.py in xcube-sh.
Is your feature request related to a problem? Please describe.
The
xarray.where(cond, x, y)
function will always loadx
andy
chunks regardless of the values in a givencond
. (Assuming that the sizes and chunks incond
,x
, andy
are all the same.)If data cubes are opened via special chunk stores backed by some data API (such as the
SentinelHubChunkStore
inxcube-sh
), we want to avoid fetchingx
ory
chunks if a relatedcond
chunk consists entirely of zeros or ones.This can drastically reduce processing time and number of API requests, for example when in EO data only land surfaces are required and data comprises mostly water or clouds. In the case of Sentinel Hub it will also reduce the costs for users.
Describe the solution you'd like
A special
xcube.where(cond, x, y)
so thatx
ory
chunks are not loaded if a relatedcond
chunk is all zero or one.Describe alternatives you've considered
May also post an
xarray
feature request.Additional context
See class
SentinelHubChunkStore
in chunkstore.py inxcube-sh
.Related DCFS issue: https://gitext.sinergise.com/dcfs/common/-/issues/245