Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use fancy index for subsets over Dask data #2444

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion glue/core/fixed_resolution_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,14 @@ def compute_fixed_resolution_buffer(data, bounds, target_data=None, target_cid=N
# array. This won't be very efficient when dealing with 3d fixed
# resolution buffers, but it will at least work as opposed to not.

if target_cid is not None and isinstance(data, Data) and isinstance(data.get_component(target_cid), DaskComponent):
# Since subset definitions can be pretty arbitrary, we do not rely
# on fancy indexing if the target dataset has any DaskComponents
# when we apply subset_state.

target_cid_is_dask = target_cid is not None and isinstance(data, Data) and isinstance(data.get_component(target_cid), DaskComponent)
subset_over_dask_data = subset_state is not None and any([isinstance(data.get_component(comp), DaskComponent) for comp in data.main_components])

if target_cid_is_dask or subset_over_dask_data:

# Extract sub-region of data first, then fetch exact coordinate values
subregion = tuple([slice(np.nanmin(coord), np.nanmax(coord) + 1) for coord in translated_coords])
Expand Down
Loading