Skip to content

DOC: Improve coarsen docstring with detailed reduction requirements#12236

Open
VedantMadane wants to merge 1 commit intodask:mainfrom
VedantMadane:docs-coarsen-docstring
Open

DOC: Improve coarsen docstring with detailed reduction requirements#12236
VedantMadane wants to merge 1 commit intodask:mainfrom
VedantMadane:docs-coarsen-docstring

Conversation

@VedantMadane
Copy link

Summary

Improves the docstring for dask.array.coarsen by providing detailed documentation of the reduction function requirements.

Changes

  • Clarify that the reduction function must:
    • Accept an array as the first positional argument (matching the chunk array type)
    • Accept an axis keyword argument with a tuple of integer axes
    • Return an array of the same type as the input
  • Document the trim_excess parameter
  • Document that **kwargs are passed to the reduction function
  • Add a Returns section

Motivation

As noted in the issue, the original docstring only said 'Function like np.sum, np.mean, etc...' which doesn't clearly explain what properties a reduction function needs to have.

Closes #9825

@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2026

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

     21 files  ±0       21 suites  ±0   5h 28m 5s ⏱️ -27s
 18 289 tests ±0   17 015 ✅ ±0   1 274 💤 ±0  0 ❌ ±0 
317 304 runs  ±0  273 552 ✅ +3  43 752 💤  - 3  0 ❌ ±0 

Results for commit 6f0fd2f. ± Comparison against base commit 8a9b92f.

♻️ This comment has been updated with latest results.

@VedantMadane VedantMadane force-pushed the docs-coarsen-docstring branch from e9c4423 to 979a2a7 Compare February 10, 2026 11:12
@VedantMadane
Copy link
Author

Hi @dask, I've updated this PR. Could you please take a look when you have a moment? Thank you!

@VedantMadane VedantMadane force-pushed the docs-coarsen-docstring branch from 979a2a7 to 9caec31 Compare March 2, 2026 01:04
@jacobtomlinson
Copy link
Member

@jrbourbeau given your comments on the issue that this closes would you have some time to review the PR? My guess from the PR description is that this is vibe-coded, so it would be good to check the docs actually match the functionality here.

@VedantMadane VedantMadane force-pushed the docs-coarsen-docstring branch from 9caec31 to 6f0fd2f Compare March 6, 2026 06:09
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.

Docstring of dask.array.coarsen should provide more details on valid reduction functions

2 participants