docs(bump): correct height_func contract and count default in docstring#3607
Merged
brendancol merged 2 commits intoJul 6, 2026
Merged
Conversation
The height_func Parameters entry described a per-point f(x, y) contract, but bump() calls height_func(locations) once with a (count, 2) array of integer (x, y) coordinates and expects a length-count heights array back. The documented per-point form raises TypeError when used literally. Also mark count as optional and document its default of min(width * height // 10, 10_000_000), which was previously unstated. Docstring-only; no behavior change. Records the doc sweep state for bump. Refs xarray-contrib#3606
brendancol
commented
Jul 6, 2026
brendancol
left a comment
Contributor
Author
There was a problem hiding this comment.
PR Review: docs(bump): correct height_func contract and count default in docstring
Documentation-only change to bump() in xrspatial/bump.py. I verified the corrected claims by running the code against the worktree build.
Blockers (must fix before merge)
None.
Suggestions (should fix, not blocking)
None.
Nits (optional improvements)
xrspatial/bump.py:184-185: thecountdefault is written asmin(width * height // 10, 10_000_000). Whenaggis passed,width/heightare ignored and the dimensions come fromagg.shape(lines 337-338, 344). The formula is still correct in terms of the raster size, but a reader who only passesaggmight wonder wherewidth/heightcome from. Optional: phrase it in terms of the output raster dimensions.
What looks good
- The old
height_funcdescription (function which takes x, y) was wrong: the code callsheight_func(locs)once with a single(count, 2)int32 array (line 394), so a literalf(x, y)callable raisesTypeError. I confirmed both the new contract and theTypeErroron the old one. - The new
countdoc matchescount = min(w * h // 10, _MAX_DEFAULT_COUNT)with_MAX_DEFAULT_COUNT = 10_000_000(lines 349-350, 29). - The
height_func=Nonedefault is documented as height 1, matchinglambda bumps: np.ones(len(bumps))(line 387). - The docstring's own plot example already uses the
(count, 2)contract (heights(locations, ...)readinglocations.shape[0]/locations[r]), so example and prose are now consistent.
Checklist
- Docstring matches actual behavior (verified by execution)
- Parameter types and defaults documented
- [n/a] Algorithm/backend/NaN/dask correctness — no code changed
- [n/a] Benchmark / README feature matrix — docs-only, no API surface change
…ion-bump-2026-07-02 # Conflicts: # xrspatial/bump.py
brendancol
commented
Jul 6, 2026
brendancol
left a comment
Contributor
Author
There was a problem hiding this comment.
PR Review (follow-up): docs(bump): correct height_func contract and count default
Re-review after merging origin/main and applying the one nit from the first pass.
What changed since the last review
- Merged
origin/main(was 19 commits behind, PR showed CONFLICTING). The only conflict was in thebump()docstring, where main's #3610 had rewritten thecountline and added thename=parameter while still carrying the old, wrongheight_functext. Resolved by keeping this PR's correctedheight_funccontract and main'sname=parameter (signaturename: str = 'bump', doc entry, andname=nameon bothDataArrayreturns are all present). PR is now MERGEABLE. - Applied the nit I raised: the
countdefault now readsmin(w * h // 10, 10_000_000), wherew/hare the output raster dimensions (taken fromaggwhen given), instead of namingwidth/heightwhich are ignored on theaggpath.
Blockers / Suggestions
None.
Nits
None outstanding.
Verification
pytest xrspatial/tests/test_bump.py— 20 passed against the worktree build.- Post-merge diff vs base is confined to the
bump()docstring and the sweep state CSV. No code paths changed.
Checklist
- Merge conflict resolved preserving both main's
name=and this PR's corrections - Docstring matches actual behavior (verified by execution earlier)
- Tests pass post-merge
- [n/a] Algorithm/backend/NaN/dask correctness — no code changed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two accuracy problems in the
bump()docstring, found during a documentation sweep of the module.height_funcwas described as takingx, yper point.bump()actually calls it once with a(count, 2)locations array and expects a length-countheights array back. The per-point form raisesTypeErrorwhen used literally.countwas typedintwith no default. It is optional and defaults tomin(width * height // 10, 10_000_000).Docstring-only, no behavior change. The runnable example already used the array-based
height_funcconvention, so it needed no edit.Closes #3606