Complete Köppen-Geiger filter review with Mixed climate class

Classify each county by area-weighted Köppen class shares: a county is
predominantly its top class when that class covers at least 50% of its
land and leads the runner-up by at least 5 percentage points; otherwise
it is Mixed (133 of 3,143 counties in the 50 states and DC).

- Add build_county_koppen_metric.py (writes data/metrics/koppen.csv) and
  apply_koppen_metric_to_climate_data.py (writes koppenZone plus
  koppenPrimaryClass/koppenSecondaryClass for Mixed counties).
- Move shared helpers into scripts/common/ (county loading, Köppen
  legend, area-weighted raster shares); fix the 180th-meridian raster
  window for Aleutians West.
- Add check_climate_data.py to validate the app CSV.
- Draw Mixed counties in app.js as diagonal stripes of their top two
  classes, fixed to the ground and following the map at every zoom, with
  a crossfade only when the stripe size changes. Filtering a class also
  matches Mixed counties where it is primary or secondary.
- Document the rule, display, and pipeline plan in docs/ and update the
  README and data-source notes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 02:54:25 -04:00
co-authored by Claude Opus 5
parent 92fbbfb2e9
commit 4d2b3e3d44
20 changed files with 6400 additions and 3450 deletions
@@ -18,10 +18,10 @@ from build_county_climate_data import (
MONTH_NAMES,
_as_monthly_climatology,
_extract_grid_2d,
_load_counties,
_select_data_var,
_zonal_mean,
)
from common.counties import load_counties
REPO_ROOT = Path(__file__).resolve().parents[1]
DEFAULT_CLIMATE_DATA = REPO_ROOT / "data" / "climate-data.csv"
@@ -61,7 +61,7 @@ def build_precip_month_lookup(
climatology_end_year: int,
) -> dict[str, tuple[str, str]]:
"""Calculate wettest and driest precipitation month for each county."""
counties = _load_counties(counties_geojson)
counties = load_counties(counties_geojson)
monthly_prcp = xr.open_dataset(monthly_prcp_nc, decode_times=True)
try:
prcp_var = _select_data_var(monthly_prcp, "mlyprcp_norm")