Aerial damage assessment: Eaton Fire#
The January 2025 Eaton Fire destroyed thousands of structures in Altadena, California, and the RAPID Facility flew the area the following month. This example grades the buildings in one patch of that orthomosaic on the Cal Fire / CHS damage scale, using a local Gemma 4 model, entirely offline.
Source: examples/fire_damage_from_aerial.py.
from pathlib import Path
from rapidtools import (
AerialImageryExtractor,
AssetAnalyzer,
PhysicalAssetCollection,
Pipeline,
download_dataset,
)
from rapidtools.models import load
# 1. Sample data from the rAPIdtools registry.
raster_path, footprint_path, prompt_path = download_dataset(
['eaton_patch2', 'altadena_sample_buildings', 'aerial_chs_prompts']
)
# 2. The building inventory.
buildings = PhysicalAssetCollection.from_geojson(footprint_path)
# 3. Crop each footprint and outline it for the model.
extractor = AerialImageryExtractor(
dataset=raster_path,
save_directory=Path('eaton_fire_aerial_feb25/overlaid_imagery'),
overlay_asset_outline=True,
outline_shape='rotated_bbox',
outline_buffer='2 m',
outline_width='1%',
image_prefix='eaton_trinity_25',
keep_multiple_copies=True,
)
# 4. Grade every crop with the prompt file (a JSON schema for CHS levels).
analyzer = AssetAnalyzer(
load('gemma4', model_id='google/gemma-4-E2B-it'),
prompt=prompt_path,
batch_size=8,
)
# 5. Run and export.
graded = Pipeline([extractor, analyzer]).run(buildings)
graded = graded.filter_empty()
graded.to_geojson(
'eaton_footprints_CHS_with_gemma4.geojson', ignore_properties=['image_assets']
)
Notes#
keep_multiple_copies=Trueadds a counter to the file name when two assets share a centroid, which happens with stacked or duplicated footprints.The prompt file asks for a JSON object with a
chs_levelkey, so the grade ends up ingemma4_chs_level. Open the GeoJSON in QGIS and color it by that attribute to see the damage map.To grade with a hosted model, replace
load('gemma4', ...)withload('gemini', api_key=...). Nothing else changes, andexamples/fire_damage_from_aerial_gemini.pydoes exactly that.examples/chs_from_shapefile_example.pyruns the same pipeline on a Shapefile inventory and writes a Shapefile back withto_shapefile().