Skip to content

flood: validate mannings_n DataArray values#1438

Merged
brendancol merged 1 commit into
mainfrom
issue-1437
May 4, 2026
Merged

flood: validate mannings_n DataArray values#1438
brendancol merged 1 commit into
mainfrom
issue-1437

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #1437.

Summary

  • Add _validate_mannings_n_dataarray() helper that enforces finite, strictly positive values when mannings_n is supplied as a DataArray (the scalar path already enforces this).
  • Wired into travel_time and flood_depth_vegetation.
  • Bad mannings_n DataArrays now raise ValueError instead of silently producing inf velocity / 0 / NaN output.

Test plan

  • 6 new tests in TestMannigsNDataArrayValidation.
  • Full flood suite: 88 passed (82 existing + 6 new).
  • CI run on full suite.

travel_time and flood_depth_vegetation accept mannings_n as either a
scalar or a DataArray.  The scalar path enforced mannings_n > 0, but
the DataArray path performed no validation.  A roughness raster
containing 0 silently produced inf velocity / 0 travel time;
negatives produced negative travel time; NaN/Inf propagated.

Add a _validate_mannings_n_dataarray helper that calls _validate_raster
for structural checks and then verifies all values are finite and
strictly positive.  Wired into both travel_time (line 419) and
flood_depth_vegetation (line 853).

6 new tests in TestMannigsNDataArrayValidation.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 3, 2026
brendancol added a commit that referenced this pull request May 3, 2026
Records the 11 PRs filed this round:
- hydro: HIGH flow_direction_mfd memory guard (PR #1424); MEDIUM
  bundles for _validate_raster on secondary args (#1426), scalar
  param validation (#1428), and cellsize validation (#1430).
- reproject: MEDIUM bundles for _validate_raster (#1432), grid/bounds/
  precision validation (#1434), and NaN/Inf rejection (#1436).
- flood: mannings_n DataArray validation (#1438).
- pathfinding: waypoint cap + _validate_raster (#1440).
- polygonize: _validate_raster (#1442).
- terrain: scratch memory guard + scalar validation (#1444).
@brendancol brendancol merged commit 71d6c59 into main May 4, 2026
11 checks passed
@brendancol brendancol deleted the issue-1437 branch May 4, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flood: travel_time/flood_depth_vegetation skip mannings_n DataArray validation

1 participant