Inspiration
Terrarium was born out of Lahore’s extreme climate stress. Every winter the city records some of the worst PM2.5 levels globally, and in the pre monsoon season surface temperatures exceed 50 °C. The burden is uneven, as neighborhoods with tree canopy fare better while others absorb the difference.
City officers face concrete choices such as which corridor to green, which road to restrict, and which intervention to fund first. Existing tools are either too broad like national climate scenarios or too vague like literature averages. Terrarium was inspired by this gap, the need for a street level interactive simulator that answers “If we plant trees here, what changes here?” with numbers, and says plainly when the answer is “you cannot.”
What it does
Terrarium lets users design interventions on a real 20 km × 20 km tile of Lahore with 201 × 202 cells at 100 m resolution, totaling 40,602 cells.
Features include: Drawing polygons or typing plans in plain English such as “plant 5,000 trees here” or “ban combustion vehicles.”
Outputs:
Δ mid morning land surface temperature per 100 m cell. Δ locally generated PM2.5 when emissions are removed. Equity of exposure showing cooling in person degrees by population decile. Council briefs with findings, summaries, uncertainties, printable to PDF. Spatial explanations with per region tables showing where cooling landed. Intervention search agent that proposes candidates from a 2 km lattice, scores them through real cores, and reports greedy baselines beside results. Follow up conversation where users can ask “why did it cool that much?” and receive answers drawn directly from the brief. Refusal logic that rejects infeasible plans with clear arithmetic instead of silently shrinking them. The refusal itself is treated as the product.
How we built it
Terrarium is structured in three strict layers:
State Cube Unified datasets including Landsat, Sentinel 2, Copernicus DEM, ESA WorldCover, ERA5, WorldPop, and OpenStreetMap. Resampled onto one aligned xarray Zarr cube at 100 m resolution, catalogued in DuckDB. Resampling methods respect variable meaning: nearest for land cover, bilinear for intensive measurements, sum for population.
Physics Cores Thermal core: LightGBM emulator trained against Landsat ST_B10, predicting mid morning LST. Air core: FFT based dispersion over OSM derived emissions, interactive at tile scale. Equity core: joins delta fields to population and returns person degrees by decile.
Intelligence Layer FastAPI backend loads cube and booster once, validates inputs, and ships rasters efficiently. React, MapLibre, and deck.gl frontend for visualization. Optional free tier LLM parses natural language and rewords results but never invents or sources numbers.
Challenges we ran into
Negative R² masking performance. Hindcast initially showed failure, but correcting offsets revealed MAE 0.91–1.24 °C and positive spatial skill. Timescale mismatch. Gaussian plume worked for hourly windows but failed for seasonal averages. Isotropic seasonal kernel fixed this. Winter versus summer regimes. Winter pollution is 6–9 times higher due to lower mixing heights and lighter winds. Feature dominance. Meteorology carried 91.5 percent of model gain, acting as a window identifier rather than a driver. Language model guardrails. Needed multi sided checks to prevent deletion or distortion of numbers. Zero budget constraint. Features like photo upload, voice capture, and cost estimation were cut to preserve free deployment. Silent data failures. Validation redesigned to catch incomplete cubes and mismatched booster features at startup.
Accomplishments that we're proud of
Hindcast MAE of 0.91–1.24 °C with positive spatial R² after correction. Air core rebuilt until it beat the null model on 53 independent monitors. Refusal logic aligned with physics, ensuring consistency between plan language and model outputs. Equity treated as a first class output, absent rather than zeroed when unavailable. Search agent reports its own greedy baseline as the bar to beat. Transparent outputs where every number is labeled for what it does not prove. Zero marginal cost end to end, with all data sources and libraries free.
What we learned
Negative R² can conceal a working model when the error is an offset. Temporal features are weaker than spatial ones, with unseen years costing 1.9–5.3 °C. Physics must match the timescale of the data. Winter pollution is a fundamentally different regime, not a scaled summer. Guardrails on language models must be multi sided and applied to outputs. Deterministic fallbacks are only honest when they are the product, not placeholders.
What's next for Terrarium
Strengthen temporal features to reduce unseen year error. Validate summer air with more monitors and boundary layer treatments. Calibrate emission factors against Lahore’s own fleet. Add a second tile to prove global scalability at zero marginal cost. Deepen equity metrics to drive prioritization directly. Continue validation against new satellite passes and ground monitors, reporting results transparently.
Built With
- deck.gl
- duckdb
- fastapi
- google-gemini
- groq
- landsat
- langchain
- lightgbm
- maplibre-gel
- microsoft-planetry-computer
- numpy
- openaq
- openstreetmap
- pandas
- pydantic
- python
- react
- scipy
- sentinel-2
- typescript
- uv
- vite
- worldpop
- xarray
- zarr
Log in or sign up for Devpost to join the conversation.