Skip to content

Commit 3d327e1

Browse files
authored
docs(flood): add missing reference entries, examples, and backend notes (#3502)
* docs(flood): add missing reference entries, examples, and backend notes Three public flood functions (vegetation_roughness, vegetation_curve_number, flood_depth_vegetation) were exported but listed in no autosummary block, so they were absent from the rendered API reference. Add them to docs/source/reference/flood.rst. None of the seven public functions had an Examples section or stated which array backends they support. Add a runnable example and a backend note to each docstring, matching the convention used elsewhere in xrspatial. Document NaN propagation for curve_number_runoff and travel_time, which previously omitted it. Documentation only; no behavior changes. Examples were executed against all backends available on the build host. * chore(sweep): record flood doc-sweep state (PR #3502)
1 parent 85575e4 commit 3d327e1

3 files changed

Lines changed: 144 additions & 0 deletions

File tree

.claude/sweep-documentation-state.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module,last_inspected,issue,severity_max,categories_found,notes,doc_coverage
2+
flood,2026-06-25,,HIGH,1;4;5,"Cat4 HIGH: vegetation_roughness, vegetation_curve_number, flood_depth_vegetation public but absent from reference/flood.rst; Cat1 MEDIUM: no Examples on any of 7 public funcs; Cat5 MEDIUM: backend support undocumented (all 4 backends) + NaN propagation undocumented for curve_number_runoff/travel_time. Fixed in deep-sweep-documentation-flood-2026-06-25: added 3 rst entries, Examples+backend Notes to all 7 funcs (examples executed OK on CUDA host), NaN notes. PR #3502 opened with the fix; gh issue create blocked by auto-mode classifier so no issue number.",7/7
23
classify,2026-06-25,3506,MEDIUM,1;3,"Cat3: reclassify (numpy/dask/cupy blocks) + equal_interval example outputs were stale/wrong, binary used np.nan in array repr; corrected to actual output (tests confirm code is correct). Cat1: added missing Examples to std_mean, head_tail_breaks, percentiles, maximum_breaks, box_plot. Fixed in deep-sweep-documentation-classify-2026-06-25 (PR for #3506). Cat2 natural_breaks num_sample-None omission already tracked in #3501 (left alone). All 10 public funcs listed in reference/classification.rst (no Cat4 gap). CUDA available: ran numpy examples; cupy/dask reprs reviewed statically.",10/10
34
geotiff,2026-06-25,,MEDIUM,1,"to_geotiff (public write entry point) had Parameters/Returns/Raises but no Examples section while open_geotiff does (Cat1 MEDIUM); added Examples block (plain GeoTIFF, cog=True, .vrt mosaic) modeled on open_geotiff; fixed on deep-sweep-documentation-geotiff-2026-06-25; repo issues disabled so no issue number. Cat2/3/4/5 clean: open_geotiff/to_geotiff signature-docstring parity locked by parity/test_signature_contract.py + write/test_bigtiff.py + test_polish.py; both funcs in autosummary in reference/geotiff.rst; reference page mirrors SUPPORTED_FEATURES tiers (tier-parity gate); CUDA available, all docstring examples are +SKIP illustrative only",2/2
45
fire,2026-06-25,,MEDIUM,1;5,"all 7 public funcs (dnbr, rdnbr, burn_severity_class, fireline_intensity, flame_length, rate_of_spread, kbdi) lacked Examples section (Cat1 MEDIUM) and backend-support note (Cat5 MEDIUM); fixed in deep-sweep-documentation-fire-2026-06-25-01; repo issues disabled so no issue number; examples run and outputs match numpy backend; all 7 listed in reference/fire.rst; no Cat2/Cat3/Cat4 issues",7/7

docs/source/reference/flood.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,24 @@ Travel Time
3131
:toctree: _autosummary
3232

3333
xrspatial.flood.travel_time
34+
35+
Vegetation Roughness
36+
====================
37+
.. autosummary::
38+
:toctree: _autosummary
39+
40+
xrspatial.flood.vegetation_roughness
41+
42+
Vegetation Curve Number
43+
=======================
44+
.. autosummary::
45+
:toctree: _autosummary
46+
47+
xrspatial.flood.vegetation_curve_number
48+
49+
Flood Depth Vegetation
50+
======================
51+
.. autosummary::
52+
:toctree: _autosummary
53+
54+
xrspatial.flood.flood_depth_vegetation

xrspatial/flood.py

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,22 @@ def flood_depth(
151151
xarray.DataArray
152152
2D float64 grid of flood depths. ``NaN`` where not inundated
153153
or where the input is ``NaN``.
154+
155+
Notes
156+
-----
157+
Supports NumPy, CuPy, Dask with NumPy, and Dask with CuPy backed
158+
xarray DataArrays.
159+
160+
Examples
161+
--------
162+
.. sourcecode:: python
163+
164+
>>> import numpy as np
165+
>>> import xarray as xr
166+
>>> from xrspatial import flood_depth
167+
>>> hand = xr.DataArray(
168+
... np.array([[0.0, 2.0], [5.0, 10.0]]), dims=['y', 'x'])
169+
>>> depth = flood_depth(hand, water_level=5.0)
154170
"""
155171
_validate_raster(hand_agg, func_name='flood_depth', name='hand_agg')
156172
if not isinstance(water_level, (int, float)):
@@ -239,6 +255,22 @@ def inundation(
239255
-------
240256
xarray.DataArray
241257
2D float64 binary mask.
258+
259+
Notes
260+
-----
261+
Supports NumPy, CuPy, Dask with NumPy, and Dask with CuPy backed
262+
xarray DataArrays.
263+
264+
Examples
265+
--------
266+
.. sourcecode:: python
267+
268+
>>> import numpy as np
269+
>>> import xarray as xr
270+
>>> from xrspatial import inundation
271+
>>> hand = xr.DataArray(
272+
... np.array([[0.0, 2.0], [5.0, 10.0]]), dims=['y', 'x'])
273+
>>> mask = inundation(hand, water_level=5.0)
242274
"""
243275
_validate_raster(hand_agg, func_name='inundation', name='hand_agg')
244276
if not isinstance(water_level, (int, float)):
@@ -330,6 +362,23 @@ def curve_number_runoff(
330362
-------
331363
xarray.DataArray
332364
2D float64 runoff depth in millimetres.
365+
366+
Notes
367+
-----
368+
Supports NumPy, CuPy, Dask with NumPy, and Dask with CuPy backed
369+
xarray DataArrays. ``NaN`` in ``rainfall`` or ``curve_number``
370+
propagates to ``NaN`` in the output.
371+
372+
Examples
373+
--------
374+
.. sourcecode:: python
375+
376+
>>> import numpy as np
377+
>>> import xarray as xr
378+
>>> from xrspatial import curve_number_runoff
379+
>>> rainfall = xr.DataArray(
380+
... np.array([[10.0, 50.0], [100.0, 150.0]]), dims=['y', 'x'])
381+
>>> runoff = curve_number_runoff(rainfall, curve_number=80.0)
333382
"""
334383
_validate_raster(rainfall, func_name='curve_number_runoff',
335384
name='rainfall')
@@ -450,6 +499,25 @@ def travel_time(
450499
2D float64 travel time grid (same time units as flow_length
451500
distance units and velocity units, typically seconds when
452501
flow_length is in metres).
502+
503+
Notes
504+
-----
505+
Supports NumPy, CuPy, Dask with NumPy, and Dask with CuPy backed
506+
xarray DataArrays. ``NaN`` in ``flow_length_agg`` or ``slope_agg``
507+
propagates to ``NaN`` in the output.
508+
509+
Examples
510+
--------
511+
.. sourcecode:: python
512+
513+
>>> import numpy as np
514+
>>> import xarray as xr
515+
>>> from xrspatial import travel_time
516+
>>> flow_length = xr.DataArray(
517+
... np.array([[100.0, 200.0]]), dims=['y', 'x'])
518+
>>> slope = xr.DataArray(
519+
... np.array([[10.0, 45.0]]), dims=['y', 'x'])
520+
>>> tt = travel_time(flow_length, slope, mannings_n=0.03)
453521
"""
454522
_validate_raster(flow_length_agg, func_name='travel_time',
455523
name='flow_length_agg')
@@ -573,6 +641,23 @@ def vegetation_roughness(
573641
xarray.DataArray
574642
2D float64 Manning's n raster. Unrecognized NLCD codes and
575643
NaN inputs map to NaN.
644+
645+
Notes
646+
-----
647+
Supports NumPy, CuPy, Dask with NumPy, and Dask with CuPy backed
648+
xarray DataArrays.
649+
650+
Examples
651+
--------
652+
.. sourcecode:: python
653+
654+
>>> import numpy as np
655+
>>> import xarray as xr
656+
>>> from xrspatial import vegetation_roughness
657+
>>> nlcd = xr.DataArray(
658+
... np.array([[41, 71], [11, 82]], dtype=np.int32),
659+
... dims=['y', 'x'])
660+
>>> roughness = vegetation_roughness(nlcd, mode='nlcd')
576661
"""
577662
_validate_raster(vegetation_agg, func_name='vegetation_roughness',
578663
name='vegetation_agg')
@@ -736,6 +821,24 @@ def vegetation_curve_number(
736821
xarray.DataArray
737822
2D float64 curve number raster. Unknown ``(code, group)``
738823
pairs and NaN inputs map to NaN.
824+
825+
Notes
826+
-----
827+
Supports NumPy, CuPy, Dask with NumPy, and Dask with CuPy backed
828+
xarray DataArrays.
829+
830+
Examples
831+
--------
832+
.. sourcecode:: python
833+
834+
>>> import numpy as np
835+
>>> import xarray as xr
836+
>>> from xrspatial import vegetation_curve_number
837+
>>> landcover = xr.DataArray(
838+
... np.array([[41, 24]], dtype=np.int32), dims=['y', 'x'])
839+
>>> soil_group = xr.DataArray(
840+
... np.array([[1, 4]], dtype=np.int32), dims=['y', 'x'])
841+
>>> cn = vegetation_curve_number(landcover, soil_group)
739842
"""
740843
_validate_raster(landcover_agg, func_name='vegetation_curve_number',
741844
name='landcover_agg')
@@ -883,6 +986,25 @@ def flood_depth_vegetation(
883986
xarray.DataArray
884987
2D float64 flood depth grid. NaN where not inundated or
885988
where inputs are NaN.
989+
990+
Notes
991+
-----
992+
Supports NumPy, CuPy, Dask with NumPy, and Dask with CuPy backed
993+
xarray DataArrays.
994+
995+
Examples
996+
--------
997+
.. sourcecode:: python
998+
999+
>>> import numpy as np
1000+
>>> import xarray as xr
1001+
>>> from xrspatial import flood_depth_vegetation
1002+
>>> hand = xr.DataArray(
1003+
... np.array([[0.0, 1.0]]), dims=['y', 'x'])
1004+
>>> slope = xr.DataArray(
1005+
... np.array([[10.0, 10.0]]), dims=['y', 'x'])
1006+
>>> depth = flood_depth_vegetation(
1007+
... hand, slope, mannings_n=0.10, unit_discharge=0.5)
8861008
"""
8871009
_validate_raster(hand_agg, func_name='flood_depth_vegetation',
8881010
name='hand_agg')

0 commit comments

Comments
 (0)