Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions docs/v2/guides/composing-grids.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ same two-dimensional lattice. For creating the source grids, see
## Select and calculate output bands

Give each input grid an alias. Use that alias when referring to its bands in
select and compute operations:
select and compute operations, and pass the operations as one `operations`
list with one entry per output band:

```python
import fastfuels_sdk.v2 as ff
Expand All @@ -34,10 +35,8 @@ fuel_grid.wait()

composed = ff.grids.create_grid_from_compose(
{"fuels": fuel_grid},
select=[
operations=[
ff.compose.select("fuel_depth", "fuels.fuel_depth"),
],
compute=[
ff.compose.compute(
"fuel_load.1hr",
"multiply",
Expand All @@ -53,8 +52,8 @@ composed.wait()
```

The alias mapping can contain more than one grid. Every band reference uses
the form `alias.band_key`; output names must be unique across the `select` and
`compute` lists.
the form `alias.band_key`. Output names must be unique within `operations`,
and the composed grid's bands follow the order of the list.

The arithmetic operators are `add`, `subtract`, `multiply`, `divide`, `min`,
`max`, and `average`. Conditions are ANDed together and require an `else_`
Expand Down
4 changes: 2 additions & 2 deletions docs/v2/guides/creating-grids.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ matches a lattice exactly.
To estimate 1-hour dead fuel moisture with the Fosberg model, pass a
topography grid and a surface-irradiance grid to
`create_dead_fuel_moisture_grid_from_fosberg` along with the weather inputs.
The result carries a single `fuel_moisture.dead.1hr` band (percent). For the
The result carries a single `fuel_moisture.1hr` band (percent). For the
Fosberg 1-hr dead fuel moisture model itself, see the
[FastFuels documentation](https://docs.fastfuels.silvxlabs.com).

Expand Down Expand Up @@ -592,7 +592,7 @@ moisture.wait()

```python
>>> [band.key for band in moisture.bands]
['fuel_moisture.dead.1hr']
['fuel_moisture.1hr']
```

!!! warning "Grids must share one lattice"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def sync_detailed(

# Create Fosberg 1-hour Dead Fuel Moisture Grid

Creates a grid with a single continuous band, `fuel_moisture.dead.1hr`
Creates a grid with a single continuous band, `fuel_moisture.1hr`
(percent), computed with the Fosberg & Deeming (1971) 1-hour dead fuel
moisture model.

Expand Down Expand Up @@ -145,7 +145,7 @@ def sync(

# Create Fosberg 1-hour Dead Fuel Moisture Grid

Creates a grid with a single continuous band, `fuel_moisture.dead.1hr`
Creates a grid with a single continuous band, `fuel_moisture.1hr`
(percent), computed with the Fosberg & Deeming (1971) 1-hour dead fuel
moisture model.

Expand Down Expand Up @@ -203,7 +203,7 @@ async def asyncio_detailed(

# Create Fosberg 1-hour Dead Fuel Moisture Grid

Creates a grid with a single continuous band, `fuel_moisture.dead.1hr`
Creates a grid with a single continuous band, `fuel_moisture.1hr`
(percent), computed with the Fosberg & Deeming (1971) 1-hour dead fuel
moisture model.

Expand Down Expand Up @@ -264,7 +264,7 @@ async def asyncio(

# Create Fosberg 1-hour Dead Fuel Moisture Grid

Creates a grid with a single continuous band, `fuel_moisture.dead.1hr`
Creates a grid with a single continuous band, `fuel_moisture.1hr`
(percent), computed with the Fosberg & Deeming (1971) 1-hour dead fuel
moisture model.

Expand Down
24 changes: 24 additions & 0 deletions fastfuels_sdk/v2/client_library/api/grids/create_geotiff_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ def sync_detailed(
`bands[0]` → GeoTIFF band 1, `bands[1]` → GeoTIFF band 2, etc.
Each band key becomes a variable name in the output Zarr store.

A key is `<quantity>` or `<quantity>.<label>` (`fbfm`, `fuel_load.1hr`,
`fuel_load.shrub`). The quantity sets the band's `type` and `unit`, so
they can be omitted; if given they must match. An uploaded band is then
accepted wherever a band of that quantity is, e.g. an uploaded `fbfm`
feeds an FBFM40 lookup.

## CRS Handling

The GeoTIFF must have a CRS set and must match the domain CRS. A mismatch
Expand Down Expand Up @@ -171,6 +177,12 @@ def sync(
`bands[0]` → GeoTIFF band 1, `bands[1]` → GeoTIFF band 2, etc.
Each band key becomes a variable name in the output Zarr store.

A key is `<quantity>` or `<quantity>.<label>` (`fbfm`, `fuel_load.1hr`,
`fuel_load.shrub`). The quantity sets the band's `type` and `unit`, so
they can be omitted; if given they must match. An uploaded band is then
accepted wherever a band of that quantity is, e.g. an uploaded `fbfm`
feeds an FBFM40 lookup.

## CRS Handling

The GeoTIFF must have a CRS set and must match the domain CRS. A mismatch
Expand Down Expand Up @@ -237,6 +249,12 @@ async def asyncio_detailed(
`bands[0]` → GeoTIFF band 1, `bands[1]` → GeoTIFF band 2, etc.
Each band key becomes a variable name in the output Zarr store.

A key is `<quantity>` or `<quantity>.<label>` (`fbfm`, `fuel_load.1hr`,
`fuel_load.shrub`). The quantity sets the band's `type` and `unit`, so
they can be omitted; if given they must match. An uploaded band is then
accepted wherever a band of that quantity is, e.g. an uploaded `fbfm`
feeds an FBFM40 lookup.

## CRS Handling

The GeoTIFF must have a CRS set and must match the domain CRS. A mismatch
Expand Down Expand Up @@ -306,6 +324,12 @@ async def asyncio(
`bands[0]` → GeoTIFF band 1, `bands[1]` → GeoTIFF band 2, etc.
Each band key becomes a variable name in the output Zarr store.

A key is `<quantity>` or `<quantity>.<label>` (`fbfm`, `fuel_load.1hr`,
`fuel_load.shrub`). The quantity sets the band's `type` and `unit`, so
they can be omitted; if given they must match. An uploaded band is then
accepted wherever a band of that quantity is, e.g. an uploaded `fbfm`
feeds an FBFM40 lookup.

## CRS Handling

The GeoTIFF must have a CRS set and must match the domain CRS. A mismatch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def sync_detailed(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2024\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.

## Response

Expand Down Expand Up @@ -151,6 +152,7 @@ def sync(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2024\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.

## Response

Expand Down Expand Up @@ -203,6 +205,7 @@ async def asyncio_detailed(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2024\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.

## Response

Expand Down Expand Up @@ -258,6 +261,7 @@ async def asyncio(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2024\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.

## Response

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def sync_detailed(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2024\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.
- **season**: (optional) LANDFIRE Seasonal Fuels release: \"ES\" (early
spring), \"SP\" (spring), \"SU\" (summer), or \"FA\" (fall).

Expand Down Expand Up @@ -158,6 +159,7 @@ def sync(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2024\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.
- **season**: (optional) LANDFIRE Seasonal Fuels release: \"ES\" (early
spring), \"SP\" (spring), \"SU\" (summer), or \"FA\" (fall).

Expand Down Expand Up @@ -217,6 +219,7 @@ async def asyncio_detailed(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2024\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.
- **season**: (optional) LANDFIRE Seasonal Fuels release: \"ES\" (early
spring), \"SP\" (spring), \"SU\" (summer), or \"FA\" (fall).

Expand Down Expand Up @@ -279,6 +282,7 @@ async def asyncio(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2024\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.
- **season**: (optional) LANDFIRE Seasonal Fuels release: \"ES\" (early
spring), \"SP\" (spring), \"SU\" (summer), or \"FA\" (fall).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def sync_detailed(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2023\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.
- **remove_bare_ground**: (optional) Remove bare ground cells (fuelbed ID 0),
replaced by neighboring majority. Default: False.

Expand Down Expand Up @@ -153,6 +154,7 @@ def sync(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2023\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.
- **remove_bare_ground**: (optional) Remove bare ground cells (fuelbed ID 0),
replaced by neighboring majority. Default: False.

Expand Down Expand Up @@ -207,6 +209,7 @@ async def asyncio_detailed(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2023\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.
- **remove_bare_ground**: (optional) Remove bare ground cells (fuelbed ID 0),
replaced by neighboring majority. Default: False.

Expand Down Expand Up @@ -264,6 +267,7 @@ async def asyncio(
- **description**: (optional) Description.
- **tags**: (optional) Tags for organizing grids.
- **version**: (optional) LANDFIRE version. Default: \"2023\".
- **disturbance**: (optional) Update for recent LANDFIRE disturbance.
- **remove_bare_ground**: (optional) Remove bare ground cells (fuelbed ID 0),
replaced by neighboring majority. Default: False.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def sync_detailed(
client: AuthenticatedClient,
body: CreateLayersetRasterizeRequest,
) -> Response[Grid | HTTPValidationError | QuotaExceededDetail]:
"""Create a grid by rasterizing a layerset
r"""Create a grid by rasterizing a layerset

# Create Layerset-Rasterized Grid

Expand All @@ -99,6 +99,23 @@ def sync_detailed(
polygon coverage are populated with the rasterizer's fill value.
- **name**, **description**, **tags**, **modifications**: standard grid metadata.

## Bands

The band list is empty until rasterization completes; it depends on the
layerset's `fuel_type` values. Each fuel type yields five continuous
bands keyed `<quantity>.<fuel type>`:

- `fuel_load.<fuel type>` (kg/m**2)
- `fuel_depth.<fuel type>` (m)
- `fuel_moisture.live.<fuel type>` (%)
- `fuel_moisture.dead.<fuel type>` (%)
- `heat_content.<fuel type>` (kJ/kg)

The fuel type in a key is lowercased, with each run of characters other
than `a-z`, `0-9` and `_` replaced by `_` (`\"Shrub Layer\"` →
`shrub_layer`). Two fuel types that reduce to the same key, or one with
no letters or digits, fail the job with `INVALID_FUEL_TYPE`.

## Response

Returns the created Grid resource with status `pending`. The backend
Expand Down Expand Up @@ -141,7 +158,7 @@ def sync(
client: AuthenticatedClient,
body: CreateLayersetRasterizeRequest,
) -> Grid | HTTPValidationError | QuotaExceededDetail | None:
"""Create a grid by rasterizing a layerset
r"""Create a grid by rasterizing a layerset

# Create Layerset-Rasterized Grid

Expand All @@ -164,6 +181,23 @@ def sync(
polygon coverage are populated with the rasterizer's fill value.
- **name**, **description**, **tags**, **modifications**: standard grid metadata.

## Bands

The band list is empty until rasterization completes; it depends on the
layerset's `fuel_type` values. Each fuel type yields five continuous
bands keyed `<quantity>.<fuel type>`:

- `fuel_load.<fuel type>` (kg/m**2)
- `fuel_depth.<fuel type>` (m)
- `fuel_moisture.live.<fuel type>` (%)
- `fuel_moisture.dead.<fuel type>` (%)
- `heat_content.<fuel type>` (kJ/kg)

The fuel type in a key is lowercased, with each run of characters other
than `a-z`, `0-9` and `_` replaced by `_` (`\"Shrub Layer\"` →
`shrub_layer`). Two fuel types that reduce to the same key, or one with
no letters or digits, fail the job with `INVALID_FUEL_TYPE`.

## Response

Returns the created Grid resource with status `pending`. The backend
Expand Down Expand Up @@ -201,7 +235,7 @@ async def asyncio_detailed(
client: AuthenticatedClient,
body: CreateLayersetRasterizeRequest,
) -> Response[Grid | HTTPValidationError | QuotaExceededDetail]:
"""Create a grid by rasterizing a layerset
r"""Create a grid by rasterizing a layerset

# Create Layerset-Rasterized Grid

Expand All @@ -224,6 +258,23 @@ async def asyncio_detailed(
polygon coverage are populated with the rasterizer's fill value.
- **name**, **description**, **tags**, **modifications**: standard grid metadata.

## Bands

The band list is empty until rasterization completes; it depends on the
layerset's `fuel_type` values. Each fuel type yields five continuous
bands keyed `<quantity>.<fuel type>`:

- `fuel_load.<fuel type>` (kg/m**2)
- `fuel_depth.<fuel type>` (m)
- `fuel_moisture.live.<fuel type>` (%)
- `fuel_moisture.dead.<fuel type>` (%)
- `heat_content.<fuel type>` (kJ/kg)

The fuel type in a key is lowercased, with each run of characters other
than `a-z`, `0-9` and `_` replaced by `_` (`\"Shrub Layer\"` →
`shrub_layer`). Two fuel types that reduce to the same key, or one with
no letters or digits, fail the job with `INVALID_FUEL_TYPE`.

## Response

Returns the created Grid resource with status `pending`. The backend
Expand Down Expand Up @@ -264,7 +315,7 @@ async def asyncio(
client: AuthenticatedClient,
body: CreateLayersetRasterizeRequest,
) -> Grid | HTTPValidationError | QuotaExceededDetail | None:
"""Create a grid by rasterizing a layerset
r"""Create a grid by rasterizing a layerset

# Create Layerset-Rasterized Grid

Expand All @@ -287,6 +338,23 @@ async def asyncio(
polygon coverage are populated with the rasterizer's fill value.
- **name**, **description**, **tags**, **modifications**: standard grid metadata.

## Bands

The band list is empty until rasterization completes; it depends on the
layerset's `fuel_type` values. Each fuel type yields five continuous
bands keyed `<quantity>.<fuel type>`:

- `fuel_load.<fuel type>` (kg/m**2)
- `fuel_depth.<fuel type>` (m)
- `fuel_moisture.live.<fuel type>` (%)
- `fuel_moisture.dead.<fuel type>` (%)
- `heat_content.<fuel type>` (kJ/kg)

The fuel type in a key is lowercased, with each run of characters other
than `a-z`, `0-9` and `_` replaced by `_` (`\"Shrub Layer\"` →
`shrub_layer`). Two fuel types that reduce to the same key, or one with
no letters or digits, fail the job with `INVALID_FUEL_TYPE`.

## Response

Returns the created Grid resource with status `pending`. The backend
Expand Down
Loading
Loading