Add the park units and ranges that trails with no track are placed in, place the tracked trails in them, and keep the history heading when apply rewrites place tables

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-20 11:21:34 -07:00
1 parent 8c14aee802
commit 2186ca8216
13 files changed
+362 -19

No files matched your search

+33 -6
View File
@@ -109,6 +109,18 @@ slug = "capitol-reef-national-park"
basis = "track"
km = 9.0
[[place]]
kind = "park"
slug = "colorado-national-monument"
basis = "track"
km = 24.7
[[place]]
kind = "park"
slug = "glen-canyon-national-recreation-area"
basis = "track"
km = 26.3
[[place]]
kind = "range"
slug = "allegheny-mountains"
@@ -121,12 +133,6 @@ slug = "california-coast-ranges"
basis = "track"
km = 119.0
[[place]]
kind = "range"
slug = "colorado-plateau"
basis = "track"
km = 590.9
[[place]]
kind = "range"
slug = "front-range"
@@ -139,6 +145,12 @@ slug = "gore-range"
basis = "track"
km = 39.4
[[place]]
kind = "range"
slug = "la-sal-mountains"
basis = "track"
km = 113.1
[[place]]
kind = "range"
slug = "mosquito-range"
@@ -157,6 +169,12 @@ slug = "sierra-nevada"
basis = "track"
km = 261.1
[[place]]
kind = "range"
slug = "toiyabe-range"
basis = "track"
km = 45.9
[[place]]
kind = "wilderness"
slug = "alta-toquima-wilderness"
@@ -284,3 +302,12 @@ basis = "Measured from the trail's main track against the GMBA Mountain Inventor
basis_url = "https://www.earthenv.org/mountains"
asked_by = "the dataset's own check"
outcome = "applied"
[[history]]
date = "2026-11-20"
change = "The trail was placed in Colorado National Monument, Glen Canyon National Recreation Area, La Sal Mountains, Toiyabe Range and no longer placed in Colorado Plateau."
fields = ["place"]
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-11-20), the National Park Service, Land Resources Division outlines (nps, 2026-11-20), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-11-20) by tools/place_trails.py."
basis_url = "https://www.earthenv.org/mountains"
asked_by = "the dataset's own check"
outcome = "applied"
+15
View File
@@ -100,6 +100,12 @@ title = "Appalachian National Scenic Trail"
publisher = "LongTrailsWiki"
url = "https://www.longtrailswiki.net/wiki/Appalachian_National_Scenic_Trail"
[[place]]
kind = "park"
slug = "blue-ridge-parkway"
basis = "track"
km = 17.3
[[place]]
kind = "park"
slug = "great-smoky-mountains-national-park"
@@ -331,3 +337,12 @@ basis = "Measured from the trail's main track against the GMBA Mountain Inventor
basis_url = "https://www.earthenv.org/mountains"
asked_by = "the dataset's own check"
outcome = "applied"
[[history]]
date = "2026-11-20"
change = "The trail was placed in Blue Ridge Parkway."
fields = ["place"]
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-11-20), the National Park Service, Land Resources Division outlines (nps, 2026-11-20), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-11-20) by tools/place_trails.py."
basis_url = "https://www.earthenv.org/mountains"
asked_by = "the dataset's own check"
outcome = "applied"
+15
View File
@@ -94,6 +94,12 @@ slug = "klamath-mountains"
basis = "track"
km = 41.6
[[place]]
kind = "range"
slug = "peninsular-ranges"
basis = "track"
km = 6.8
[[place]]
kind = "range"
slug = "transverse-ranges"
@@ -176,3 +182,12 @@ basis = "Measured from the trail's main track against the GMBA Mountain Inventor
basis_url = "https://www.earthenv.org/mountains"
asked_by = "the dataset's own check"
outcome = "applied"
[[history]]
date = "2026-11-20"
change = "The trail was placed in Peninsular Ranges."
fields = ["place"]
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-11-20), the National Park Service, Land Resources Division outlines (nps, 2026-11-20), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-11-20) by tools/place_trails.py."
basis_url = "https://www.earthenv.org/mountains"
asked_by = "the dataset's own check"
outcome = "applied"
+15
View File
@@ -89,6 +89,12 @@ title = "Mountains to Sea Trail"
publisher = "LongTrailsWiki"
url = "https://www.longtrailswiki.net/wiki/Mountains_to_Sea_Trail"
[[place]]
kind = "park"
slug = "blue-ridge-parkway"
basis = "track"
km = 275.2
[[place]]
kind = "park"
slug = "great-smoky-mountains-national-park"
@@ -158,3 +164,12 @@ basis = "Measured from the trail's main track against the GMBA Mountain Inventor
basis_url = "https://www.earthenv.org/mountains"
asked_by = "the dataset's own check"
outcome = "applied"
[[history]]
date = "2026-11-20"
change = "The trail was placed in Blue Ridge Parkway."
fields = ["place"]
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-11-20), the National Park Service, Land Resources Division outlines (nps, 2026-11-20), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-11-20) by tools/place_trails.py."
basis_url = "https://www.earthenv.org/mountains"
asked_by = "the dataset's own check"
outcome = "applied"
+15
View File
@@ -146,6 +146,12 @@ slug = "palisades"
basis = "track"
km = 29.7
[[place]]
kind = "range"
slug = "peninsular-ranges"
basis = "track"
km = 312.7
[[place]]
kind = "range"
slug = "transverse-ranges"
@@ -441,3 +447,12 @@ basis = "Measured from the trail's main track against the GMBA Mountain Inventor
basis_url = "https://www.earthenv.org/mountains"
asked_by = "the dataset's own check"
outcome = "applied"
[[history]]
date = "2026-11-20"
change = "The trail was placed in Peninsular Ranges."
fields = ["place"]
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-11-20), the National Park Service, Land Resources Division outlines (nps, 2026-11-20), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-11-20) by tools/place_trails.py."
basis_url = "https://www.earthenv.org/mountains"
asked_by = "the dataset's own check"
outcome = "applied"
+81
View File
@@ -34,6 +34,16 @@ source_id = "350038000"
source_version = "2026-11-20"
box = [-80.74, 44.62, -80.68, 44.65]
[[place]]
slug = "blue-ridge-parkway"
kind = "park"
name = "Blue Ridge Parkway"
where = ["NC", "VA"]
source = "nps"
source_id = "BLRI"
source_version = "2026-11-20"
box = [-83.3, 35.28, -78.86, 38.03]
[[place]]
slug = "boyne-valley-provincial-park"
kind = "park"
@@ -114,6 +124,16 @@ source_id = "480001148"
source_version = "2026-11-20"
box = [-114.7, 49.16, -113.97, 49.63]
[[place]]
slug = "colorado-national-monument"
kind = "park"
name = "Colorado National Monument"
where = ["CO"]
source = "nps"
source_id = "COLM"
source_version = "2026-11-20"
box = [-108.76, 38.98, -108.62, 39.12]
[[place]]
slug = "crater-lake-national-park"
kind = "park"
@@ -214,6 +234,16 @@ source_id = "GLAC"
source_version = "2026-11-20"
box = [-114.47, 48.23, -113.24, 49.0]
[[place]]
slug = "glen-canyon-national-recreation-area"
kind = "park"
name = "Glen Canyon National Recreation Area"
where = ["AZ", "UT"]
source = "nps"
source_id = "GLCA"
source_version = "2026-11-20"
box = [-111.66, 36.82, -109.95, 38.5]
[[place]]
slug = "grand-canyon-national-park"
kind = "park"
@@ -334,6 +364,16 @@ source_id = "590000345"
source_version = "2026-11-20"
box = [-120.71, 53.79, -120.0, 54.3]
[[place]]
slug = "katahdin-woods-and-waters-national-monument"
kind = "park"
name = "Katahdin Woods and Waters National Monument"
where = ["ME"]
source = "nps"
source_id = "KAWW"
source_version = "2026-11-20"
box = [-68.82, 45.83, -68.56, 46.13]
[[place]]
slug = "killarney-provincial-park"
kind = "park"
@@ -987,6 +1027,17 @@ source_id = "12443"
source_version = "2026-11-20"
box = [-124.43, 40.5, -122.27, 42.72]
[[place]]
slug = "la-sal-mountains"
kind = "range"
name = "La Sal Mountains"
where = ["CO", "UT"]
within = ["colorado-plateau"]
source = "gmba-v2"
source_id = "11567"
source_version = "2026-11-20"
box = [-109.61, 38.05, -108.8, 38.81]
[[place]]
slug = "longfellow-mountains"
kind = "range"
@@ -1072,6 +1123,16 @@ source_id = ["17222", "19588"]
source_version = "2026-11-20"
box = [-118.6, 36.95, -118.25, 37.34]
[[place]]
slug = "peninsular-ranges"
kind = "range"
name = "Peninsular Ranges"
where = ["CA"]
source = "gmba-v2"
source_id = "12446"
source_version = "2026-11-20"
box = [-117.81, 22.95, -109.46, 33.92]
[[place]]
slug = "rocky-mountains"
kind = "range"
@@ -1135,6 +1196,16 @@ source_id = "11991"
source_version = "2026-11-20"
box = [-111.1, 43.49, -110.69, 44.15]
[[place]]
slug = "toiyabe-range"
kind = "range"
name = "Toiyabe Range"
where = ["NV"]
source = "gmba-v2"
source_id = "12004"
source_version = "2026-11-20"
box = [-117.55, 38.47, -116.75, 39.98]
[[place]]
slug = "transverse-ranges"
kind = "range"
@@ -1156,6 +1227,16 @@ source_id = "12026"
source_version = "2026-11-20"
box = [-111.48, 40.12, -108.32, 41.81]
[[place]]
slug = "vancouver-island-ranges"
kind = "range"
name = "Vancouver Island Ranges"
where = ["BC"]
source = "gmba-v2"
source_id = "12033"
source_version = "2026-11-20"
box = [-128.33, 48.38, -123.44, 50.86]
[[place]]
slug = "white-mountains"
kind = "range"
@@ -97,6 +97,12 @@ slug = "gaspesie-national-park"
basis = "track"
km = 102.4
[[place]]
kind = "park"
slug = "katahdin-woods-and-waters-national-monument"
basis = "track"
km = 46.7
[[place]]
kind = "park"
slug = "mount-carleton-provincial-park"
@@ -163,3 +169,12 @@ basis = "Measured from the trail's main track against the Environment and Climat
basis_url = "https://open.canada.ca/data/dataset/6c343726-1e92-451a-876a-76e17d398a1c"
asked_by = "the dataset's own check"
outcome = "applied"
[[history]]
date = "2026-11-20"
change = "The trail was placed in Katahdin Woods and Waters National Monument."
fields = ["place"]
basis = "Measured from the trail's main track against the Environment and Climate Change Canada, CPCAD outlines (cpcad, 2026-11-20), the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-11-20), the National Park Service, Land Resources Division outlines (nps, 2026-11-20) by tools/place_trails.py."
basis_url = "https://open.canada.ca/data/dataset/6c343726-1e92-451a-876a-76e17d398a1c"
asked_by = "the dataset's own check"
outcome = "applied"
+15
View File
@@ -71,6 +71,12 @@ url = "https://www.nvtrailfinder.com/trails/trail/toiyabe-crest-national-recreat
publisher = "Nevada Division of Outdoor Recreation (Nevada Trail Finder)"
facts = ["season", "months"]
[[place]]
kind = "range"
slug = "toiyabe-range"
basis = "track"
km = 101.2
[[place]]
kind = "wilderness"
slug = "arc-dome-wilderness"
@@ -131,3 +137,12 @@ basis = "Measured from the trail's main track against the Wilderness Connect, Un
basis_url = "https://wilderness.net/visit-wilderness/gis-gps.php"
asked_by = "the dataset's own check"
outcome = "applied"
[[history]]
date = "2026-11-20"
change = "The trail was placed in Toiyabe Range."
fields = ["place"]
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-11-20), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-11-20) by tools/place_trails.py."
basis_url = "https://www.earthenv.org/mountains"
asked_by = "the dataset's own check"
outcome = "applied"
+57
View File
@@ -342,3 +342,60 @@ name = "Sequoia and Kings Canyon National Parks"
source_id = "GLAC"
slug = "glacier"
name = "Glacier National Park"
# National Park Service units that are not national parks. A park page means any National
# Park Service unit (monuments, recreation areas, parkways, preserves, historic sites), so a
# unit goes in when a trail is placed in it by hand. Each is measured against every track too.
# The unit's own name from the boundary service is kept, except where noted.
[[park]]
source_id = "BLRI"
[[park]]
source_id = "COLM"
[[park]]
source_id = "FOBO"
# The boundary service lists the preserve and the park of this unit under one code, named for
# the preserve; the unit is Gates of the Arctic National Park and Preserve.
[[park]]
source_id = "GAAR"
slug = "gates-of-the-arctic-national-park-and-preserve"
name = "Gates of the Arctic National Park and Preserve"
[[park]]
source_id = "GLCA"
[[park]]
source_id = "KAWW"
[[park]]
source_id = "LAKE"
# Ranges not named by the owner that 3 or more trails reach once the trails with no track are
# counted with the tracked ones (2026-11-20): tracked trails measured, the others placed by a
# cited page.
[[range]]
gmba_id = "12004"
slug = "toiyabe-range"
name = "Toiyabe Range"
where = ["NV"]
[[range]]
gmba_id = "11567"
slug = "la-sal-mountains"
name = "La Sal Mountains"
within = ["colorado-plateau"]
where = ["CO", "UT"]
[[range]]
gmba_id = "12446"
slug = "peninsular-ranges"
name = "Peninsular Ranges"
where = ["CA"]
[[range]]
gmba_id = "12033"
slug = "vancouver-island-ranges"
name = "Vancouver Island Ranges"
where = ["BC"]
+47 -13
View File
@@ -901,6 +901,11 @@ def _remove_place_blocks(doc, rec):
while lo > 0 and doc.lines[lo - 1].strip() == "":
lo -= 1
break
# the span runs to the next header; the blank lines and comment lines at its end
# belong to what follows (the history's heading comment), so they stay
while end > header + 1 and (doc.lines[end - 1].strip() == ""
or doc.lines[end - 1].lstrip().startswith("#")):
end -= 1
del doc.lines[lo:end]
@@ -1059,27 +1064,56 @@ def apply(proposal_path, root, today, exclude=frozenset()):
def add_stated(root, rid, kind, slug, source_url, quote, today):
"""Place a trackless trail from a cited source, with its history entry."""
if not str(source_url).startswith(("https://", "http://")):
raise ValueError("stated needs an http(s) source address")
if not str(quote).strip():
raise ValueError("stated needs the sentence that puts the trail in the place")
add_stated_many(root, rid, [{"kind": kind, "slug": slug, "source": source_url, "quote": quote}], today)
def add_stated_many(root, rid, items, today):
"""Place a trackless trail in every place of `items` from cited sources, with one
history entry for the record. An item is {kind, slug, source, quote}; with
"summary": True the quote is the sentence of the record's own summary and the source is
the page the summary was taken from, and the history says so."""
if not items:
raise ValueError("stated needs at least one place")
for it in items:
if not str(it["source"]).startswith(("https://", "http://")):
raise ValueError("stated needs an http(s) source address")
if not str(it["quote"]).strip():
raise ValueError("stated needs the sentence that puts the trail in the place")
tdir = os.path.join(root, rid)
if line_file_of(tdir):
raise ValueError(f"{rid} has a track; stated is only for a trail with no track")
registry = {(e.get("kind"), e.get("slug")): e for e in registry_entries(root)}
entry = registry.get((kind, slug))
if entry is None:
raise ValueError(f"{kind}/{slug} is not in places.toml; add its registry entry first")
doc, path = _doc_of(root, rid)
rec = doc.data()
if any((p.get("kind"), p.get("slug")) == (kind, slug) for p in rec.get("place") or []):
raise ValueError(f"{rid} already names {kind}/{slug}")
doc.append_block("place", {"kind": kind, "slug": slug, "basis": "stated", "source": source_url})
seen = {(p.get("kind"), p.get("slug")) for p in rec.get("place") or []}
names = []
for it in items:
key = (it["kind"], it["slug"])
if key not in registry:
raise ValueError(f"{it['kind']}/{it['slug']} is not in places.toml; add its registry entry first")
if key in seen:
raise ValueError(f"{rid} already names {it['kind']}/{it['slug']}")
seen.add(key)
names.append(registry[key].get("name") or it["slug"])
for it in items:
doc.append_block("place", {"kind": it["kind"], "slug": it["slug"], "basis": "stated",
"source": it["source"]})
_set_top(doc, rec, "places_checked", today)
name = entry.get("name") or slug
if len(names) == 1:
where = names[0]
else:
where = ", ".join(names[:-1]) + " and " + names[-1]
groups = {}
for it, name in zip(items, names):
groups.setdefault((it["source"], it["quote"], bool(it.get("summary"))), []).append(name)
parts = []
for (source, quote, summary), who in groups.items():
lead = "The trail's own summary says" if summary else "The page says"
tail = f" ({', '.join(who)})" if len(groups) > 1 else ""
parts.append(f'{lead}: "{quote}"{tail}')
doc.append_history(_history_entry(
today, f"The trail was placed in {name} from a published page, as it has no track to measure.",
f'The page says: "{quote}"', source_url))
today, f"The trail was placed in {where} from published pages, as it has no track to measure.",
" ".join(parts), items[0]["source"]))
_save(doc, path)
+24
View File
@@ -521,6 +521,30 @@ class ApplyTest(unittest.TestCase):
self.assertEqual(rec["places_checked"], "2026-11-20")
self.assertEqual(rec["history"][-1]["fields"], ["place"])
def test_a_second_apply_of_the_same_proposal_leaves_every_record_byte_identical(self):
P.apply(self.pjson, self.root, "2026-11-20")
before = {t: open(self.trail_toml(t)).read() for t in ("aa", "bb", "cc")}
self.assertEqual(P.apply(self.pjson, self.root, "2026-11-20"), [])
for t, text in before.items():
self.assertEqual(open(self.trail_toml(t)).read(), text)
def test_stated_many_writes_every_place_with_one_history_entry(self):
P.apply(self.pjson, self.root, "2026-11-20")
reg = P.registry_entries(self.root)
reg.append({"slug": "beta-range", "kind": "range", "name": "Beta Range", "where": ["WY"],
"source": "gmba-v2", "source_id": "1", "source_version": "x", "box": [0, 0, 1, 1]})
P.write_registry(self.root, reg)
before = len(read_toml(self.trail_toml("zz"))["history"])
P.add_stated_many(self.root, "zz", [
{"kind": "park", "slug": "alpha-park", "source": "https://example.org/t", "quote": "Q one."},
{"kind": "range", "slug": "beta-range", "source": "https://example.org/t", "quote": "Q one."},
], "2026-11-20")
rec = read_toml(self.trail_toml("zz"))
self.assertEqual([p["slug"] for p in rec["place"]], ["alpha-park", "beta-range"])
self.assertEqual(len(rec["history"]), before + 1)
self.assertIn("Alpha Park and Beta Range", rec["history"][-1]["change"])
self.assertEqual(rec["history"][-1]["fields"], ["place"])
def test_stamp_none_sets_places_checked_with_no_place_tables_and_no_history(self):
P.stamp_none(self.root, "zz", "2026-11-20")
rec = read_toml(self.trail_toml("zz"))
+15
View File
@@ -108,6 +108,12 @@ slug = "strathcona-park"
basis = "track"
km = 24.8
[[place]]
kind = "range"
slug = "vancouver-island-ranges"
basis = "track"
km = 512.8
# History of this record, oldest first. Add to it; never rewrite it.
# See docs/schema.md, section [[history]].
@@ -144,3 +150,12 @@ basis = "Measured from the trail's main track against the Environment and Climat
basis_url = "https://open.canada.ca/data/dataset/6c343726-1e92-451a-876a-76e17d398a1c"
asked_by = "the dataset's own check"
outcome = "applied"
[[history]]
date = "2026-11-20"
change = "The trail was placed in Vancouver Island Ranges."
fields = ["place"]
basis = "Measured from the trail's main track against the Environment and Climate Change Canada, CPCAD outlines (cpcad, 2026-11-20), the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-11-20) by tools/place_trails.py."
basis_url = "https://open.canada.ca/data/dataset/6c343726-1e92-451a-876a-76e17d398a1c"
asked_by = "the dataset's own check"
outcome = "applied"
+15
View File
@@ -90,6 +90,12 @@ slug = "pacific-rim-national-park-reserve"
basis = "track"
km = 57.1
[[place]]
kind = "range"
slug = "vancouver-island-ranges"
basis = "track"
km = 23.4
# History of this record, oldest first. Add to it; never rewrite it.
# See docs/schema.md, section [[history]].
@@ -144,3 +150,12 @@ basis = "Measured from the trail's main track against the Environment and Climat
basis_url = "https://open.canada.ca/data/dataset/6c343726-1e92-451a-876a-76e17d398a1c"
asked_by = "the dataset's own check"
outcome = "applied"
[[history]]
date = "2026-11-20"
change = "The trail was placed in Vancouver Island Ranges."
fields = ["place"]
basis = "Measured from the trail's main track against the Environment and Climate Change Canada, CPCAD outlines (cpcad, 2026-11-20), the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-11-20) by tools/place_trails.py."
basis_url = "https://open.canada.ca/data/dataset/6c343726-1e92-451a-876a-76e17d398a1c"
asked_by = "the dataset's own check"
outcome = "applied"