Document restructuring and the beginnings of Filter 2 changes
Split the pipeline documentation by purpose so each fact has one home: - docs/pipeline-plan.md keeps the plan, checklist, tracker, and guardrails - docs/decisions.md holds open decisions and the dated decision log - docs/reviews/ holds findings and tasks: one file per filter, plus 00-cross-filter.md for findings that span filters - scripts/common/README.md holds the shared-helper rules (formerly Phase 2) - filter-calculations.md now describes calculations only Filed findings 12-22 from a consistency audit of the app, docs, and scripts. Filter 1 (Köppen-Geiger): use "Köppen" with the umlaut in all prose, labels, docstrings, help text, and checker messages (finding 21), and correct the base build's "majority" docstring (finding 22). Filter 2 (annual avg temperature): record the adopted definition in filter-calculations.md §2: equally weighted 1991-2020 monthly normals, per WMO-No. 1203 and NOAA's 2020 methodology; area-weighted county means; blank unless all 12 months exist. Code changes for this filter are still pending. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Build the county Koppen-Geiger metric file from area-weighted class shares.
|
||||
"""Build the county Köppen-Geiger metric file from area-weighted class shares.
|
||||
|
||||
Writes data/metrics/koppen.csv. A county is predominantly its top class when
|
||||
that class covers at least 50% of the county's land and leads the runner-up by
|
||||
@@ -58,7 +58,7 @@ def rank_class_shares(weights: Dict[int, float], code_map: Dict[int, str]) -> Li
|
||||
return []
|
||||
unknown = sorted(code for code in weights if code not in code_map)
|
||||
if unknown:
|
||||
raise ValueError(f"Raster codes {unknown} are not in the Koppen legend.")
|
||||
raise ValueError(f"Raster codes {unknown} are not in the Köppen legend.")
|
||||
ranked = sorted(weights.items(), key=lambda item: (-item[1], item[0]))
|
||||
return [(code_map[code], weight / total) for code, weight in ranked]
|
||||
|
||||
@@ -117,7 +117,7 @@ def build_koppen_records(
|
||||
|
||||
|
||||
def write_records(records: List[dict], out_file: Path) -> None:
|
||||
"""Write the Koppen metric rows."""
|
||||
"""Write the Köppen metric rows."""
|
||||
out_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
with out_file.open("w", encoding="utf-8", newline="") as csv_file:
|
||||
writer = csv.DictWriter(csv_file, fieldnames=FIELDS)
|
||||
@@ -127,9 +127,9 @@ def write_records(records: List[dict], out_file: Path) -> None:
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
"""Define and parse command-line options for this builder."""
|
||||
parser = argparse.ArgumentParser(description="Build the county Koppen-Geiger metric file.")
|
||||
parser = argparse.ArgumentParser(description="Build the county Köppen-Geiger metric file.")
|
||||
parser.add_argument("--counties-geojson", type=Path, default=DEFAULT_COUNTIES_GEOJSON, help="County polygon GeoJSON path.")
|
||||
parser.add_argument("--koppen-raster", type=Path, default=DEFAULT_KOPPEN_RASTER, help="Koppen-Geiger raster TIFF path.")
|
||||
parser.add_argument("--koppen-raster", type=Path, default=DEFAULT_KOPPEN_RASTER, help="Köppen-Geiger raster TIFF path.")
|
||||
parser.add_argument("--koppen-legend", type=Path, default=DEFAULT_KOPPEN_LEGEND, help="legend.txt mapping raster codes.")
|
||||
parser.add_argument("--subcells", type=int, default=DEFAULT_SUBCELLS, help="Sub-cells per raster cell edge.")
|
||||
parser.add_argument("--out", type=Path, default=DEFAULT_OUT, help="Output metric CSV path.")
|
||||
|
||||
Reference in New Issue
Block a user