Skip to content

docs(mahalanobis): add Examples and document NaN propagation#3581

Merged
brendancol merged 1 commit into
xarray-contrib:mainfrom
brendancol:deep-sweep-documentation-mahalanobis-2026-06-30
Jul 1, 2026
Merged

docs(mahalanobis): add Examples and document NaN propagation#3581
brendancol merged 1 commit into
xarray-contrib:mainfrom
brendancol:deep-sweep-documentation-mahalanobis-2026-06-30

Conversation

@brendancol

Copy link
Copy Markdown
Contributor

Adds the missing pieces to the mahalanobis() docstring:

  • An Examples section with a runnable .. sourcecode:: python block. The example mixes a NaN into one band so the output shows propagation directly.
  • A Notes section covering the NaN rule (any non-finite band -> NaN pixel), the auto-stats requirement (at least N+1 pixels finite across all bands), and the four supported backends.
  • default='mahalanobis' on the name parameter, matching how normalize.rescale documents its name.

Documentation only. No behavior change. The Returns float64/shape claim and the four-backend claim already match the ArrayTypeFunctionMapping dispatch, so those were left alone. Existing test_mahalanobis.py still passes (24 tests).

Closes #3579

The public mahalanobis() docstring had Parameters and Returns but no
Examples section, unlike peer utilities such as normalize.rescale. Its
NaN-propagation rule was also undocumented despite being pinned by
test_nan_propagation.

Add a runnable Examples block (whose input includes a NaN so the output
shows propagation directly), a Notes section covering the NaN rule, the
auto-stats N+1 all-finite requirement, and the four supported backends,
and note default='mahalanobis' on the name parameter. Documentation only;
no behavior change.

Refs xarray-contrib#3579
@brendancol brendancol merged commit 5161ad2 into xarray-contrib:main Jul 1, 2026
12 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.

Docs: mahalanobis() docstring has no Examples section and no NaN note

1 participant