Skip to content

Add Fosberg dead fuel moisture grid SDK support - #207

Merged
amarcozzi merged 4 commits into
mainfrom
197-fosberg-dead-fuel-moisture-grid
Aug 26, 2026
Merged

Add Fosberg dead fuel moisture grid SDK support#207
amarcozzi merged 4 commits into
mainfrom
197-fosberg-dead-fuel-moisture-grid

Conversation

@amarcozzi

Copy link
Copy Markdown
Contributor

Summary

Wraps the generated create_fosberg_fuel_moisture_grid endpoint as a new grid family (fuel_moisture) with no prior SDK surface:

  • Adds ff.grids.create_dead_fuel_moisture_grid_from_fosberg(...), returning a pending Grid whose single fuel_moisture.dead.1hr band is derived from a topography grid (slope + aspect) and a Leaflux irradiance grid (irradiance.surface.relative).
  • Source grids are accepted as Grid objects or bare id strings. When a Grid is passed, it is checked for completion and required bands, and the domain id is resolved from it; when both sources are bare ids the call raises a clear ValueError (the domain can't be resolved).
  • Validates the ranges the request model documents — dry_bulb_temp >= 10, relative_humidity 0–100, time in HHMM 0800–1959 (minutes 00–59) — mirroring the _duet_integer style, and coerces month/elevation to their enums.
  • Exports the function via grids.__all__ (module-qualified ff.grids.create_*, matching the other creators).

Testing

  • Added TestCreateDeadFuelMoistureGridFromFosberg mirroring the DUET test class: request-building (via monkeypatched endpoint), grid-object/id resolution, domain-resolution error, completion/band guards, and parametrized range validation. 16 offline unit tests pass; full offline unit selection (Fosberg + helpers + alignment + signatures) is 35 passing. black and flake8 are clean (enforced by pre-commit).
  • Added a live end-to-end test (test_create_live) that voxelizes a tree inventory (leaf_area_density), builds a Leaflux irradiance grid, then creates and waits on the Fosberg grid.

Live-test status

The live API and credentials work (the voxelize step runs live). However the generated Leaflux client is currently out of sync with the live server: it sends source_grid_id while the server now requires source_lad_grid_id, so the irradiance prerequisite can't be built yet. This is a Leaflux (#195) client-regeneration concern, not part of the Fosberg endpoint. The live test therefore pytest.skips with a clear reason when the irradiance grid can't be created, so it exercises the Fosberg call end-to-end once the Leaflux client is realigned, without spuriously failing CI in the meantime.

Closes #197

Wrap the create_fosberg_fuel_moisture_grid endpoint as
create_dead_fuel_moisture_grid_from_fosberg, a new fuel_moisture grid
family derived from a topography grid (slope + aspect) and a Leaflux
irradiance grid.

Source grids are accepted as Grid objects or bare ids; when a Grid is
passed it is checked for completion and required bands, and the domain is
resolved from it. Validates dry_bulb_temp (>= 10), relative_humidity
(0-100), and time (HHMM 0800-1959), and coerces month/elevation to their
enums. Adds offline unit tests for request-building and range validation
plus a live end-to-end test.
…-moisture-grid

# Conflicts:
#	fastfuels_sdk/v2/grids.py
#	tests/v2/test_grids.py
@amarcozzi

Copy link
Copy Markdown
Contributor Author

On hold — do not merge yet.

The Fosberg SDK wrapper and its offline tests are complete and passing, and this branch has been merged up to date with main (picking up the leaflux source_lad_grid_id rename). However, the live end-to-end test cannot pass until an upstream backend bug is fixed:

Holding this PR until #547 lands, after which test_create_live should pass without changes.

…-moisture-grid

# Conflicts:
#	tests/v2/test_grids.py
@amarcozzi

Copy link
Copy Markdown
Contributor Author

Unblocked — ready to merge.

FastFuels-API-v2 #548 (reject source grids that don't share a horizontal lattice) is merged and deployed to api-v2-prod (revision api-v2-prod-00232-d4w).

Merged main into this branch and updated the Fosberg live test for the new contract: the topography grid is now built with create_topography_grid_from_3dep(..., align_to=voxels, bands=["elevation", "slope", "aspect"]) so the topography, LAD, and leaflux irradiance grids all share one horizontal lattice (elevation feeds the leaflux surface draping; slope/aspect feed Fosberg). test_create_live now runs the full chain (voxelize → aligned topo → surface irradiance → Fosberg) and passes end-to-end against the deployed API (verified, 52s). Offline unit tests pass; black/flake8 clean.

@amarcozzi
amarcozzi merged commit 4519ff2 into main Aug 26, 2026
3 checks passed
@amarcozzi
amarcozzi deleted the 197-fosberg-dead-fuel-moisture-grid branch August 26, 2026 21:58
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.

SDK: Fosberg dead fuel moisture grids (new grid family)

1 participant