feat: add AU and US geometry + region modules#19
Open
sperrot wants to merge 1 commit into
Open
Conversation
Contributes two new country modules following the existing ATPolygonIndex interface (resolve/union_all/n_pdo_polygons contract from _lib/at/geometry.py): AU (scripts/_lib/au/) - geometry.py: AUPolygonIndex — loads Wine Australia GI Register (SHP or KML, raw/au/wine_australia/gi.shp). Slug-based name matching covers the full Zone / Region / Subregion hierarchy (~65 GIs, 2024). geom_source = wine-australia-gi. No Figshare fallback (Betard 2022 is EU-only); missing GIs resolve to stub-no-geometry. - region.py: derive_state() — returns 2-letter AU state code (NSW, VIC, QLD, SA, WA, TAS, ACT, NT). Multi-state GIs return the first listed state (Wine Australia convention). US (scripts/_lib/us/) - geometry.py: USPolygonIndex — loads UCDavis Library AVA corpus (CC0, https://github.com/UCDavisLibrary/ava, raw/us/ucavis/avas.geojson). Keyed by ava_id (e.g. alexander_valley_19841123). Covers all 245 TTB-registered AVAs. geom_source = ucavis-ava. - region.py: derive_state() — returns 2-letter US state code. Multi-state AVAs (state = OR|WA) return the first token (TTB petition convention). Both __init__.py files are empty (mirrors _lib/at/__init__.py). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
Thanks for this contribution! I'll build on top of this for to add the terroir extraction, allowed grapes etc. (if available - US regulation is a bit more relaxed if I remember correctly). Timeline: coming weeks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Contributes two new country modules for Australia and the United States, following the
ATPolygonIndexinterface already established inscripts/_lib/at/geometry.py(sameresolve/union_all/n_pdo_polygonscontract, same(geometry, geom_source, stats)return type).AU —
scripts/_lib/au/geometry.py—AUPolygonIndexbacked by the Wine Australia GI Register (official, publicly available SHP/KML). Slug-based name matching handles minor spelling variants across the Zone / Region / Subregion hierarchy (~65 GIs).geom_source = "wine-australia-gi". No Bétard-2022 fallback (EU-only); unresolved GIs return"stub-no-geometry".Expected path:
raw/au/wine_australia/gi.shpSource: https://www.wineaustralia.com/labelling/register-of-protected-gis
region.py—derive_state()— returns a 2-letter AU state code (NSW, VIC, QLD, SA, WA, TAS, ACT, NT). Multi-state GIs return the first listed state (Wine Australia convention).US —
scripts/_lib/us/geometry.py—USPolygonIndexbacked by the UCDavis Library AVA corpus (CC0). Keyed byava_id(e.g.alexander_valley_19841123). Covers all 245 TTB-registered AVAs.geom_source = "ucavis-ava".Expected path:
raw/us/ucavis/avas.geojsonSource: https://github.com/UCDavisLibrary/ava (CC0)
region.py—derive_state()— returns a 2-letter US state code. Multi-state AVAs (e.g.state = "OR|WA") return the first token (TTB petition convention).Scope
Geometry and region derivation only — no wiki pipeline content, no eAmbrosia integration (AU/US are outside the EU GI register). These modules slot into stage 04 in the same way as existing EU country modules.
Test plan
AUPolygonIndex("raw/au/wine_australia/gi.shp").resolve("Barossa Valley")returns a polygon withgeom_source == "wine-australia-gi"AUPolygonIndex.resolve("unknown-gi")returns(None, "stub-no-geometry", {"matched": 0, "unmatched": 0})USPolygonIndex("raw/us/ucavis/avas.geojson").resolve("alexander_valley_19841123")returns a polygonderive_state({"state": "OR|WA"})returns"OR"(US);derive_state({"state": "NSW|VIC"})returns"NSW"(AU)find_state_in_text("appellation in South Australia")returns"SA"— longest-match prevents false positive on NSW🤖 Generated with Claude Code