Skip to content

Conversation

@brendancol
Copy link
Contributor

@brendancol brendancol commented Jan 26, 2026

fixes #777

Added chunk validation for 2D inputs in crosstab, using the existing validate_arrays function (which is already
used by zonal_stats).

…hen calling .to_array().sel(variable='band_1',

   drop=True), the resulting dask array has a different chunk structure than arrays created directly. The crosstab
  function failed because it pairs dask blocks positionally via to_delayed().ravel(), which requires aligned chunks.  To fix this:

  Added chunk validation for 2D inputs in crosstab, using the existing validate_arrays function (which is already
  used by zonal_stats). This function:
  1. Validates that shapes match
  2. Automatically rechunks values to match zones chunk structure when they differ
@brendancol brendancol self-assigned this Jan 26, 2026
@brendancol brendancol merged commit 16b6dcf into master Jan 26, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to use Dask Arrays originating from Xarray Datasets in Crosstab

2 participants