docs(classify): fix stale example outputs and add missing examples#3516
Conversation
The reclassify and equal_interval docstring examples printed arrays that do not match what the functions return for the given input; binary used np.nan in the array repr where numpy prints plain nan. Correct all three to the actual output (test_classify.py fixtures confirm the code is right, so only the docstrings were stale). Add Examples sections to std_mean, head_tail_breaks, percentiles, maximum_breaks, and box_plot, which had Parameters/Returns/References but no example. Docs only; no behavior change. Refs xarray-contrib#3506
Address review feedback on PR xarray-contrib#3516: the reclassify docstring still showed pre-refactor lazy reprs next to the corrected result arrays. - agg_da repr: dtype float32 -> float64 (the example input is float64) - lazy result repr: task name _run_numpy_bin -> xrspatial.reclassify (renamed via _dask_task_name_kwargs) - cupy type: cupy.core.core.ndarray -> cupy.ndarray Verified each repr against output on a CUDA host. Docs only. Refs xarray-contrib#3506
Review: classify docstring examplesRe-ran every docstring example on a CUDA host and diffed the printed output against actual output. Blockers: none. Suggestion (fixed in ef98faa): the
All three corrected against live output. Nit (left as-is): the example headers omit the What looks good: the two genuinely wrong outputs ( |
…ion-classify-2026-06-25 # Conflicts: # .claude/sweep-documentation-state.csv
Fixes the documentation issues found by the documentation sweep on the
classifymodule (#3506).Stale / wrong example output
reclassify: the numpy, dask, and cupy example blocks all printed an array that does not match the function's result for the example input. Corrected all three to the actual output.equal_interval: the example printed a stale array. Corrected to the actual output.binary: the example usednp.nanin the array repr where numpy printsnan. Fixed.test_classify.pyfixtures confirm the functions return the corrected values, so the code was right and only the docstrings were stale.Missing Examples
Added an Examples section to
std_mean,head_tail_breaks,percentiles,maximum_breaks, andbox_plot. Each output was generated by running the function and pasted verbatim.Scope
Docs only. No behavior change.
test_classify.pypasses (102) and flake8 is clean.The
natural_breaksnum_sample/Nonetype omission (already tracked in #3501) is intentionally left out of this PR.