Skip to content

Create solar irradiance grids

You are viewing in-progress documentation for v2. Switch to the stable version for the current production release.

The LeafLux endpoint, grids/solar/irradiance/leaflux, computes relative solar irradiance from the leaf area density of a 3D canopy grid. For how a grid is derived from other grids, see About grids.

BandWhereOutput
irradiance.surface.relativeon the ground beneath the canopy2D (y, x)
irradiance.canopy.relativeinside the canopy, per voxel3D (z, y, x)

Both are relative values in [0, 1], a fraction of open-sky irradiance. A request for the canopy band returns a 3D grid. A request for only the surface band returns a 2D grid.

  1. An API key. my-api-key.

  2. A domain. your-domain-id.

  3. A completed 3D canopy grid with a leaf_area_density band. your-leaf-area-density-grid-id. Voxelize a tree inventory with leaf_area_density in bands to build one.

  4. (Optional) a 2D terrain grid with an elevation band. your-topography-grid-id. Build one from 3DEP with "bands": ["elevation"], aligned to the source grid’s lattice (see the caution below). Without it, the surface is a flat plane.

The responses and figures on this page come from the Blue Mountain domain. Its source grid is tree detections from the NAIP canopy height model, completed with GDAM allometry and voxelized with leaf area density.

The whole flow — create, poll, and read the band back — in one script:

Irradiance from a source grid
"""Create a 3D canopy irradiance grid, poll it, and read the band back.
The source is a completed 3D grid with a leaf_area_density band.
"""
from datetime import datetime, timezone
import numpy as np
import fastfuels_sdk.v2 as ff
ff.set_api_key("my-api-key")
# 1. Create the grid and wait for it to finish. Pass the source grid id plus
# its domain (or a Grid object, which carries its own domain).
grid = ff.grids.create_irradiance_grid_from_leaflux(
"your-leaf-area-density-grid-id",
domain="your-domain-id",
date_time=datetime(2025, 7, 1, 19, 0, tzinfo=timezone.utc),
bands=["irradiance.canopy.relative"],
name="Canopy irradiance",
)
grid.wait() # polls until completed or failed
# 2. Read the 3D band into one (z, y, x) array. to_numpy reassembles the
# sparse chunks.
volume = grid.to_numpy("irradiance.canopy.relative")
# 3. Values are relative irradiance in [0, 1]; NaN outside the canopy.
canopy = volume[np.isfinite(volume)]

To map irradiance on the ground, request only irradiance.surface.relative. Without a terrain grid, the surface is a flat plane and the only shadows are the ones the canopy casts.

POST — surface, flat plane
curl -X 'POST' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/solar/irradiance/leaflux' \
-H 'accept: application/json' \
-H 'api-key: my-api-key' \
-H 'Content-Type: application/json' \
-d '{
"source_lad_grid_id": "your-leaf-area-density-grid-id",
"bands": ["irradiance.surface.relative"],
"date_time": "2025-07-01T19:00:00Z",
"name": "Surface irradiance (flat)"
}'

Record the id as your-irradiance-grid-id and poll it to completed. The completed grid is 2D. Its georeference.shape is (y, x), [442, 654] here, and it exports and reads back as a raster.

GET grid status
curl -X 'GET' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/your-irradiance-grid-id' \
-H 'accept: application/json' \
-H 'api-key: my-api-key'

To drape the surface over terrain, add source_terrain_grid_id. Slope and aspect then shade the ground as well as the canopy.

POST — surface, draped on terrain
curl -X 'POST' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/solar/irradiance/leaflux' \
-H 'accept: application/json' \
-H 'api-key: my-api-key' \
-H 'Content-Type: application/json' \
-d '{
"source_lad_grid_id": "your-leaf-area-density-grid-id",
"source_terrain_grid_id": "your-topography-grid-id",
"bands": ["irradiance.surface.relative"],
"date_time": "2025-07-01T19:00:00Z",
"name": "Surface irradiance (terrain-draped)"
}'
Two maps of the same domain side by side, north up, on one shading scale. Left, the flat plane: open ground across the centre and south-east at one uniform low shading, and a dense speckle of crown shadows across the west, the south-west, and a band in the north-east. Right, draped on terrain: the same speckle of crown shadows, with the open ground now varying in broad diagonal bands that follow the slopes. Two maps of the same domain side by side, north up, on one shading scale. Left, the flat plane: open ground across the centre and south-east at one uniform low shading, and a dense speckle of crown shadows across the west, the south-west, and a band in the north-east. Right, draped on terrain: the same speckle of crown shadows, with the open ground now varying in broad diagonal bands that follow the slopes.

Shading, as 1 − irradiance.surface.relative, on Blue Mountain at 13:00 local (19:00Z), from the same source grid. On the flat plane, open ground, 65% of the cells, has a relative irradiance of 0.905, and only the canopy shadows vary. Draped on terrain, the open ground varies with slope and aspect, up to 1 on slopes facing the sun.

To get a value for every canopy voxel, request irradiance.canopy.relative. The grid is 3D.

POST — canopy volume
curl -X 'POST' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/solar/irradiance/leaflux' \
-H 'accept: application/json' \
-H 'api-key: my-api-key' \
-H 'Content-Type: application/json' \
-d '{
"source_lad_grid_id": "your-leaf-area-density-grid-id",
"bands": ["irradiance.canopy.relative"],
"date_time": "2025-07-01T19:00:00Z",
"name": "Canopy irradiance (midday)"
}'

The completed grid has its source’s crs, transform, and shape, [33, 442, 654] here: 33 layers of 1 m over a 442 × 654 grid of 2 m cells. Voxels that hold canopy, 386,336 of them here, get a value in [0, 1]. Voxels outside the crowns are empty.

To get both bands from one job, list both. The grid is 3D: the canopy band fills the voxels and the surface band sits on the ground plane (z=0), each an indexed band on the same lattice.

POST — both bands
curl -X 'POST' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/solar/irradiance/leaflux' \
-H 'accept: application/json' \
-H 'api-key: my-api-key' \
-H 'Content-Type: application/json' \
-d '{
"name": "Midday irradiance",
"description": "Relative canopy and surface irradiance.",
"tags": ["solar", "irradiance"],
"source_lad_grid_id": "your-leaf-area-density-grid-id",
"source_terrain_grid_id": "your-topography-grid-id",
"bands": ["irradiance.canopy.relative", "irradiance.surface.relative"],
"date_time": "2025-07-01T19:00:00Z",
"extinction_coefficient": 0.5
}'

Two inputs change the result of every request above.

date_time is a UTC instant. It sets the sun’s azimuth and elevation, and so the direction light travels through the canopy and where shadows fall. Blue Mountain is UTC−6 in summer, so 2025-07-01T14:00:00Z is 08:00 local, with the sun low in the east, and 2025-07-01T19:00:00Z is 13:00 local.

A morning sun angle
curl -X 'POST' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/solar/irradiance/leaflux' \
-H 'accept: application/json' \
-H 'api-key: my-api-key' \
-H 'Content-Type: application/json' \
-d '{
"source_lad_grid_id": "your-leaf-area-density-grid-id",
"bands": ["irradiance.canopy.relative"],
"date_time": "2025-07-01T14:00:00Z",
"name": "Canopy irradiance (morning)"
}'
Two vertical cross-sections stacked, height against distance east, over the same band of canopy. Individual crowns stand as columns of voxels. In the top panel, at 08:00, most of each crown below its top few metres is heavily shaded. In the bottom panel, at 13:00, the same crowns are lightly shaded further down. Two vertical cross-sections stacked, height against distance east, over the same band of canopy. Individual crowns stand as columns of voxels. In the top panel, at 08:00, most of each crown below its top few metres is heavily shaded. In the bottom panel, at 13:00, the same crowns are lightly shaded further down.

Shading, as 1 − irradiance.canopy.relative, in a 6 m north–south band of the Blue Mountain canopy from 100 to 500 m east of the domain’s west edge, at 08:00 and 13:00 local. The lower 08:00 sun leaves more of each crown in shade.

extinction_coefficient — how fast light is absorbed

Section titled “extinction_coefficient — how fast light is absorbed”

extinction_coefficient defaults to 0.5. A larger value lowers irradiance faster with depth into the canopy.

A larger extinction coefficient
curl -X 'POST' \
'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/grids/solar/irradiance/leaflux' \
-H 'accept: application/json' \
-H 'api-key: my-api-key' \
-H 'Content-Type: application/json' \
-d '{
"source_lad_grid_id": "your-leaf-area-density-grid-id",
"bands": ["irradiance.canopy.relative"],
"date_time": "2025-07-01T19:00:00Z",
"extinction_coefficient": 1.5,
"name": "Canopy irradiance (dense extinction)"
}'
Two line charts sharing a vertical axis of depth below the canopy top, from 0 to 20 m, increasing downward, and a horizontal axis of mean relative irradiance from 0 to 1. Left: the 13:00 curve lies to the right of the 08:00 curve at every depth. Both fall steeply over the top 10 m and change little below. Right: the 1.5 curve falls faster than the 0.5 curve and lies to its left at every depth. Two line charts sharing a vertical axis of depth below the canopy top, from 0 to 20 m, increasing downward, and a horizontal axis of mean relative irradiance from 0 to 1. Left: the 13:00 curve lies to the right of the 08:00 curve at every depth. Both fall steeply over the top 10 m and change little below. Right: the 1.5 curve falls faster than the 0.5 curve and lies to its left at every depth.

Mean relative irradiance against depth below each column’s canopy top, over every canopy voxel on Blue Mountain. At the crown tops, the mean is 0.88 at 13:00 local and 0.68 at 08:00. 5 m below the tops, it is 0.51 with the default extinction_coefficient of 0.5 and 0.24 with 1.5.

Read an irradiance grid as any other grid, with grid.to_numpy(band) or grid.to_xarray(), as in Fetch and stream grid data. The values are relative fractions in [0, 1].

  • The surface band is a dense 2D (y, x) raster with a value in every ground cell. grid.to_numpy("irradiance.surface.relative") returns it.
  • The canopy band is a 3D (z, y, x) array with one value per canopy voxel and NaN elsewhere. grid.to_numpy("irradiance.canopy.relative") requests its chunks in the sparse encoding and reassembles them, as in the full script above.
  • Source grid isn’t 3D or lacks leaf_area_density. Voxelize the inventory with leaf_area_density in bands. A canopy grid built without that band, or a 2D grid, is rejected with 422.
  • Terrain grid without elevation, or on a different lattice. source_terrain_grid_id must name a 2D grid with an elevation band on the source grid’s CRS, origin, cell size, and shape. A 3DEP grid built with only slope and aspect is rejected. Request elevation and align the grid to the source grid, or resample it, before draping.
  • Source grid still pending. Poll the source canopy grid to completed before this request. A source grid in any other state is rejected with 422.
  • Treating the values as an energy flux. They are relative fractions in [0, 1], a share of open-sky irradiance, and carry no unit. Scale by an incoming-radiation value yourself if you need W/m**2.
  • Reusing a grid after changing the source. source.source_lad_grid_checksum records the source grid’s checksum when the irradiance grid was created. If it no longer matches the source grid’s current checksum, rebuild the irradiance grid.
  • Hitting your quota. A LeafLux request past your grid quota returns 429. Delete grids you no longer need, or request a higher quota.