Answer architecture round 3: fence's docstring says a locality needs entries in both child maps, and zcta_localities says what it maps to

This commit is contained in:
2026-10-09 12:26:00 +02:00
committed by Lillem4n
parent c032cb779c
commit 32e01565b4
3 changed files with 14 additions and 14 deletions
+2 -2
View File
@@ -126,7 +126,7 @@ def localities(cache, min_population, counties):
def zcta_localities(cache, localities):
"""Each ZCTA whose largest part inside an incorporated place lies in a shipped place."""
"""Each ZCTA whose largest part inside an incorporated place lies in a shipped place, mapped to that place."""
parts = {}
for r in csv.DictReader(io.StringIO(text(source.fetch(ZCTA_PLACE, cache, "zcta-place.txt"))), delimiter="|"):
if r["GEOID_ZCTA5_20"] and r["GEOID_PLACE_20"] and not r["NAMELSAD_PLACE_20"].endswith(" CDP"):
@@ -176,7 +176,7 @@ def main():
if addresses[zcta]:
zctas[locality].append(zcta)
kept, dropped = geo.fence(regions, counties, places, named, zctas)
geo.log_dropped(dropped["locality"], "no street or postal code")
geo.log_dropped_localities(dropped["locality"])
print(f"counties without a place, dropped: {len(dropped['municipality'])}; states: {sorted(dropped['region'])}", file=sys.stderr)
places = kept["locality"]