Template for scientists learning how AI can harmonize environmental datasets. See TASKS.md for a plain-English description of the harmonization pipeline.
Read examples/colorado_fire_risk/colorado_harmonization.py before writing
a new workflow. Follow the same pattern: construct DatasetSpec objects,
build an ExampleWorkflow, call run_harmonization_example().
- Validate URLs —
python scripts/check_urls.py <url1> <url2> .... Stop if any fail. - Search the data catalog when the user asks by topic —
python scripts/find_dataset.py <keyword>. - Get region bounds —
python scripts/region_extent.py state Colorado. Always setclip_boundary(e.g.clip_boundary="state:Colorado"). - Write a Python script in
workflows/<project_name>/using the bootstrap header below. - Set
output_dir=Path(__file__).parent / "output". - Run with nohup — create the output directory first, then run:
Poll
mkdir -p workflows/<name>/output nohup python workflows/<name>/<script>.py > workflows/<name>/output/run.log 2>&1 &
.status(first at 2 min, then every 3 min). Wait for completion before re-running.
- Append to
PROMPT_ACTION_LOG.md— date, user's exact prompt, model name, actions taken. - Create
docs/workflows/<project_name>.md— follow the format indocs/workflows/utah_fire_risk.md. - Add new datasets to
data_catalog.yml— only if URLs pass health check. - Visualization filename must be exactly
harmonized_visualization.png.
src/ Core harmonization library (read-only)
scripts/ Helper scripts (URL check, catalog search, region lookup)
examples/colorado_fire_risk/ Reference example (read-only)
workflows/<project_name>/ Each user analysis gets its own folder
<script>.py
output/ Generated outputs
docs/ Website source (mkdocs)
For US states, counties, or places, get coordinates from the lookup tool:
python scripts/region_extent.py state Colorado
python scripts/region_extent.py county Larimer Colorado --crs EPSG:5070
python scripts/region_extent.py place Boulder COPass --crs when target CRS ≠ EPSG:4326. Always set clip_boundary on ExampleWorkflow.
For non-US regions: ask the user for a boundary file or bounding box.
Every workflow script must include this before importing from src/:
import sys
from pathlib import Path
_repo_root = next(p for p in Path(__file__).resolve().parents
if (p / "src" / "geospatial_harmonizer.py").exists())
sys.path.insert(0, str(_repo_root))
from src.geospatial_harmonizer import (
DatasetSpec,
ExampleWorkflow,
run_harmonization_example,
)- Rasters:
harmonized_<name>.tif - Vectors:
harmonized_<name>.geojson - Static visualization:
harmonized_visualization.png(exact filename) - Interactive map:
harmonized_visualization.html - All outputs in
workflows/<project_name>/output/
- Download fails → stop and tell the user which URL failed.
- URL returns HTML → tell the user it's a portal link and ask for a direct download URL.
- No valid geospatial files found → stop and ask the user.
- Categorical data (land cover, fuel models) →
resampling_method="nearest" - Continuous data (temperature, precipitation) →
resampling_method="bilinear" - If unsure → ask the user
GDAL CLI tools (gdalwarp, ogr2ogr, gdal_translate) are available for
format conversion or preprocessing before running the harmonizer.