diff --git a/.github/workflows/season-check.yml b/.github/workflows/season-check.yml new file mode 100644 index 0000000..6ca4190 --- /dev/null +++ b/.github/workflows/season-check.yml @@ -0,0 +1,20 @@ +name: Season check + +# Once a month, check offline that every estimated season is still on the track or location it +# was estimated for. Nothing is downloaded: the climate normals are a fixed published dataset. A +# failure lists the estimates whose inputs have changed; see docs/audit.md. +on: + schedule: + - cron: "17 6 1 * *" + workflow_dispatch: + +jobs: + check: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - run: python3 tools/estimate_season.py check diff --git a/CHANGELOG.md b/CHANGELOG.md index 761df8a..1c97720 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 2026-11-20 - Every trail now has a season + +- All 223 trails now have a season. 148 come from a page that states one. 3 were set by judgement from pages of at least two publishers that disagree, none of them the trail's own, its association's or its route author's. The other 72 are estimates, because no page states a season for them; three of those (the Finger Lakes Trail, the Ice Age Trail and the Ozark Trail) have a page that contradicts itself or two pages from one publisher that differ, and the note says so. +- An estimate never reads as a fact. A trail's page shows it as "About April to October", with a short note: no page states a season, it was estimated from the climate at the trail's elevation and from similar trails, what sets the season there, how confident the estimate is, and that these are the usual months, not a closure. Lists and tables mark an estimate, and it is left out of the data that search engines read. The 3 set from pages that disagree read the same way, and their note says the pages differ. +- How an estimate is made: a reviewer is given the trail's location and elevation, its monthly climate (CHELSA, public domain, with NOAA elevation), a climate model's own estimate, and the ten most similar trails whose season a page states, and sets the months. The climate model alone matched 67.6 percent of the known seasons within a month at each end, under the 75 percent the owner asked for, so it is one input and not the answer. +- How it was tested: the same reviewers estimated the 148 trails whose season a page does state, from packets with that season hidden. Two measures, given together: 114 of 148 (77 percent) had their first and last months within a month of the page's; 105 (71 percent) also had no wrong gap in the middle. By confidence, first and last months: 48 of 52 where they were highly confident, 55 of 76 at medium confidence, and 11 of 20 at low; with no wrong gap as well: 48 of 52, 46 of 76 and 11 of 20. The 75 percent bar was set on the first and last months, and the method clears it there but not on the stricter measure. The owner decided the estimates ship with both figures stated. The reference page gives these figures, read from a data file. +- The "By month" lists now include every trail and mark the estimated seasons, and the note that only some trails have a season is gone. The month filter has a box to leave estimated seasons out. +- An estimate is replaced when a page that states a season is found. The monthly audit searches again for every one, and a monthly check, which works offline and downloads nothing, flags any estimate whose trail's track or location has changed since the season was set. +- For contributors: `hike.season_basis` may now be `estimate`, with a `hike.season_method` that ends "Confidence: high.", "Confidence: medium." or "Confidence: low." and one source that cites the climate data; a season is required on every trail, and the validator refuses an estimate that cites an ordinary page. The packet builder and the blind scorer are `tools/season_judge.py`, the reviewers' instruction is `docs/season-judging.md`, and the audit steps are in `docs/audit.md`. + +## 2026-11-20 - The search box and filters on every page, and ways in to the places + +- Every page that lists trails now has the search box and the filters, however few trails it holds. Until now the 48 state and province pages with fewer than ten trails, the small lists and each route author's page showed the rows alone. The filters shown are the ones that have something to offer: a page with two trails offers the choices those two trails differ on, with the number that each choice leaves, and a page with one trail has the search box alone. Nothing is offered that would show no trails. +- The Places page now begins with one row of links, visible at every screen size: States and provinces, Parks, Mountain ranges and Wilderness areas, each with its number of pages. They go to the parts of the page that were at the bottom, below sixty states and provinces. +- The home page ends with a line under the rows and the map: Browse by park, by mountain range or by wilderness area, each going to its part of the Places page. The first screen is as it was. + ## 2026-11-20 - A Google tag to count visits - Every page now loads a Google tag, so that visits can be counted with Google Analytics. The About page no longer says the site has no tracking or analytics. diff --git a/NOTICE.md b/NOTICE.md index 71ed40b..f550a51 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -27,3 +27,7 @@ The files `elevation.json` in the trail directories are computed from each trail - ArcticDEM terrain data DEM(s) were created from DigitalGlobe, Inc., imagery and funded under National Science Foundation awards 1043681, 1559691, and 1542736. - Global ETOPO1 terrain data U.S. National Oceanic and Atmospheric Administration. - Terrain Tiles was accessed from https://registry.opendata.aws/terrain-tiles. + +## Climate + +A season marked as estimated is worked out from monthly climate at the trail's elevation. The climate values are monthly means of daily maximum temperature for 1981 to 2010 from CHELSA V2.1 (https://www.chelsa-climate.org/datasets/chelsa_climatologies, released under CC0 1.0), read by `tools/season_climate.py`, with grid elevation from NOAA's ETOPO 2022 relief model (unrestricted version, https://www.ncei.noaa.gov/products/etopo-global-relief-model). CHELSA asks for this citation: Karger, D. N., Conrad, O., Boehner, J., Kawohl, T., Kreft, H., Soria-Auza, R. W., Zimmermann, N. E., Linder, H. P., Kessler, M. (2017). Climatologies at high resolution for the earth's land surface areas. Scientific Data 4, 170122, https://doi.org/10.1038/sdata.2017.122. Only the estimated seasons derive from it. Each estimated record names it in its sources, and the estimates themselves say they are estimates wherever they are shown. diff --git a/across-utah-route/trail.toml b/across-utah-route/trail.toml index 86c3ec6..b6429f8 100644 --- a/across-utah-route/trail.toml +++ b/across-utah-route/trail.toml @@ -76,7 +76,11 @@ shape = "point-to-point" terrain = ["desert", "canyon", "alpine"] travel = "some-cross-country" caution = "The author says no part is technical, but the route involves exposure, deep pools, long dry stretches and a Colorado River crossing that needs a packraft or a ride from a river party." -checked = "2026-11-15" +checked = "2026-11-20" +season = "April to June and September to October" +months = [4, 5, 6, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Desert heat in summer and snow in the Henrys, La Sals and Bryce country in winter leave spring and fall. Confidence: medium." [[hike.source]] url = "http://www.acrossutah.com/wordpress/the_route/" @@ -125,6 +129,11 @@ slug = "pine-valley-mountain-wilderness" basis = "stated" source = "http://www.acrossutah.com/wordpress/the_route/" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -153,3 +162,12 @@ basis = "The page says: \"and then follows the Grandview Trail through the pines basis_url = "http://www.acrossutah.com/wordpress/the_route/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: April to June and September to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/alpine-trail-7/trail.toml b/alpine-trail-7/trail.toml index 501bce7..4f0b134 100644 --- a/alpine-trail-7/trail.toml +++ b/alpine-trail-7/trail.toml @@ -58,7 +58,11 @@ shape = "point-to-point" terrain = ["alpine", "lakes"] travel = "trail" caution = "The Forest Service lists the trail as open to hiking, biking and motorcycle trail riding, with motorized use in specific stretches only and Jewel Basin Special Area rules to check." -checked = "2026-11-16" +checked = "2026-11-20" +season = "July to September" +months = [7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Heavy winter snow at 7,000 feet in the Swan Range melts out by mid-July, and snow returns in October. Confidence: high." [[hike.source]] url = "https://web.archive.org/web/20201201005308/https://www.fs.usda.gov/recarea/flathead/recreation/recarea/?recid=66288&actid=51" @@ -81,6 +85,11 @@ slug = "rocky-mountains" basis = "track" km = 87.5 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -119,3 +128,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 = "A season was estimated: July to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/avon/trail.toml b/avon/trail.toml index e3430dd..fea28e5 100644 --- a/avon/trail.toml +++ b/avon/trail.toml @@ -59,7 +59,11 @@ end = "Conestogo, Ontario" shape = "point-to-point" terrain = ["farmland"] travel = "trail" -checked = "2026-11-13" +checked = "2026-11-20" +season = "April to October" +months = [4, 5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Winter snow and early-spring mud on Ontario farmland end with the thaw, and the walk runs until late fall. Confidence: medium." [[hike.source]] url = "https://avontrail.ca/" @@ -71,6 +75,11 @@ url = "https://avontrail.ca/about/" publisher = "Avon Trail Association" facts = ["summary", "start", "end", "terrain", "travel"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -99,3 +108,12 @@ basis = "OpenStreetMap relation 3442182 gives no roles, and the Avon Trail Assoc basis_url = "https://www.openstreetmap.org/relation/3442182" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: April to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/batona/trail.toml b/batona/trail.toml index 6172bd6..a66448a 100644 --- a/batona/trail.toml +++ b/batona/trail.toml @@ -59,7 +59,11 @@ shape = "point-to-point" high_point = "Apple Pie Hill" terrain = ["forest"] travel = "trail" -checked = "2026-11-13" +checked = "2026-11-20" +season = "October to April" +months = [1, 2, 3, 4, 10, 11, 12] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Flat Pine Barrens walking has no high ground to wait out, so the cool months are the season; summer brings heat, ticks and biting flies. Confidence: medium." [[hike.source]] url = "https://batona.wildapricot.org/" @@ -81,6 +85,11 @@ url = "https://dep.nj.gov/wp-content/uploads/parksandforests/docs/sps/batona-map publisher = "New Jersey State Park Service" facts = ["high_point"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -100,3 +109,12 @@ basis = "The pages named in the logo note were searched, and none shows an emble basis_url = "https://batona.wildapricot.org/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: October to April." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/bay-circuit/trail.toml b/bay-circuit/trail.toml index 6579d8b..1dbae0c 100644 --- a/bay-circuit/trail.toml +++ b/bay-circuit/trail.toml @@ -61,7 +61,11 @@ end = "Kingston Bay, Massachusetts" shape = "point-to-point" travel = "trail" unfinished = "More than 230 miles are dedicated across 37 cooperating towns, and the final gaps are still being closed." -checked = "2026-11-13" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Humid, buggy summers and icy winters in low-lying eastern Massachusetts leave spring and fall, though it can be walked all year. Confidence: medium." [[hike.source]] url = "https://www.baycircuit.org/" @@ -73,6 +77,11 @@ url = "https://www.baycircuit.org/about/" publisher = "Bay Circuit Alliance" facts = ["summary", "start", "end", "shape", "unfinished"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Bay Circuit Trail" publisher = "LongTrailsWiki" @@ -106,3 +115,12 @@ basis = "OpenStreetMap relation 12779888 gives no roles. The Bay Circuit Allianc basis_url = "https://www.baycircuit.org/maps-guides/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/bayou-state-trail/trail.toml b/bayou-state-trail/trail.toml index df20393..adb81d9 100644 --- a/bayou-state-trail/trail.toml +++ b/bayou-state-trail/trail.toml @@ -55,7 +55,11 @@ end_lonlat = [-91.207, 29.699] shape = "point-to-point" terrain = ["forest"] caution = "The association does not say how much of the route is trail and how much is road or town walking. Its trails page, read on 2026-11-19, lists the Hwy 182 bridge over the Atchafalaya River, between Berwick and Morgan City, as closed, and gives a temporary southern end at the Berwick Branch Library, 3512 5th Street. The notice carries no date of its own and gives the reopening as fall 2026. Check with the association before going." -checked = "2026-11-16" +checked = "2026-11-20" +season = "November to April" +months = [1, 2, 3, 4, 11, 12] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Summer heat, humidity, mosquitoes and storms in Louisiana push hiking into the cool, dry winter and early spring. Confidence: medium." [[hike.source]] url = "https://www.bayoustatetrail.com/" @@ -87,6 +91,11 @@ url = "https://services1.arcgis.com/fXHQyq63u0UsTeSM/ArcGIS/rest/services/LDWF_B publisher = "Louisiana Department of Wildlife and Fisheries, boat launches layer: Ivan Lake Boat Ramp on Ivan Lake Road, inside Ivan Lake Recreation Area; the point is the wildlife agency's boat ramp, not a surveyed trailhead" facts = ["start_lonlat"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -133,3 +142,12 @@ basis = "The association's trails page, read on 2026-11-19, still lists the brid basis_url = "https://www.bayoustatetrail.com/trails" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: November to April." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/boundary-trail-mount-st-helens/trail.toml b/boundary-trail-mount-st-helens/trail.toml index 9117c16..515ee96 100644 --- a/boundary-trail-mount-st-helens/trail.toml +++ b/boundary-trail-mount-st-helens/trail.toml @@ -60,7 +60,11 @@ terrain = ["alpine", "forest"] travel = "trail" permit = "Some trailheads that access this trail require a valid Recreation Pass, per the Forest Service." caution = "East of Bear Meadows the trail is open to motorcycles as well as hikers, horses and bicycles. The Forest Service states the trail is closed to ATV use." -checked = "2026-11-16" +checked = "2026-11-20" +season = "July to October" +months = [7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Cascade ridges around 5,000 feet hold snow until July, and heavy rain starts in late October. Confidence: high." [[hike.source]] url = "https://www.fs.usda.gov/r06/giffordpinchot/recreation/trails/trail-1-boundary" @@ -73,6 +77,11 @@ slug = "cascade-range" basis = "track" km = 91.7 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -102,3 +111,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 = "A season was estimated: July to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/boundary-trail-pasayten/trail.toml b/boundary-trail-pasayten/trail.toml index 8974dc2..a2f2bd0 100644 --- a/boundary-trail-pasayten/trail.toml +++ b/boundary-trail-pasayten/trail.toml @@ -59,7 +59,11 @@ shape = "point-to-point" terrain = ["alpine", "forest"] travel = "trail" permit = "A free self-issuing wilderness permit, filled out at the trailhead, is required to enter the Pasayten Wilderness." -checked = "2026-11-16" +checked = "2026-11-20" +season = "July to September" +months = [7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The Pasayten high country at 5,500 to 7,500 feet is under snow until early July, and snow returns in October. Confidence: high." [[hike.source]] url = "https://www.fs.usda.gov/r06/okanogan-wenatchee/recreation/trails/boundary-trail" @@ -88,6 +92,11 @@ slug = "pasayten-wilderness" basis = "track" km = 112.3 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -117,3 +126,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 = "A season was estimated: July to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/bristol-hills-trail/trail.toml b/bristol-hills-trail/trail.toml index 535bcd3..730bae1 100644 --- a/bristol-hills-trail/trail.toml +++ b/bristol-hills-trail/trail.toml @@ -57,7 +57,11 @@ end = "Main Finger Lakes Trail near Mitchellsville, New York" shape = "point-to-point" terrain = ["forest"] travel = "trail" -checked = "2026-11-16" +checked = "2026-11-20" +season = "May to October" +months = [5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Snow and mud make winter and early spring uncommon for walking, so the comfortable months run from late spring through fall. Confidence: medium." [[hike.source]] url = "https://cnyhiking.com/The%20Bristol%20Hills%20Trail.htm" @@ -69,6 +73,11 @@ url = "https://www.gofingerlakes.org/locations/gannett-hill-park/" publisher = "Go Finger Lakes (Finger Lakes Land Trust)" facts = ["summary", "start"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -89,3 +98,12 @@ basis = "The pages named in the logo note were searched, and none offers usable basis_url = "https://fingerlakestrail.org/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: May to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/brooks-range-traverse/trail.toml b/brooks-range-traverse/trail.toml index 7382de5..269043b 100644 --- a/brooks-range-traverse/trail.toml +++ b/brooks-range-traverse/trail.toml @@ -72,7 +72,11 @@ shape = "point-to-point" terrain = ["tundra", "alpine"] travel = "mostly-cross-country" caution = "There is almost no trail, and much of the route is floated by packraft, so it needs packrafting skills as well as route-finding." -checked = "2026-11-13" +checked = "2026-11-20" +season = "June to September" +months = [6, 7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Arctic tundra is frozen and snowbound most of the year, with river breakup in early June and freeze-up and snow by mid-September. Confidence: low." [[hike.source]] url = "https://thingstolucat.com/brooks-range-traverse/" @@ -123,6 +127,11 @@ slug = "mollie-beattie-wilderness" basis = "stated" source = "https://thingstolucat.com/arctic-refuge-traverse/" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -160,3 +169,12 @@ basis = "The page says: \"In June of 2017 Sarah and I hiked and floated through basis_url = "https://thingstolucat.com/arctic-refuge-traverse/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: June to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/bruce-trail/trail.toml b/bruce-trail/trail.toml index ddca686..fb39871 100644 --- a/bruce-trail/trail.toml +++ b/bruce-trail/trail.toml @@ -58,7 +58,11 @@ shape = "point-to-point" days = [30, 30] travel = "trail" permit = "Parking reservations are needed at some parks, and camping is allowed only at designated sites, often by reservation." -checked = "2026-11-13" +checked = "2026-11-20" +season = "April to October" +months = [4, 5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The Niagara Escarpment is icy and muddy through winter and early spring, so end-to-end hikes run from the April thaw to the end of October. Confidence: medium." [[hike.source]] url = "https://brucetrail.org/explore-the-trail/" @@ -70,6 +74,11 @@ url = "https://www.brucetrail.org/" publisher = "Bruce Trail Conservancy" facts = ["summary"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Bruce Trail" publisher = "LongTrailsWiki" @@ -193,3 +202,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 = "A season was estimated: April to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/california-coastal/trail.toml b/california-coastal/trail.toml index 102b593..c1af982 100644 --- a/california-coastal/trail.toml +++ b/california-coastal/trail.toml @@ -59,7 +59,11 @@ official_url = "https://www.coastal.ca.gov/coastal-trail/" terrain = ["coast"] travel = "trail-and-road" unfinished = "The state counts about 875 miles, about 70 percent, as built along a coastline of about 1,230 miles, and there is no official through route. A hiker reports having walked the whole coast from end to end, in eight section hikes, by connecting the built parts with their own choices." -checked = "2026-11-13" +checked = "2026-11-20" +season = "All year" +months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The coast is walked all year, and the southern sections are at their best in winter. Confidence: low." [[hike.source]] url = "https://www.coastal.ca.gov/coastal-trail/" @@ -71,6 +75,11 @@ url = "https://github.com/swaits/longhikes/issues/1" publisher = "A hiker, on the dataset's public issue tracker" facts = ["unfinished"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "California Coastal Trail (incomplete)" publisher = "LongTrailsWiki" @@ -191,3 +200,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 = "A season was estimated: All year." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/cohos/trail.toml b/cohos/trail.toml index 0b12305..893ebe7 100644 --- a/cohos/trail.toml +++ b/cohos/trail.toml @@ -60,7 +60,11 @@ high_point_m = 1917 days = [9, 14] terrain = ["forest", "alpine"] travel = "trail" -checked = "2026-11-13" +checked = "2026-11-20" +season = "June to October" +months = [6, 7, 8, 9, 10] +season_basis = "sources" +season_method = "The pages differ: The Trek gives May to October and Backpacking Routes gives June to November. It was set by judgement from both and from the climate, since snow and mud last into late May and cold sets in by late October. Confidence: medium." [[hike.source]] url = "https://www.cohostrail.org/" @@ -77,6 +81,16 @@ url = "https://www.cohostrail.org/the-trail/" publisher = "Cohos Trail Association" facts = ["summary", "high_point", "terrain", "travel"] +[[hike.source]] +url = "https://thetrek.co/10-trails-can-find-long-distance-solitude-2020/" +publisher = "The Trek" +facts = ["season", "months"] + +[[hike.source]] +url = "https://backpackingroutes.com/cohos-trail/" +publisher = "Backpacking Routes" +facts = ["season", "months"] + [[link]] title = "Cohos Trail" publisher = "LongTrailsWiki" @@ -122,3 +136,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 = "A season was set from pages that differ: June to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "The pages that state a season differ and none is the managing body, association or route author, so it was set by judgement from all of them and the climate estimate." +basis_url = "https://thetrek.co/10-trails-can-find-long-distance-solitude-2020/" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/conestoga-trail/trail.toml b/conestoga-trail/trail.toml index f7002cd..8c2686d 100644 --- a/conestoga-trail/trail.toml +++ b/conestoga-trail/trail.toml @@ -56,13 +56,22 @@ official_url = "https://www.lancasterhikingclub.com/copy-of-conestoga-trail" shape = "point-to-point" terrain = ["forest", "farmland"] travel = "trail-and-road" -checked = "2026-11-14" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The low Lancaster County hills are hot, humid and tick-ridden in summer, so the cool months suit it best. Confidence: medium." [[hike.source]] url = "https://www.lancasterhikingclub.com/copy-of-conestoga-trail" publisher = "Lancaster Hiking Club" facts = ["official_url", "summary", "shape", "terrain", "travel"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -82,3 +91,12 @@ basis = "The pages named in the logo note were searched, and none shows an emble basis_url = "https://www.lancasterhikingclub.com/copy-of-conestoga-trail" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/conservation-trail/trail.toml b/conservation-trail/trail.toml index 75c03b8..32eb552 100644 --- a/conservation-trail/trail.toml +++ b/conservation-trail/trail.toml @@ -53,7 +53,11 @@ end = "Rainbow Bridge, Niagara Falls, New York" end_lonlat = [-79.067, 43.09] shape = "point-to-point" terrain = ["forest"] -checked = "2026-11-14" +checked = "2026-11-20" +season = "April to October" +months = [4, 5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Low-elevation western New York is snowy in winter and muddy in March, and can be walked from April until late fall. Confidence: medium." [[hike.source]] url = "https://sites.google.com/view/foothillstrailclub/about-the-trail" @@ -76,6 +80,11 @@ slug = "allegheny-plateau" basis = "stated" source = "https://sites.google.com/view/foothillstrailclub/about-the-trail" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -113,3 +122,12 @@ basis = "The trail's own description says: \"The Conservation Trail runs north t basis_url = "https://sites.google.com/view/foothillstrailclub/about-the-trail" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: April to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/cranberry-lake-50/trail.toml b/cranberry-lake-50/trail.toml index b700bee..024ddec 100644 --- a/cranberry-lake-50/trail.toml +++ b/cranberry-lake-50/trail.toml @@ -60,7 +60,11 @@ days = [3, 5] terrain = ["forest", "lakes"] travel = "trail" permit = "A free permit from the local forest ranger is needed for groups of ten or more, or to camp more than three days in one spot." -checked = "2026-11-19" +checked = "2026-11-20" +season = "June to October" +months = [6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Adirondack snow and mud in spring and black flies into June leave summer and fall as the usual window. Confidence: medium." [[hike.source]] url = "https://cranberrylake50.org/" @@ -77,6 +81,11 @@ url = "https://cranberrylake50.org/plan-your-trip/" publisher = "Cranberry Lake 50 (Five Ponds Partners)" facts = ["permit"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Cranberry Lake 50" publisher = "LongTrailsWiki" @@ -125,3 +134,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 = "A season was estimated: June to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/cross-vermont/trail.toml b/cross-vermont/trail.toml index d603f39..d350e9f 100644 --- a/cross-vermont/trail.toml +++ b/cross-vermont/trail.toml @@ -60,7 +60,11 @@ end = "Lake Champlain, Vermont" shape = "point-to-point" travel = "trail-and-road" unfinished = "About half the route is still on busier roads, and the association is building more trail toward a complete off-road route across the state." -checked = "2026-11-13" +checked = "2026-11-20" +season = "May to October" +months = [5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. A low-elevation route of mostly rail trail and quiet roads, where winter snow and mud season bracket a long snow-free stretch from May to October. Confidence: medium." [[hike.source]] url = "https://crossvermont.org/our_trail/index.php" @@ -73,6 +77,11 @@ slug = "green-mountains" basis = "track" km = 29.1 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -101,3 +110,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 = "A season was estimated: May to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/deseret-hiking-route/trail.toml b/deseret-hiking-route/trail.toml index 0a92286..feab49e 100644 --- a/deseret-hiking-route/trail.toml +++ b/deseret-hiking-route/trail.toml @@ -73,7 +73,11 @@ shape = "point-to-point" terrain = ["canyon", "alpine"] travel = "trail-and-road" caution = "The route is unmarked and not designated by any state or federal agency, and about 40 percent of it is dirt road." -checked = "2026-11-13" +checked = "2026-11-20" +season = "May to October" +months = [5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. A route from southern Utah desert canyons to the Pioneer Mountains of Idaho needs the high ground clear of snow and the south not scorching. Confidence: low." [[hike.source]] url = "http://www.lbhikes.com/p/a-complete-guide-to-deseret-hiking-route.html" @@ -103,6 +107,11 @@ slug = "wasatch-range" basis = "stated" source = "http://www.lbhikes.com/p/a-complete-guide-to-deseret-hiking-route.html" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -149,3 +158,12 @@ basis = "The page says: \"Highlights: Paria Canyon Bryce Canyon National Park Wa basis_url = "http://www.lbhikes.com/p/a-complete-guide-to-deseret-hiking-route.html" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: May to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/desert-trail/trail.toml b/desert-trail/trail.toml index 480d9d1..b52d903 100644 --- a/desert-trail/trail.toml +++ b/desert-trail/trail.toml @@ -72,7 +72,11 @@ shape = "point-to-point" terrain = ["desert"] travel = "mostly-cross-country" caution = "There is no trail on the ground and no signs: the route is found by map and experience, and water sources are few and far between." -checked = "2026-11-13" +checked = "2026-11-20" +season = "April to June and September to October" +months = [4, 5, 6, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Waterless desert is too hot in summer and snowy in winter, so a full walk runs through spring and early fall. Confidence: low." [[hike.source]] url = "https://deserttrail.net" @@ -91,6 +95,11 @@ slug = "joshua-tree-national-park" basis = "stated" source = "https://deserttrail.net/segments/" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -119,3 +128,12 @@ basis = "The page says: \"While the Desert Trail does pass through a few well-vi basis_url = "https://deserttrail.net" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: April to June and September to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/docs/audit.md b/docs/audit.md index 0573b63..25345cb 100644 --- a/docs/audit.md +++ b/docs/audit.md @@ -3,26 +3,32 @@ A written checklist for the owner. It does not repeat the refresh runbook; it points at it. Work down the list in order and stop at the first step that fails. -1. **Refresh the records.** Run `/refresh-trails` (the full run once a quarter, `light` in the - months between). It verifies every record against the pages it cites, re-checks the left-out - list, looks for missing trails and updates tracks and emblems. The runbook is +## Records and places + +1. **Refresh the records.** Run the `/refresh-trails` skill (the full run once a quarter, `light` + in the months between). It verifies every record against the pages it cites, re-checks the + left-out list, looks for missing trails and updates tracks and emblems. The runbook is `.claude/skills/refresh-trails/SKILL.md`; this checklist adds to it and does not replace it. 2. **Check the links.** `python3 tools/refresh.py links` lists every address a record cites that - no longer answers. Fix each one in a record with a history entry. + no longer answers (`--limit 20` is a quick trial). Fix each one in a record with a history + entry. 3. **Validate the data.** `python3 tools/validate.py` must end `OK trails`. It fails a record with no `places_checked`, and one whose track has changed since its places were measured. 4. **Check the history.** `python3 tools/check_history.py --base origin/main` must end `OK history`. A changed fact needs a new history entry. 5. **Run both test suites.** `python3 -m unittest discover tools/tests` and `python3 -m unittest discover -s web/tests` must both pass. -6. **Check the places.** `python3 tools/place_trails.py --check --refresh` downloads every outline again (without `--refresh` it reuses the files already in the cache, which are the ones first downloaded), - measures every track again and prints each difference from the records, one per line: - - a place gained or lost by a trail: re-run `place_trails.py propose`, read the line, and - apply it only when the new outline is right; - - a boundary that moved (a new source version): the owner rules whether the new outline - replaces the old one; - - a place that crossed the 3-trail line: its page appears or goes, so check its links and the - counts that name it. +6. **Check the places.** `.venv-places/bin/python tools/place_trails.py --check --refresh` + downloads every outline again (without `--refresh` it reuses the files already in the cache, + which are the ones first downloaded), measures every track again and prints each difference + from the records, one per line. The venv is made as `tools/place_trails.py --help` says. For + each line: + (a) a place gained or lost by a trail: run `.venv-places/bin/python tools/place_trails.py propose`, + read the line, and apply it only when the new outline is right; + (b) a boundary that moved (a new source version): the owner rules whether the new outline + replaces the old one; + (c) a place that crossed the 3-trail line: its page appears or goes, so check its links and the + counts that name it. The monthly workflow `.github/workflows/places.yml` runs this step by itself and fails with the list; this step is the one you run when it has failed, and before a release. 7. **Review the `stated` placements by hand.** A trail with no track is placed from a page, and no @@ -32,3 +38,14 @@ down the list in order and stop at the first step that fails. entry when a placement changes. 8. **Build the site** with `python3 web/build.py --out _site` and read the places page, one park page, one range page and one wilderness page. + +## Seasons + +Every trail has a season. Where a page states one, the season is that page's. Where none does, the season is an estimate: set by a reviewer from the trail's climate and the seasons of similar trails, with its confidence on the record (`docs/season-judging.md`). Where pages from at least two publishers state different seasons and none is the trail's own, the season is set by judgement from all of them. The aim of this audit is that estimates shrink over time, and that none goes stale unnoticed. + +The blind test behind the estimates has two figures, always read together: 114 of 148 (77 percent) had their first and last months within a month of the page's, and 105 (71 percent) also had no wrong gap in the middle. The 75 percent bar was set on the first measure; the second is below it. The owner decided that the estimates ship with both stated. + +1. Search afresh for a page that states the season of every trail still marked `estimate`. List them with `python3 tools/estimate_season.py estimates`. For each, follow `docs/season-research.md`: the trail's holder or a government page first, then an established hiking reference, a guidebook publisher's page or an association list. When a page states a season, replace the estimate through `tools/refresh.py` (stage a proposal, then `python3 tools/refresh.py collect` and `python3 tools/refresh.py apply`): give the page's season and months, the basis (`primary`, `sources` or `source`), the page as a `[[hike.source]]` naming `season` and `months`, and remove the climate source and `season_method`. A change to the season gets a `[[history]]` entry like any other fact. Then run `python3 tools/season_judge.py inputs --points` so that the record of estimate inputs drops the trail. A trail with no page found stays an estimate, and nothing else about it changes. +2. Check that no estimate has gone stale: `python3 tools/estimate_season.py check`. It works offline and downloads nothing. For every estimate it compares the digest of the trail's current track and location with the one recorded in `tools/season_inputs.json` when the season was set, and lists each trail where they differ or none is recorded. The listing is a flag, not a rewrite. For each trail listed, build its packet (`python3 tools/season_judge.py packets --out /tmp/season-packets`; it writes a packet for every trail and reads the climate, which is a large download the first time and cached after), look at what changed, and either keep the season or set it again by judgement. Then run `python3 tools/season_judge.py inputs --points ` to record the new digest. The climate normals are a fixed published dataset (CHELSA, 1981 to 2010), so they do not change from month to month and are not read again; `python3 tools/season_judge.py inputs ` (with the network) also records the machine estimate and the climate digest at the time, if a person wants them. The check also fails when the blind test of the method (`tools/season_blind_test.json`) is below its bar on the first-and-last-months measure (77 percent when set, against a bar of 75; the stricter figure, 71 percent, which also needs no wrong gap in the middle, is recorded beside it). + +The same check runs on its own on the first of each month (`.github/workflows/season-check.yml`), so a changed estimate is noticed even when the audit is late. The audit is still the step that acts on it. diff --git a/docs/schema.md b/docs/schema.md index c179c70..1f2bdd8 100644 --- a/docs/schema.md +++ b/docs/schema.md @@ -128,7 +128,7 @@ The field and file names keep the word "line" (`line.geojson`, `line_file`, `lin ## `[hike]`: what a hiker asks first -Optional: a record without `[hike]` is valid. The table holds the facts a hiker wants before anything else: where the trail goes, what the country is like, how long it takes, when to go, where its own site is. Every fact is read on a page, and that page is named in `[[hike.source]]`. The first choice is a page of the trail's holder (the agency, the association, or for a route its author) or a government page. Where those say nothing, a fact may be read on an established hiking reference that covers the trail, such as a guide site, a hiking association's list of trails or a guidebook publisher's page; the source entry names that site as the publisher, so a reader can see where the fact came from and weigh it. Apps and pages that anyone can edit (AllTrails, forums, social media, wikis) are not sources. A fact found on no acceptable page is left out, never guessed, except season, which may be estimated and must then say so. Typical time is estimated at page-build time and never stored, while an estimated season is stored on the record. Where sources disagree, the managing body's figure is used. Wording is ours: nothing is copied from a source. +Optional: a record without `[hike]` is valid. The table holds the facts a hiker wants before anything else: where the trail goes, what the country is like, how long it takes, when to go, where its own site is. Every fact is read on a page, and that page is named in `[[hike.source]]`. The first choice is a page of the trail's holder (the agency, the association, or for a route its author) or a government page. Where those say nothing, a fact may be read on an established hiking reference that covers the trail, such as a guide site, a hiking association's list of trails or a guidebook publisher's page; the source entry names that site as the publisher, so a reader can see where the fact came from and weigh it. Apps and pages that anyone can edit (AllTrails, forums, social media, wikis) are not sources. A fact found on no acceptable page is left out, never guessed, except season, which may be estimated and must then say so. Typical time is estimated at page-build time and never stored, while an estimated season is stored on the record. Where sources disagree, the managing body's figure is used; where none of them manages the trail, is its association or is its route author, the season is set by judgement from all the pages and the climate estimate, and `season_method` says so. Wording is ours: nothing is copied from a source. | Field | Type | Meaning | Example | | --- | --- | --- | --- | @@ -140,8 +140,8 @@ Optional: a record without `[hike]` is valid. The table holds the facts a hiker | `days` | array of two integers | The usual time to walk the whole trail in one go, `[fewest, most]`, in days, as a source states it. Weeks count 7 days, months 30. | `[150, 210]` | | `season` | string | The months in which the whole trail is usually walked, as a short phrase. Not the dates a park or hut is open, unless those set the walking season. `season` and `months` come together: one is never given without the other. For an estimated season (`season_basis = "estimate"`) the phrase is built from the months. | `"July to September"` | | `months` | array of integers | The same season as month numbers, 1 to 12, for filtering: every month in which the whole trail, or a usual start, is normally walked. A month counts when about half of it or more is in season. Given whenever `season` is, and never without it. | `[7, 8, 9]` | -| `season_basis` | string | Required whenever `season` is present, and refused without it. Where the season came from, one of: `primary` (the page is published by the body that manages the trail, the trail's own association, or, for a route worked out by a hiker, that route's author); `sources` (no primary page, but two or more pages from different publishers agree on the season); `source` (one page that is not a primary one); `estimate` (no page states a season, so it is worked out from climate). A route author's stated season counts as `primary`. | `"primary"` | -| `season_method` | string | Required with `season_basis = "estimate"`, where it is one sentence naming the method and its inputs: the dataset, the period, the points used and the rule version. Allowed with `sources`, where it says in one sentence how the season was settled when the pages differ. Refused with `primary` and `source`. | `"Estimated from 1991-2020 climate normals at 5 track points (rule version 1)."` | +| `season_basis` | string | Required whenever `season` is present, and refused without it. Where the season came from, one of: `primary` (the page is published by the body that manages the trail, the trail's own association, or, for a route worked out by a hiker, that route's author); `sources` (no primary page, but two or more pages from different publishers agree on the season); `source` (one page that is not a primary one); `estimate` (no page states a season, so it is worked out from climate). A route author's stated season counts as `primary`. An `estimate` has no page that states a season: its one `[[hike.source]]` names both `season` and `months` and cites the climate data (CHELSA, with ETOPO), and any ordinary page naming the season makes the basis wrong. An estimate is worked out by a reviewer from the trail's location, elevation, monthly climate normals, a machine estimate and the most similar sourced trails (`tools/season_judge.py`); the method was tested blind against the seasons that pages state, and the result is in `tools/season_blind_test.json`. | `"primary"` | +| `season_method` | string | Required with `season_basis = "estimate"`, where it is one or two plain sentences saying how the season was set and what sets it there, ending "Confidence: high.", "Confidence: medium." or "Confidence: low.". Allowed with `sources`, where it says how the season was settled when the pages differ and must also end with a confidence; `sources` with a method needs pages from at least two different publishers naming the season (a page that contradicts itself, or two pages from one publisher, is an `estimate`); a season with a method was set by judgement and is shown as an estimate, not as a page's statement. Refused with `primary` and `source`. | `"Snow keeps the high passes closed until late June and returns in October. Confidence: high."` | | `high_point` | string | Name of the highest point on the trail. | `"Mount Mansfield"` | | `high_point_m` | integer | The elevation of the highest point in metres, rounded to the nearest metre (converted from feet where the source gives feet). May be given without `high_point` where a source states the elevation but not a name. | `1340` | | `terrain` | array of strings | One to three of `alpine`, `forest`, `desert`, `coast`, `prairie`, `canyon`, `tundra`, `lakes`, `farmland`: the main kinds of country only. | `["forest"]` | diff --git a/docs/season-judging.md b/docs/season-judging.md new file mode 100644 index 0000000..c665fb3 --- /dev/null +++ b/docs/season-judging.md @@ -0,0 +1,54 @@ +# Setting a season by judgement + +Where no page states a season, it is set by a reviewer from a packet, and the method was tested blind against the seasons that pages state. This page is the reviewer's instruction and the record of the test. The tools are `tools/season_judge.py` (packets, scoring, staging) and `tools/estimate_season.py` (the machine estimate that is one input, and the monthly check). + +## The test + +The reviewers also estimated every trail whose season a page states, from packets identical in form with the season hidden: the trail's own timing sentences were removed, and its comparable trails were never dealt to the same part as it. The three parts were reviewed separately, and the figures are added together. The result is in `tools/season_blind_test.json`, which the site reads; `python3 tools/season_judge.py score --write tools/season_blind_test.json` produces it. The result is given by two measures, always together. The ends-only measure counts a season as matching when the first and last months of the reviewer's months are each within one month of the stated season's, on the circle of the year. The strict measure also needs every window to correspond: a gap in the middle that the page does not have, or one the page has and the reviewer lacks, is a miss, and so is a window with no partner. The result: 114 of 148 (77 percent) had their first and last months within a month of the page's; 105 (71 percent) also had no wrong gap in the middle. By the reviewer's confidence, ends only and strict: high 48 and 48 of 52, medium 55 and 46 of 76, low 11 and 11 of 20. The 75 percent bar was set on the ends-only measure: there the judged method clears it (77 percent); on the strict measure it does not (71 percent). The owner decided that the estimates ship with both figures stated. The machine estimate on its own matches 67.6 percent on the ends-only measure, under the bar, so it is not written to a record. The confidence labels are honest on both measures: high matches most often, low least. The six trails judged from pages that disagree are not scored: only trails whose season a page states are tested. + +## What a packet lacks + +The packets rebuilt by `tools/season_judge.py packets` carry the monthly high temperature at the high and low ground but give monthly precipitation only when a file of it is supplied (`--precip`); the packets the reviewers read in November 2026 carried it for every trail. + +## The reviewer's instruction + + +You will estimate the hiking season for each trail on a list you are given (one of `part-1.txt`, `part-2.txt` or `part-3.txt`). For each id there is one packet, `packets/.md`. Work only on the ids in your list, and read only the packet for the id you are estimating. + +## What to estimate + +The months a typical hiker normally walks the whole trail, or thru-hikes it, in a normal year. + +- A season may be two windows (spring and fall) or wrap the year end (October to April). +- A month counts when about half of it or more is in season. +- Think about what actually sets the season there: snow on the high ground, summer heat, monsoon, humidity and bugs, hunting season, short daylight, river levels, mud. +- People do walk in cold and snow in places where that is normal. Do not assume summer everywhere. + +## Rules + +1. Use only the packet and your own general knowledge of the region and of the trail. +2. Do not open any trail record, do not search the web, and do not read any file outside the packet and this README. +3. Do not look at other trails' packets, answers or any scores. + +## What a packet contains + +- **The trail:** id, name, common name, country, states or provinces, length in miles, kind, shape, terrain, travel (on trail or cross-country), high point and typical days where on file. +- **Summary, start and end:** from the trail's record, with every sentence that bears on timing removed. +- **Where it is:** southernmost and northernmost latitude and westernmost and easternmost longitude of the sample points, and whether the location comes from a real track, from start and end points only, or from a region-centre fallback (the least precise). +- **Elevation:** high ground and low ground in feet as the climate was read, and the track's highest and lowest points where there is a track. +- **Climate normals (1981 to 2010):** for each month, the mean daily high in degrees F at the high ground (the upper quarter of the sample points) and the low ground (the lower half), and monthly precipitation in inches at both. Temperatures are modelled and lapse-corrected, so treat them as a guide. +- **Machine estimate:** a climate model's estimated months, right about two times in three. Use it as one input, not an answer. +- **Comparable trails:** ten trails with a season on record, chosen as most similar in climate and nearest in place, with state, high ground elevation, and each one's season and months. They are neighbours, not copies: yours may differ for good reason. +- **What pages say:** present for a few trails only, where published pages disagree: each page's publisher and the months it gives. + +## Answer format + +One tab-separated file, `an answer file named by whoever runs the review (for example `answers/.tsv`)`, one line per trail on your list, no header, five columns: + +1. id +2. months, as comma-separated numbers 1 to 12 (e.g. `7,8,9`, or `3,4,5,9,10,11`, or `10,11,12,1,2,3,4`) +3. season phrase (e.g. `July to September`, `Spring and fall`) +4. confidence: `high`, `medium` or `low` +5. one sentence: what sets the season there + +Rules for the file: every id on your list exactly once; never an empty month list; no tabs inside a column; no extra columns. Say low when you really do not know. diff --git a/docs/superpowers/plans/2026-11-20-season-on-every-trail.md b/docs/superpowers/plans/2026-11-20-season-on-every-trail.md index 86bccfd..b91b365 100644 --- a/docs/superpowers/plans/2026-11-20-season-on-every-trail.md +++ b/docs/superpowers/plans/2026-11-20-season-on-every-trail.md @@ -435,7 +435,7 @@ The workflow: triggers `schedule` (monthly: `cron: "17 6 1 * *"`) and `workflow_ - Test: `web/tests/test_facets.py` (add), `web/tests/test_hike.py` **Interfaces:** -- Produces in `facets.py`: `season_estimated(rec) -> bool` (true when `hike.season_basis == "estimate"`); `season_text(rec)` returns `"About " + phrase` for an estimate (phrase left as it is after "About", so "About June to September"), unchanged for others; `season_note(rec) -> str` (`""` unless estimated; else "Estimated from climate at the trail's elevation. No source states a season. People do walk it outside these months."); `SEASON_STATED_NOTE` not needed. +- Produces in `facets.py`: `season_estimated(rec) -> bool` (true when `hike.season_basis == "estimate"`); `season_text(rec)` returns `"About " + phrase` for an estimate (phrase left as it is after "About", so "About June to September"), unchanged for others; `season_note(rec) -> str` (`""` unless estimated; else "Estimated from climate at the trail's elevation. No source states a season. This is the usual window, not a closure."); `SEASON_STATED_NOTE` not needed. - [ ] **Step 1: Write failing tests** (fixtures built like `fake(...)` in `web/tests/test_views.py`): `test_an_estimated_season_reads_about_and_has_a_note`; `test_a_stated_season_is_unchanged_and_has_no_note`; `test_an_estimated_all_year_season_reads_about_all_year`; `test_season_estimated_is_false_without_a_basis`. - [ ] **Step 2: Run** `python3 -m unittest discover -s web/tests -p "test_facets.py" -v`. Expected: the new tests fail. diff --git a/docs/superpowers/specs/2026-11-20-season-on-every-trail-design.md b/docs/superpowers/specs/2026-11-20-season-on-every-trail-design.md index 5b53580..2fcb49c 100644 --- a/docs/superpowers/specs/2026-11-20-season-on-every-trail-design.md +++ b/docs/superpowers/specs/2026-11-20-season-on-every-trail-design.md @@ -1,6 +1,6 @@ # A season on every trail -Design, 2026-11-20. Status: awaiting approval. +Design, 2026-11-20. Status: built; the method changed after the climate model was tried (see "What changed in the method"). ## Intent @@ -108,10 +108,12 @@ left to someone remembering to run it (the owner's ruling): - **Every push.** The validator fails any record with no season, so a new trail cannot ship without one, sourced or estimated. -- **Every month.** A scheduled workflow runs `estimate_season.py --check`: it - re-runs every estimate and the fit against sourced seasons, and fails with - a list of estimates that would now come out different, or a fit that has - got worse. +- **Every month.** A scheduled workflow runs `estimate_season.py check`, + offline and with no download: it compares the digest of each estimate's + current track and location with the one recorded when the season was set, + and fails with a list of estimates whose inputs have changed, or the blind + test falling under its bar on the ends-only measure. The climate normals are + a fixed published dataset, so they are not read again. - **Every audit.** `docs/audit.md`, the written checklist for the monthly audit of everything, lists two season steps: the check above, and a fresh search for a source for every season still marked `estimate`, so estimates @@ -146,8 +148,8 @@ What the tool does: - Trail page: an estimated season reads "About June to September" with a note, as estimated time does today: "Estimated from climate at the trail's - elevation. No source states a season. People do walk it outside these - months." Sourced seasons show their basis in "About this data". + elevation. No source states a season. This is the usual window, not a + closure." Sourced seasons show their basis in "About this data". - Rows, summary lines and month lists include every trail. Estimated seasons are marked in the row. - The "By month" blurb becomes "Trails normally hiked in the month. Estimated @@ -194,6 +196,17 @@ What the tool does: - Tests: every record has season, months and basis; basis fits the sources; estimates have a method; no page says a season is missing. +## What changed in the method + +The plan above chose a rule over climate normals for Step 3. It was built and tested (`tools/estimate_season.py`, `tools/season_model.py`; CHELSA V2.1 1981 to 2010 normals, CC0, with NOAA ETOPO 2022 elevation), and it matched only 67.6 percent of the sourced seasons by the ends-only measure (the first and last months each within a month of the page's), under the owner's bar of 75 percent. Its output is therefore not written to a record. What was decided instead: + +- **A reviewer judges each estimate.** For each of the 75 trails with no season (72 are estimates and three are judged from pages that differ), a reviewer set the months from a packet: the trail's location, elevation, monthly climate normals, the machine estimate, and the ten most similar sourced trails (`tools/season_judge.py packets`; the reviewer's instruction is `docs/season-judging.md`). The machine estimate stays in the repository as an input to the packets and as the monthly check. +- **The method is tested blind.** The same reviewers estimated the 148 trails whose season a page states, from identical packets with the season hidden, and a trail's comparable trails never came from its own part of the split. Two measures are given, always together. 114 of 148 (77 percent) had their first and last months within a month of the page's; 105 (71 percent) also had no wrong gap in the middle. The ends-only measure is the one the 75 percent bar was set on, and on it the method clears the bar (77 percent); the strict measure (every window of the season must correspond, so a wrong gap counts as a miss) is lower, and the method does not reach 75 percent on it (71 percent). The owner decided the estimates ship with both figures stated. By the reviewer's confidence, ends only and strict: high 48 and 48 of 52, medium 55 and 46 of 76, low 11 and 11 of 20. The figures are in `tools/season_blind_test.json`, written by `season_judge.py score`, and the site reads them. The six trails judged from pages that disagree are not scored against themselves. +- **An estimate is stricter.** `season_basis = "estimate"` means no page states a season. `season` is built from `months`; `season_method` is one or two plain sentences saying how it was set and what sets the season there, ending "Confidence: high.", "medium." or "low."; and its one `[[hike.source]]` names `season` and `months` and cites the climate data. The validator refuses an estimate with any ordinary page naming the season, or with no method, and requires a season on every trail. +- **Pages that disagree.** Three trails (the Sierra High Route, the Cohos Trail and the Ouachita Trail) have pages from at least two different publishers that disagree, where none is the managing body, association or route author. Their season is set by judgement from all the pages and the estimate: basis `sources`, the pages cited as sources naming the season, and a `season_method` saying the pages differ and how it was settled, ending with a confidence; the validator requires two publishers and the confidence. Three more (the Finger Lakes Trail, whose one page contradicts itself, and the Ice Age Trail and the Ozark Trail, each with two pages from one publisher that differ) have no two publishers, so they are estimates: the pages are not cited as stating the season, and the method says a page was found but differs, so the season was estimated from the climate and similar trails. A season with a method is shown as an estimate (it reads "About" with a note), left out of structured data, and not counted among the seasons a page states. +- **The monthly check** (`estimate_season.py check`) runs offline: it compares the digest of each estimate's current track and location with the one `tools/season_inputs.json` recorded when the season was set, and flags any that differ. The climate normals are a fixed published dataset and are not read again. It does not rewrite anything. The audit (`docs/audit.md`) also searches afresh for a page for every estimate. +- **On the site**, a trail's page reads "About April to October" with a note (no page states a season; estimated from the climate at the trail's elevation and from similar trails; what sets it there; the confidence; that these are the usual months, not a closure). Rows, tables and month lists mark estimates, the month filter can leave them out, and the reference page and glossary give the counts and the blind-test result. + ## Open risks - Climate normals are coarse in steep terrain. The fit against sourced diff --git a/donut-hole/trail.toml b/donut-hole/trail.toml index 104ba71..855c1a9 100644 --- a/donut-hole/trail.toml +++ b/donut-hole/trail.toml @@ -59,13 +59,22 @@ start = "Jericho, Pennsylvania" end = "Farrandsville, near Lock Haven, Pennsylvania" shape = "point-to-point" travel = "trail" -checked = "2026-11-13" +checked = "2026-11-20" +season = "April to June and September to October" +months = [4, 5, 6, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Unbridged streams run high in early spring, and the valleys are hot, humid and buggy in midsummer, so the shoulder months suit best. Confidence: low." [[hike.source]] url = "https://www.kta-hike.org/donut-hole-trail.html" publisher = "Keystone Trails Association" facts = ["official_url", "summary", "start", "end", "shape", "travel"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Donut Hole Trail" publisher = "LongTrailsWiki" @@ -105,3 +114,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 = "A season was estimated: April to June and September to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/eastern-continental-trail/trail.toml b/eastern-continental-trail/trail.toml index dbcf188..f641162 100644 --- a/eastern-continental-trail/trail.toml +++ b/eastern-continental-trail/trail.toml @@ -74,7 +74,11 @@ end_lonlat = [-64.164, 48.752] shape = "point-to-point" days = [300, 300] travel = "trail-and-road" -checked = "2026-11-13" +checked = "2026-11-20" +season = "January to October" +months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. A thru-hike of about 300 days starts in the Florida winter and has to finish in the Gaspe before the November snows. Confidence: low." [[hike.source]] url = "https://nimblewillnomad.com/books/" @@ -96,6 +100,11 @@ url = "https://geogratis.gc.ca/services/geoname/en/geonames/EGLSG" publisher = "Natural Resources Canada, Canadian Geographical Names Database" facts = ["end_lonlat"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Eastern Continental Trail" publisher = "LongTrailsWiki" @@ -186,3 +195,12 @@ basis = "The trail's own description says: \"(record route note) on the Internat basis_url = "https://nimblewillnomad.com/books/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: January to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/eastern-sierra-high-route/trail.toml b/eastern-sierra-high-route/trail.toml index d0e5439..72e4a16 100644 --- a/eastern-sierra-high-route/trail.toml +++ b/eastern-sierra-high-route/trail.toml @@ -76,7 +76,11 @@ terrain = ["alpine"] travel = "mostly-cross-country" permit = "A wilderness permit is required year round for overnight trips from the Duck Pass trailhead, and from May 1 through November 1 overnight visitors there are limited to 30 people per day." caution = "The author says the route is consistently difficult, with steep and sometimes loose talus, scree and sand." -checked = "2026-11-15" +checked = "2026-11-20" +season = "July to September" +months = [7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Cross-country passes above 10,500 feet need the snow to have melted, which is from mid-July through September. Confidence: high." [[hike.source]] url = "https://danstenziano.com/products/eastern-sierra-high-route-guide" @@ -110,6 +114,11 @@ slug = "john-muir-wilderness" basis = "stated" source = "https://danstenziano.com/products/eastern-sierra-high-route-guide" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -138,3 +147,12 @@ basis = "The page says: \"The Eastern Sierra High Route is the premiere advanced basis_url = "https://danstenziano.com/products/eastern-sierra-high-route-guide" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: July to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/finger-lakes/trail.toml b/finger-lakes/trail.toml index 76af945..6777549 100644 --- a/finger-lakes/trail.toml +++ b/finger-lakes/trail.toml @@ -60,13 +60,22 @@ start = "Allegany State Park, New York" end = "Slide Mountain, Catskills, New York" shape = "network" travel = "trail" -checked = "2026-11-13" +checked = "2026-11-20" +season = "April to October" +months = [4, 5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "A page was found but it contradicts itself, giving winter, spring, summer and fall in one place and spring, summer and fall in another, so no page is relied on. The season was estimated from the climate and similar trails: snow lies from December to March and early spring is muddy. Confidence: medium." [[hike.source]] url = "https://fingerlakestrail.org/" publisher = "Finger Lakes Trail Conference" facts = ["official_url", "summary", "start", "end", "shape", "travel"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Finger Lakes Trail" publisher = "LongTrailsWiki" @@ -106,3 +115,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 = "A season was estimated: April to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season: the one page found contradicts itself. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/ganaraska/trail.toml b/ganaraska/trail.toml index 32d67a3..e9c56fd 100644 --- a/ganaraska/trail.toml +++ b/ganaraska/trail.toml @@ -59,7 +59,11 @@ official_url = "https://www.ganaraska-hiking-trail.org/" start = "Port Hope, Ontario" end = "Bruce Trail, near Collingwood, Ontario" shape = "point-to-point" -checked = "2026-11-13" +checked = "2026-11-20" +season = "April to October" +months = [4, 5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Southern Ontario is snowy in winter and muddy in March, and the trail can be walked from April until late fall. Confidence: medium." [[hike.source]] url = "https://www.ganaraska-hiking-trail.org/" @@ -72,6 +76,11 @@ slug = "queen-elizabeth-ii-wildlands-provincial-park" basis = "track" km = 48.1 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -136,3 +145,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 = "A season was estimated: April to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/general-george-crook/trail.toml b/general-george-crook/trail.toml index 6c41611..cad5f5e 100644 --- a/general-george-crook/trail.toml +++ b/general-george-crook/trail.toml @@ -58,7 +58,11 @@ official_url = "https://www.fs.usda.gov/r03/apache-sitgreaves/recreation/trails/ shape = "point-to-point" travel = "trail" caution = "The Forest Service's National Recreation Trail record says the trail can be hard to find in some places." -checked = "2026-11-14" +checked = "2026-11-20" +season = "April to June and September to October" +months = [4, 5, 6, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Rim country is snowy in winter, and the July and August monsoon brings lightning and storms, leaving spring and fall. Confidence: medium." [[hike.source]] url = "https://www.fs.usda.gov/r03/apache-sitgreaves/recreation/trails/general-crook-trail" @@ -76,6 +80,11 @@ slug = "mogollon-rim" basis = "track" km = 77.4 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -140,3 +149,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 = "A season was estimated: April to June and September to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/georgia-loop/trail.toml b/georgia-loop/trail.toml index 311aea5..2abd7ea 100644 --- a/georgia-loop/trail.toml +++ b/georgia-loop/trail.toml @@ -77,7 +77,11 @@ shape = "loop" terrain = ["forest"] travel = "trail" caution = "The Association describes the loop as the toughest hike in Georgia." -checked = "2026-11-16" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The north Georgia mountains are hot, humid and stormy in summer and cold and icy on the ridges in winter. Confidence: medium." [[hike.source]] url = "https://bmta.org/backpacking-hikes/" @@ -96,6 +100,11 @@ slug = "blood-mountain-wilderness" basis = "stated" source = "https://bmta.org/backpacking-hikes/" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -134,3 +143,12 @@ basis = "The page says: \"This loop is the triangle formed by the Benton MacKaye basis_url = "https://bmta.org/backpacking-hikes/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/gila-centennial-loop/trail.toml b/gila-centennial-loop/trail.toml index 4923121..6c00b50 100644 --- a/gila-centennial-loop/trail.toml +++ b/gila-centennial-loop/trail.toml @@ -53,7 +53,11 @@ terrain = ["canyon"] travel = "trail" permit = "Individual hikers need no pass or permit; organised groups need a permit from the Forest Service." caution = "The Forest Service says the stretch of West Fork Trail 151 along Cooper Canyon to Turkeyfeather Pass is not passable, so check the loop map there. A local trail group reported in November 2024 that the Forest Service crew had cleared the last impassable part of the loop, and that walkers found rough tread in places, such as Trail 159 above Turkey Creek and Trail 101 near private land at Double Spring. The Forest Service says West Fork Trail 151 has many river crossings per mile, and that water in the Gila can be unreliable and must be treated." -checked = "2026-11-19" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Gila canyons at 6,000 feet are hot from June to August, with monsoon storms and flash floods, and cold in winter. Confidence: medium." [[hike.source]] url = "https://www.fs.usda.gov/r03/gila/recreation/gila-wilderness-area" @@ -75,6 +79,11 @@ url = "https://myemail.constantcontact.com/Gila-Trails-News.html?soid=1140320514 publisher = "Gila Trails News (Gila Back Country Horsemen and Gila Trails Info), November 2024 update" facts = ["caution"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[guide]] title = "Gila Wilderness Centennial Loop Trail Map - 24K" author = "USDA Forest Service, Gila National Forest" @@ -111,3 +120,12 @@ basis = "The trail's own description says: \"The Gila Wilderness Centennial Loop basis_url = "https://www.fs.usda.gov/r03/gila/recreation/gila-wilderness-area" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/glossary.toml b/glossary.toml index e48cb61..f8d8d81 100644 --- a/glossary.toml +++ b/glossary.toml @@ -116,7 +116,7 @@ see = ["/lists/weekend/", "/lists/one-to-two-weeks/", "/lists/a-month-or-more/", [[term]] id = "season" term = "Season" -definition = "The months in which the whole trail is usually walked, as a source states them. It is not the dates a park or a hut is open. Only some records state one." +definition = "The months in which the whole trail is usually walked. Where a page states them, that is shown. Otherwise they are estimated from the climate at the trail's elevation and from similar trails or, where pages disagree and none is the trail's own, set by judgement from all of them, and the page says which: either reads “About” with a note. It is not the dates a park or a hut is open." see = ["/lists/"] [[term]] diff --git a/grand-valley-trail/trail.toml b/grand-valley-trail/trail.toml index abb616f..b80fe7c 100644 --- a/grand-valley-trail/trail.toml +++ b/grand-valley-trail/trail.toml @@ -56,13 +56,22 @@ official_url = "https://gvta.on.ca/Grand-Valley-Trails" start = "Belwood, Ontario" end = "Port Maitland, Ontario" shape = "point-to-point" -checked = "2026-11-14" +checked = "2026-11-20" +season = "April to October" +months = [4, 5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. A low-elevation southern Ontario footpath that can be walked in all but deep winter and the muddy early spring. Confidence: medium." [[hike.source]] url = "https://gvta.on.ca/Grand-Valley-Trails" publisher = "Grand Valley Trails Association" facts = ["summary", "official_url", "start", "end", "shape"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -82,3 +91,12 @@ basis = "The emblem is shown by its holder or by the managing agency on the page basis_url = "https://gvta.on.ca/resources/banner-option2D.jpg" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: April to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/great-eastern/trail.toml b/great-eastern/trail.toml index 39a9cb8..448331c 100644 --- a/great-eastern/trail.toml +++ b/great-eastern/trail.toml @@ -62,7 +62,11 @@ shape = "point-to-point" travel = "trail" unfinished = "The trail is made of existing trails that are still being linked, and new trail is needed where gaps remain. Backpacker reported in 2022 that the association had completed over 70 percent since 2007, and that the first end-to-end thru-hike, by two hikers, was in 2013." days = [120, 180] -checked = "2026-11-19" +checked = "2026-11-20" +season = "April to October" +months = [4, 5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. A very long Appalachian walk, started in spring in Alabama and carried through summer humidity and into fall to avoid winter in the north. Confidence: low." [[hike.source]] url = "https://www.greateasterntrail.net/about-us/" @@ -104,6 +108,11 @@ slug = "ramseys-draft-wilderness" basis = "track" km = 3.8 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -186,3 +195,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 = "A season was estimated: April to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/great-western-divide-loop/trail.toml b/great-western-divide-loop/trail.toml index 4e9e1cd..5729e14 100644 --- a/great-western-divide-loop/trail.toml +++ b/great-western-divide-loop/trail.toml @@ -68,7 +68,11 @@ start = "Crescent Meadow, Sequoia National Park" start_lonlat = [-118.748, 36.559] shape = "loop" terrain = ["forest", "alpine"] -checked = "2026-11-13" +checked = "2026-11-20" +season = "July to September" +months = [7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Kaweah Gap and the Great Western Divide hold deep snow into early July, and autumn storms return by October. Confidence: medium." [[hike.source]] url = "https://www.nps.gov/seki/planyourvisit/high-sierra-trail.htm" @@ -102,6 +106,11 @@ slug = "sequoia-kings-canyon-wilderness" basis = "stated" source = "https://www.nps.gov/seki/planyourvisit/high-sierra-trail.htm" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -148,3 +157,12 @@ basis = "The trail's own description says: \"The Sequoia Great Western Divide Lo basis_url = "https://www.nps.gov/seki/planyourvisit/high-sierra-trail.htm" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: July to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/high-country-pathway/trail.toml b/high-country-pathway/trail.toml index 7fb2d64..8f7d839 100644 --- a/high-country-pathway/trail.toml +++ b/high-country-pathway/trail.toml @@ -60,7 +60,11 @@ days = [7, 7] terrain = ["forest"] travel = "trail" caution = "Mountain bikers use the pathway as well as hikers." -checked = "2026-11-14" +checked = "2026-11-20" +season = "May to October" +months = [5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Northern Michigan forest is snowbound in winter and muddy in early spring, and walkable from May to October, with bugs the main summer complaint. Confidence: medium." [[hike.source]] url = "https://www.michigan.org/property/high-country-pathway" @@ -72,6 +76,11 @@ url = "https://www.trailscouncil.org/high-country-pathway/" publisher = "Top of Michigan Trails Council" facts = ["summary", "start", "shape", "caution"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -91,3 +100,12 @@ basis = "The pages named in the logo note were searched, and none shows an emble basis_url = "https://www.michigan.gov/recsearch/trails/high-country-pathway" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: May to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/highlands/trail.toml b/highlands/trail.toml index c2e66df..5fba369 100644 --- a/highlands/trail.toml +++ b/highlands/trail.toml @@ -58,7 +58,11 @@ end = "Hudson River, New York" shape = "point-to-point" terrain = ["forest"] travel = "trail" -checked = "2026-11-13" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The low New Jersey and New York Highlands ridges are hot, humid and buggy in summer and icy in midwinter. Confidence: medium." [[hike.source]] url = "https://nynjtc.org/highlands-trail" @@ -71,6 +75,11 @@ slug = "appalachian-mountains" basis = "track" km = 26.9 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -99,3 +108,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 = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/hoosier-heritage-trail/trail.toml b/hoosier-heritage-trail/trail.toml index 61f89a6..e5c6b2b 100644 --- a/hoosier-heritage-trail/trail.toml +++ b/hoosier-heritage-trail/trail.toml @@ -70,7 +70,11 @@ shape = "point-to-point" travel = "trail-and-road" start_lonlat = [-85.863, 38.462] end_lonlat = [-86.477, 39.323] -checked = "2026-11-16" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Indiana has hot, humid summers with ticks and thick vegetation, so spring and fall are the most comfortable months. Confidence: medium." [[hike.source]] url = "https://hoosierheritagetrail.org/" @@ -92,6 +96,11 @@ url = "https://github.com/swaits/longhikes/issues/2#issuecomment-6927004842" publisher = "Hoosier Heritage Trail Association (said by its president on the dataset's issue tracker, 2026-11-16)" facts = ["summary", "start", "end", "shape", "travel"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Knobstone Hiking Trail" publisher = "Knobstone Hiking Trail Association" @@ -163,3 +172,12 @@ basis = "The association's Downloads page offers the 2026 mapset, the address an basis_url = "https://hoosierheritagetrail.org/downloads/" asked_by = "the trail association's president" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/horse-shoe/trail.toml b/horse-shoe/trail.toml index b7f56c2..91736ac 100644 --- a/horse-shoe/trail.toml +++ b/horse-shoe/trail.toml @@ -59,13 +59,22 @@ start = "Valley Forge National Historical Park, Pennsylvania" end = "the Appalachian Trail, Dauphin County, Pennsylvania" shape = "point-to-point" travel = "trail" -checked = "2026-11-13" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Southeast Pennsylvania has humid, buggy summers and icy winters, which leaves spring and fall. Confidence: medium." [[hike.source]] url = "https://cart.hstrail.org/" publisher = "Horse-Shoe Trail Conservancy" facts = ["official_url", "summary", "start", "end", "shape", "travel"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Horse-Shoe Trail" publisher = "LongTrailsWiki" @@ -90,3 +99,12 @@ basis = "The pages named in the logo note were searched, and none offers usable basis_url = "https://cart.hstrail.org/wp-content/uploads/2019/10/horse-shoe_trail_header_1000_logo-1.jpg" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/hot-springs-trail/trail.toml b/hot-springs-trail/trail.toml index 859ba5a..e3b40b2 100644 --- a/hot-springs-trail/trail.toml +++ b/hot-springs-trail/trail.toml @@ -76,7 +76,11 @@ shape = "point-to-point" days = [110, 110] terrain = ["alpine", "lakes"] travel = "some-cross-country" -checked = "2026-11-13" +checked = "2026-11-20" +season = "April to September" +months = [4, 5, 6, 7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. A northbound route of about 110 days from coastal California to Idaho needs the Sierra and the northern mountains clear of snow, so it runs from spring to early fall. Confidence: low." [[hike.source]] url = "https://outsideways.com/routes/us/hot-springs-trail/" @@ -88,6 +92,11 @@ url = "https://edits.nationalmap.gov/apps/gaz-domestic/public/summary/1661401" publisher = "U.S. Geological Survey, Geographic Names Information System" facts = ["start_lonlat"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Hot Springs Trail" publisher = "LongTrailsWiki" @@ -163,3 +172,12 @@ basis = "The route page says: \"These are undoubtedly some of the most striking basis_url = "https://outsideways.com/routes/us/hot-springs-trail/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: April to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/iat-newfoundland-labrador/trail.toml b/iat-newfoundland-labrador/trail.toml index 4d87ef7..d346ba0 100644 --- a/iat-newfoundland-labrador/trail.toml +++ b/iat-newfoundland-labrador/trail.toml @@ -63,7 +63,11 @@ shape = "point-to-point" travel = "trail-and-road" unfinished = "The chapter's stated goal is a 750 km extension of the trail; as of 2023 it is made of T'Railway sections, gravel logging roads, backcountry trails and routes, and secondary highways." days = [35, 50] -checked = "2026-11-19" +checked = "2026-11-20" +season = "June to September" +months = [6, 7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Western Newfoundland is cold, snowy and boggy until June, and storms and snow return in October. Confidence: medium." [[hike.source]] url = "https://iatnl.org/thru-hikers/" @@ -85,6 +89,11 @@ url = "https://iatnl.org/services/thru-hiker-route-details-directions/" publisher = "International Appalachian Trail Newfoundland and Labrador" facts = ["days"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "International Appalachian Trail" publisher = "LongTrailsWiki" @@ -157,3 +166,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 = "A season was estimated: June to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/ice-age/trail.toml b/ice-age/trail.toml index 59d3f21..269a355 100644 --- a/ice-age/trail.toml +++ b/ice-age/trail.toml @@ -67,7 +67,11 @@ travel = "trail-and-road" unfinished = "The trail is about half complete: nearly 700 miles are yellow-blazed Ice Age Trail, and about 500 miles of unmarked connecting routes, mostly on quiet country roads, link the blazed segments." caution = "Primitive camping is not permitted on many segments, so overnight plans vary widely from night to night." permit = "No National Park Pass or fee is needed to use the trail." -checked = "2026-11-19" +checked = "2026-11-20" +season = "May to October" +months = [5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "One publisher's two pages were found and they differ, one giving summer and fall and the other summer only, so no page is relied on. The season was estimated from the climate and similar trails: snow and mud last through April and a hard freeze comes by November. Confidence: medium." [[hike.source]] url = "https://www.iceagetrail.org/explore/explore-the-trail/ice-age-trail/" @@ -89,6 +93,11 @@ url = "https://www.nps.gov/iatr/planyourvisit/fees.htm" publisher = "National Park Service" facts = ["permit"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Ice Age National Scenic Trail" publisher = "LongTrailsWiki" @@ -158,3 +167,12 @@ basis = "The page of National Park Service says: \"A National Park Pass is not r basis_url = "https://www.nps.gov/iatr/planyourvisit/fees.htm" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: May to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season: the two pages found are from one publisher and differ. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/international-appalachian-trail-maine/trail.toml b/international-appalachian-trail-maine/trail.toml index e11c307..bd4de34 100644 --- a/international-appalachian-trail-maine/trail.toml +++ b/international-appalachian-trail-maine/trail.toml @@ -58,7 +58,11 @@ shape = "point-to-point" terrain = ["forest", "farmland"] travel = "trail-and-road" caution = "Much of the route is on roads, because the chapter has relied on landowners' permission to secure the route." -checked = "2026-11-14" +checked = "2026-11-20" +season = "June to October" +months = [6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Northern Maine is snowbound and muddy until late May and frozen from November, and fall is best once the bugs fade. Confidence: medium." [[hike.source]] url = "https://maineiat.org/?p=412" @@ -85,6 +89,11 @@ url = "https://nominatim.openstreetmap.org/ui/details.html?osmtype=N&osmid=12949 publisher = "OpenStreetMap contributors, via Nominatim (ODbL): Barnard Mountain Trailhead, OpenStreetMap node 12949585422" facts = ["start_lonlat"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "International Appalachian Trail" publisher = "LongTrailsWiki" @@ -139,3 +148,12 @@ basis = "The trail's own description says: \"The Maine section of the Internatio basis_url = "https://maineiat.org/?p=412" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: June to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/koroc-palmer-loop/trail.toml b/koroc-palmer-loop/trail.toml index b3f0b42..fa84758 100644 --- a/koroc-palmer-loop/trail.toml +++ b/koroc-palmer-loop/trail.toml @@ -57,7 +57,11 @@ terrain = ["alpine", "tundra"] travel = "mostly-cross-country" permit = "Hikers must register before the trip with both Torngat Mountains National Park and Parc national Kuururjuaq, and de-register after leaving the parks." caution = "Stream crossings on the Koroc River and its tributaries can be fast and very cold, and they grow harder after heavy rain." -checked = "2026-11-16" +checked = "2026-11-20" +season = "July to August" +months = [7, 8] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The Torngat Mountains in the Arctic are snowbound until late June and freeze again by September, leaving a short July and August window. Confidence: medium." [[hike.source]] url = "https://parks.canada.ca/pn-np/nl/torngats/activ/randonee-hiking1/koroc" @@ -75,6 +79,11 @@ slug = "torngat-mountains-national-park" basis = "stated" source = "https://parks.canada.ca/pn-np/nl/torngats/activ/randonee-hiking1/koroc" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -104,3 +113,12 @@ basis = "The page says: \"Hiking parties who are interested in tackling this hik basis_url = "https://parks.canada.ca/pn-np/nl/torngats/activ/randonee-hiking1/koroc" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: July to August." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/la-cloche/trail.toml b/la-cloche/trail.toml index 5ed5a67..e785015 100644 --- a/la-cloche/trail.toml +++ b/la-cloche/trail.toml @@ -59,7 +59,11 @@ days = [7, 10] terrain = ["forest", "lakes"] travel = "trail" permit = "Backcountry campsites along the trail are reserved through Ontario Parks." -checked = "2026-11-14" +checked = "2026-11-20" +season = "June to October" +months = [6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Killarney is snowbound in winter and buggy in spring, so the warm months are the main window, with September and early October the best. Confidence: medium." [[hike.source]] url = "https://www.ontarioparks.ca/park/killarney" @@ -77,6 +81,11 @@ slug = "killarney-provincial-park" basis = "track" km = 73.8 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -105,3 +114,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 = "A season was estimated: June to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/lost-coast/trail.toml b/lost-coast/trail.toml index d32bbae..cbddbd1 100644 --- a/lost-coast/trail.toml +++ b/lost-coast/trail.toml @@ -60,7 +60,11 @@ terrain = ["coast"] travel = "trail" permit = "Overnight camping on the King Range sections needs a Backcountry Permit, booked through Recreation.gov; Sinkyone Wilderness State Park has its own rules for camping." caution = "On the northern section the BLM tells hikers to research the tides before booking a permit." -checked = "2026-11-14" +checked = "2026-11-20" +season = "May to September" +months = [5, 6, 7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Heavy winter rain, slides and high tides make parts of the coast impassable, so the dry months with workable low tides are used. Confidence: high." [[hike.source]] url = "https://www.blm.gov/visit/lost-coast-trail" @@ -84,6 +88,11 @@ slug = "king-range-wilderness" basis = "track" km = 42.4 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -112,3 +121,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 = "A season was estimated: May to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/loyalsock/trail.toml b/loyalsock/trail.toml index 04a8104..3507855 100644 --- a/loyalsock/trail.toml +++ b/loyalsock/trail.toml @@ -63,7 +63,11 @@ terrain = ["forest"] travel = "trail" caution = "Fires are banned along parts of the trail and during the spring fire season, and the club advises hikers to stay off the trail during bear and deer season, which runs about three weeks from the Monday before Thanksgiving." permit = "No permit is needed to camp one night at a site; a free Loyalsock State Forest camping permit is needed to stay more than one night at one location." -checked = "2026-11-19" +checked = "2026-11-20" +season = "April to June and September to October" +months = [4, 5, 6, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Rocky, wet terrain in northern Pennsylvania is best in the cool shoulder seasons, before the humid, buggy summer. Confidence: medium." [[hike.source]] url = "https://alpineclubofwilliamsport.com/loyalsock-trail-information/" @@ -80,6 +84,11 @@ url = "https://alpineclubofwilliamsport.com/faqs/" publisher = "Alpine Club of Williamsport" facts = ["permit"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Loyalsock Trail" publisher = "LongTrailsWiki" @@ -128,3 +137,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 = "A season was estimated: April to June and September to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/mason-dixon/trail.toml b/mason-dixon/trail.toml index b7b32eb..fa2d9cf 100644 --- a/mason-dixon/trail.toml +++ b/mason-dixon/trail.toml @@ -60,13 +60,22 @@ end = "Chadds Ford, Pennsylvania, on the Brandywine River" shape = "point-to-point" terrain = ["forest"] travel = "trail" -checked = "2026-11-13" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The low Susquehanna valley is hot and humid in summer, so the cool spring and fall months suit best. Confidence: medium." [[hike.source]] url = "https://masondixontrail.wixsite.com/mdts" publisher = "Mason-Dixon Trail System" facts = ["official_url", "summary", "start", "end", "shape", "terrain", "travel"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Mason-Dixon Trail" publisher = "LongTrailsWiki" @@ -100,3 +109,12 @@ basis = "OpenStreetMap relation 1820324 names one way of each pair Mason-Dixon T basis_url = "https://www.openstreetmap.org/relation/1820324" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/midland-to-mackinac-trail/trail.toml b/midland-to-mackinac-trail/trail.toml index 88d2a4e..e00d83e 100644 --- a/midland-to-mackinac-trail/trail.toml +++ b/midland-to-mackinac-trail/trail.toml @@ -56,7 +56,11 @@ terrain = ["forest"] travel = "trail" caution = "The 2018 guide states there is no GPS track for the trail and that its maps are bound to be wrong in places." permit = "Camping along the trail on public land is free, but camping on state land needs a Michigan DNR permit." -checked = "2026-11-19" +checked = "2026-11-20" +season = "June to October" +months = [6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Snow and mud last into April in northern Michigan, and the walk is comfortable from June through early fall. Confidence: medium." [[hike.source]] url = "https://www.fs.usda.gov/r09/huron-manistee/recreation/trails/midland-mackinaw-trail" @@ -78,6 +82,11 @@ url = "https://nominatim.openstreetmap.org/ui/details.html?osmtype=R&osmid=13498 publisher = "OpenStreetMap contributors, via Nominatim (ODbL): Mackinaw City, OpenStreetMap relation 134987" facts = ["end_lonlat"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -125,3 +134,12 @@ basis = "The record's own sources: the 2018 guide states there is no GPS track f basis_url = "https://www.fs.usda.gov/r09/huron-manistee/recreation/trails/midland-mackinaw-trail" asked_by = "a reviewer" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: June to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/midstate-ma/trail.toml b/midstate-ma/trail.toml index 7378b8d..50fd775 100644 --- a/midstate-ma/trail.toml +++ b/midstate-ma/trail.toml @@ -61,7 +61,11 @@ shape = "point-to-point" high_point = "Mount Wachusett" high_point_m = 611 travel = "trail" -checked = "2026-11-14" +checked = "2026-11-20" +season = "April to June and September to November" +months = [4, 5, 6, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The gentle central Massachusetts hills are pleasant in spring and fall, with humid, buggy summers and cold, icy winters. Confidence: medium." [[hike.source]] url = "https://www.midstatetrail.org/" @@ -73,6 +77,11 @@ url = "https://www.midstatetrail.org/about-the-midstate-trail/old-growth-forest/ publisher = "Midstate Trail Committee" facts = ["high_point"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -92,3 +101,12 @@ basis = "The emblem is shown by its holder or by the managing agency on the page basis_url = "https://www.midstatetrail.org/wp-content/uploads/2017/06/follow_triangle.png" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: April to June and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/north-south-lbl/trail.toml b/north-south-lbl/trail.toml index 1d92cc2..ff6bc37 100644 --- a/north-south-lbl/trail.toml +++ b/north-south-lbl/trail.toml @@ -59,7 +59,11 @@ shape = "point-to-point" terrain = ["forest", "lakes"] travel = "trail" permit = "Each person aged 18 or older needs a Land Between the Lakes Backcountry Camping Permit." -checked = "2026-11-19" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The forests of western Kentucky and Tennessee are hot, humid and tick-ridden in summer, so spring and fall are favoured. Confidence: medium." [[hike.source]] url = "https://www.landbetweenthelakes.us/outdoors-recreation/trails-3/" @@ -76,6 +80,11 @@ url = "https://www.landbetweenthelakes.us/help-center/rules-and-regulations/" publisher = "USDA Forest Service, Land Between the Lakes NRA" facts = ["permit"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -105,3 +114,12 @@ basis = "The page of USDA Forest Service, Land Between the Lakes NRA says: \"Eac basis_url = "https://www.landbetweenthelakes.us/help-center/rules-and-regulations/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/north-south/trail.toml b/north-south/trail.toml index 5cef24d..f8e9b6b 100644 --- a/north-south/trail.toml +++ b/north-south/trail.toml @@ -56,7 +56,11 @@ official_url = "https://www.rigis.org/datasets/north-south-trail" shape = "point-to-point" terrain = ["forest"] travel = "trail" -checked = "2026-11-13" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Rhode Island woods are humid and buggy in summer and cold in winter. Confidence: medium." [[hike.source]] url = "https://www.rigis.org/datasets/north-south-trail" @@ -68,6 +72,11 @@ url = "https://dem.ri.gov/sites/g/files/xkgbur861/files/programs/bnatres/fishwil publisher = "Rhode Island Department of Environmental Management" facts = ["summary", "terrain"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "North-South Trail" publisher = "LongTrailsWiki" @@ -92,3 +101,12 @@ basis = "The pages named in the logo note were searched, and none shows an emble basis_url = "https://www.rigis.org/datasets/north-south-trail" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/north-umpqua/trail.toml b/north-umpqua/trail.toml index 38f09ba..0fbeaa0 100644 --- a/north-umpqua/trail.toml +++ b/north-umpqua/trail.toml @@ -57,7 +57,11 @@ official_url = "https://www.fs.usda.gov/r06/umpqua/recreation/groups/north-umpqu shape = "point-to-point" terrain = ["forest"] travel = "trail" -checked = "2026-11-14" +checked = "2026-11-20" +season = "June to October" +months = [6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The upper Cascade sections near 6,000 feet hold snow into June and see heavy rain and snow from late October, though the river canyon can be walked earlier. Confidence: medium." [[hike.source]] url = "https://www.fs.usda.gov/r06/umpqua/recreation/groups/north-umpqua-trail-1414" @@ -74,6 +78,11 @@ url = "https://www.blm.gov/visit/north-umpqua-wild-and-scenic-river" publisher = "Bureau of Land Management" facts = ["summary", "terrain", "travel"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "North Umpqua Trail" publisher = "LongTrailsWiki" @@ -128,3 +137,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 = "A season was estimated: June to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/oak-ridges/trail.toml b/oak-ridges/trail.toml index b3d12bf..3a84eb4 100644 --- a/oak-ridges/trail.toml +++ b/oak-ridges/trail.toml @@ -59,7 +59,11 @@ shape = "point-to-point" terrain = ["forest", "farmland"] travel = "trail-and-road" caution = "There are no overnight accommodations on the trail and camping is not permitted." -checked = "2026-11-13" +checked = "2026-11-20" +season = "April to October" +months = [4, 5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The southern Ontario moraine is snowy and muddy over winter and can be walked from April until late fall. Confidence: medium." [[hike.source]] url = "https://www.oakridgestrail.org/end-to-end-hike/" @@ -71,6 +75,11 @@ url = "https://www.oakridgestrail.org/chapters/" publisher = "Oak Ridges Trail Association" facts = ["summary", "start", "end", "terrain"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -90,3 +99,12 @@ basis = "The emblem is shown by its holder or by the managing agency on the page basis_url = "https://www.oakridgestrail.org/wp-content/uploads/2024/07/favicon.jpg" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: April to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/ottawa-temiskaming-highland-trail/trail.toml b/ottawa-temiskaming-highland-trail/trail.toml index 9f79483..1fd5db0 100644 --- a/ottawa-temiskaming-highland-trail/trail.toml +++ b/ottawa-temiskaming-highland-trail/trail.toml @@ -58,7 +58,11 @@ shape = "point-to-point" terrain = ["forest", "lakes"] travel = "trail" caution = "The trail planner calls it a rugged wilderness trail." -checked = "2026-11-14" +checked = "2026-11-20" +season = "June to October" +months = [6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Northeastern Ontario forest is snowbound and muddy until May, with black flies in early summer, and cold by November. Confidence: medium." [[hike.source]] url = "https://nastawgantrails.org/our-trails" @@ -85,6 +89,11 @@ url = "https://geogratis.gc.ca/services/geoname/en/geonames/FDNSB" publisher = "Natural Resources Canada (Canadian Geographical Names)" facts = ["end_lonlat"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -104,3 +113,12 @@ basis = "The pages named in the logo note were searched, and none offers usable basis_url = "https://nastawgantrails.org/our-trails" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: June to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/ouachita/trail.toml b/ouachita/trail.toml index 6fa2c5d..be8c49f 100644 --- a/ouachita/trail.toml +++ b/ouachita/trail.toml @@ -64,7 +64,11 @@ terrain = ["forest"] travel = "trail" days = [14, 21] permit = "No permits are required for the trail." -checked = "2026-11-19" +checked = "2026-11-20" +season = "October to May" +months = [1, 2, 3, 4, 5, 10, 11, 12] +season_basis = "sources" +season_method = "The pages differ: one gives April to November, one gives late October to late March, and one gives all year. It was set by judgement from all three and the climate: a classic cool-season trail, since summers are hot, humid and full of ticks. Confidence: medium." [[hike.source]] url = "https://www.friendsoftheouachita.org/about-the-ot" @@ -81,6 +85,21 @@ url = "https://www.treelinereview.com/where-to-go/ouachita-trail" publisher = "Treeline Review" facts = ["days", "permit"] +[[hike.source]] +url = "https://thehikinglife.com/2014/07/ouachita-trail/" +publisher = "The Hiking Life" +facts = ["season", "months"] + +[[hike.source]] +url = "https://backpackingroutes.com/ouachita-trail/" +publisher = "Backpacking Routes" +facts = ["season", "months"] + +[[hike.source]] +url = "https://thetrek.co/10-trails-can-find-long-distance-solitude-2020/" +publisher = "The Trek" +facts = ["season", "months"] + [[link]] title = "Ouachita Trail" publisher = "LongTrailsWiki" @@ -150,3 +169,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 = "A season was set from pages that differ: October to May." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "The pages that state a season differ and none is the managing body, association or route author, so it was set by judgement from all of them and the climate estimate." +basis_url = "https://thehikinglife.com/2014/07/ouachita-trail/" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/ozark-trail/trail.toml b/ozark-trail/trail.toml index 1045255..e1d1b92 100644 --- a/ozark-trail/trail.toml +++ b/ozark-trail/trail.toml @@ -61,7 +61,11 @@ end = "Western edge of the Mark Twain National Forest, Missouri" shape = "point-to-point" travel = "trail" unfinished = "The St. Louis to Arkansas border route is not complete; about 230 miles form the contiguous thru-hike backbone." -checked = "2026-11-13" +checked = "2026-11-20" +season = "September to May" +months = [1, 2, 3, 4, 5, 9, 10, 11, 12] +season_basis = "estimate" +season_method = "One publisher's two pages were found and they differ, one giving spring or fall and the other adding winter, so no page is relied on. The season was estimated from the climate and similar trails: it runs fall through spring, and the heat, humidity and ticks of summer set the gap. Confidence: medium." [[hike.source]] url = "https://ozarktrail.com/thru-hiking/" @@ -78,6 +82,11 @@ url = "https://www.fs.usda.gov/r09/marktwain/recreation/ozark-trail" publisher = "USDA Forest Service, Mark Twain National Forest" facts = ["start", "end"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Ozark Trail" publisher = "LongTrailsWiki" @@ -120,3 +129,12 @@ basis = "OpenStreetMap relation 16710911 names the two ways Eleven Point Low Rou basis_url = "https://www.openstreetmap.org/relation/16710911" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: September to May." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season: the two pages found are from one publisher and differ. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/paumanok-path/trail.toml b/paumanok-path/trail.toml index 7453840..ae9ebd0 100644 --- a/paumanok-path/trail.toml +++ b/paumanok-path/trail.toml @@ -57,7 +57,11 @@ start = "Rocky Point, New York" end = "Montauk Point, New York" shape = "point-to-point" terrain = ["forest", "coast"] -checked = "2026-11-14" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Long Island is humid and tick-heavy in summer, and the pine barrens are pleasant in the cool shoulder seasons. Confidence: medium." [[hike.source]] url = "https://southamptontrails.org/history/" @@ -69,6 +73,11 @@ url = "https://www.ligreenbelt.org/about-greenbelt-trails" publisher = "Long Island Greenbelt Trail Conference" facts = ["summary", "terrain"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -88,3 +97,12 @@ basis = "The pages named in the logo note were searched, and none shows an emble basis_url = "https://southamptontrails.org/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/pfiffner-traverse/trail.toml b/pfiffner-traverse/trail.toml index 0993381..fc181f6 100644 --- a/pfiffner-traverse/trail.toml +++ b/pfiffner-traverse/trail.toml @@ -76,7 +76,11 @@ days = [6, 10] terrain = ["alpine", "forest", "lakes"] travel = "some-cross-country" permit = "The Rocky Mountain National Park portion requires use of designated backcountry campsites, arranged through the park permit system described in the guide." -checked = "2026-11-13" +checked = "2026-11-20" +season = "July to September" +months = [7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. A Continental Divide crest route above 11,000 feet with off-trail passes needs the snow gone, which is from July until the first big September storms. Confidence: high." [[hike.source]] url = "https://andrewskurka.com/adventures/pfiffner-traverse-colorado-rockies/" @@ -127,6 +131,11 @@ slug = "james-peak-wilderness" basis = "stated" source = "https://andrewskurka.com/adventures/pfiffner-traverse-colorado-rockies/" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -173,3 +182,12 @@ basis = "The page says: \"The Pfiffner Traverse is a 77-mile backpacking high ro basis_url = "https://andrewskurka.com/adventures/pfiffner-traverse-colorado-rockies/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: July to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/rideau-trail/trail.toml b/rideau-trail/trail.toml index c364c15..352f833 100644 --- a/rideau-trail/trail.toml +++ b/rideau-trail/trail.toml @@ -58,7 +58,11 @@ end = "Ottawa, Ontario" shape = "point-to-point" caution = "Many parts of the trail network close during the Ontario fall hunting season, and overnight accommodation is sparse along much of the trail." days = [9, 16] -checked = "2026-11-13" +checked = "2026-11-20" +season = "April to October" +months = [4, 5, 6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Eastern Ontario is snowy and muddy over winter, and the trail can be walked from April until late fall. Confidence: medium." [[hike.source]] url = "https://www.rideautrail.org/discover-the-trail/" @@ -75,6 +79,11 @@ url = "https://www.rideautrail.org/discover-the-trail/faq/" publisher = "Rideau Trail Association" facts = ["days"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Rideau Trail" publisher = "LongTrailsWiki" @@ -120,3 +129,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 = "A season was estimated: April to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/ring-the-peak/trail.toml b/ring-the-peak/trail.toml index 26bfdc2..219f405 100644 --- a/ring-the-peak/trail.toml +++ b/ring-the-peak/trail.toml @@ -53,7 +53,11 @@ high_point_m = 3444 travel = "trail-and-road" unfinished = "About 80 percent of the route is complete, and evaluation and planning continue for the remaining 20 percent." caution = "Many of the trails are covered by snow in winter." -checked = "2026-11-14" +checked = "2026-11-20" +season = "June to October" +months = [6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. A loop around Pikes Peak that mixes stretches near 11,000 feet with lower trails, and is snow-free from about June to October. Confidence: low." [[hike.source]] url = "https://friendsofthepeak.org/ring-the-peak-2/" @@ -66,6 +70,11 @@ slug = "front-range" basis = "stated" source = "https://friendsofthepeak.org/ring-the-peak-2/" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -94,3 +103,12 @@ basis = "The page says: \"Ring the Peak is a collection of trails and backcountr basis_url = "https://friendsofthepeak.org/ring-the-peak-2/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: June to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/sawtooth-wilderness-high-route/trail.toml b/sawtooth-wilderness-high-route/trail.toml index 9a9d3d3..c5d73e7 100644 --- a/sawtooth-wilderness-high-route/trail.toml +++ b/sawtooth-wilderness-high-route/trail.toml @@ -71,7 +71,11 @@ terrain = ["alpine", "lakes"] travel = "mostly-cross-country" permit = "A free wilderness permit is obtained by self-registration at the trailhead, and there is no fee to access the Sawtooth Wilderness." caution = "The planned route was about 89 miles with over 50 miles off-trail; the hike its author recorded covered 67 miles." -checked = "2026-11-13" +checked = "2026-11-20" +season = "July to September" +months = [7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Mostly cross-country passes near 9,000 feet and above need the snow gone, which is from mid-July through September. Confidence: high." [[hike.source]] url = "https://seekinglost.com/sawtooth-wilderness-high-route-8-day-solo-hike-aug-2017/" @@ -95,6 +99,11 @@ slug = "sawtooth-wilderness" basis = "stated" source = "https://seekinglost.com/sawtooth-wilderness-high-route-8-day-solo-hike-aug-2017/" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -132,3 +141,12 @@ basis = "The trail's own description says: \"This Sawtooth Wilderness high route basis_url = "https://seekinglost.com/sawtooth-wilderness-high-route-8-day-solo-hike-aug-2017/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: July to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/sea-to-sea-route/trail.toml b/sea-to-sea-route/trail.toml index f0bebd4..105462d 100644 --- a/sea-to-sea-route/trail.toml +++ b/sea-to-sea-route/trail.toml @@ -76,7 +76,11 @@ summary = "The Sea-to-Sea Route is a network of existing long-distance hiking tr official_url = "https://andrewskurka.com/adventures/sea-to-sea-route/overview/" shape = "network" unfinished = "An 800-mile gap in North Dakota and Montana along the Missouri River and a 30-mile gap in Vermont interrupt the network." -checked = "2026-11-13" +checked = "2026-11-20" +season = "All year" +months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. A transcontinental route of about 7,775 miles takes about a year to walk, so no single window fits and it is listed for all twelve months. Confidence: low." [[hike.source]] url = "https://andrewskurka.com/adventures/sea-to-sea-route/overview/" @@ -131,6 +135,11 @@ slug = "stephen-mather-wilderness" basis = "stated" source = "https://www.nps.gov/noca/planyourvisit/pacific-northwest-trail.htm" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -177,3 +186,12 @@ basis = "The page says: \"The Pacific Northwest Trail (PNT) travels 1,200 miles basis_url = "https://www.nps.gov/noca/planyourvisit/pacific-northwest-trail.htm" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: All year." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/shawangunk-ridge-trail/trail.toml b/shawangunk-ridge-trail/trail.toml index c3e58df..f44c188 100644 --- a/shawangunk-ridge-trail/trail.toml +++ b/shawangunk-ridge-trail/trail.toml @@ -61,7 +61,11 @@ shape = "point-to-point" terrain = ["forest"] travel = "trail" unfinished = "The Trail Conference calls the trail a work in progress: it is blazed to Mountain Rest Road near Mohonk Mountain House, and local roads lead on from there." -checked = "2026-11-14" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. A Hudson Valley ridge with humid, buggy summers and icy winters, so spring and fall are the most comfortable months. Confidence: medium." [[hike.source]] url = "https://secure.nynjtc.org/node/874" @@ -74,6 +78,11 @@ slug = "appalachian-mountains" basis = "track" km = 49.0 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -102,3 +111,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 = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/shenipsit-trail/trail.toml b/shenipsit-trail/trail.toml index ab8eb05..797f275 100644 --- a/shenipsit-trail/trail.toml +++ b/shenipsit-trail/trail.toml @@ -58,13 +58,22 @@ end = "West Stafford, Connecticut" shape = "point-to-point" terrain = ["forest"] travel = "trail" -checked = "2026-11-16" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Central Connecticut has humid, buggy summers and cold, icy winters, so spring and fall are best. Confidence: medium." [[hike.source]] url = "https://ctwoodlands.org/trails/shenipsit-trail/" publisher = "Connecticut Forest and Park Association" facts = ["official_url", "summary", "start", "end", "shape", "terrain", "travel"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -85,3 +94,12 @@ basis = "The pages named in the logo note were searched, and none shows an emble basis_url = "https://ctwoodlands.org/trails/shenipsit-trail/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/sierra-high-route/trail.toml b/sierra-high-route/trail.toml index 0de0615..dda3876 100644 --- a/sierra-high-route/trail.toml +++ b/sierra-high-route/trail.toml @@ -90,7 +90,11 @@ terrain = ["alpine", "lakes"] travel = "mostly-cross-country" days = [14, 21] permit = "A permit is needed from the agency that manages the trailhead where you start." -checked = "2026-11-19" +checked = "2026-11-20" +season = "July to September" +months = [7, 8, 9] +season_basis = "sources" +season_method = "The pages differ: Backpacking Routes gives late July to mid-September, and Skurka warns the route is off-limits to all but expert mountaineers from November through May. It was set by judgement from both and from the climate at the passes, which are near 12,000 feet. Confidence: high." [[hike.source]] url = "https://www.mountaineers.org/books/books/sierra-high-route-2nd-edition-traversing-timberline-country" @@ -114,8 +118,13 @@ facts = ["end_lonlat"] [[hike.source]] url = "https://andrewskurka.com/adventures/sierra-high-route/logistical-considerations/" -publisher = "Andrew Skurka (the route's author)" -facts = ["permit"] +publisher = "Andrew Skurka (Skurka Adventures)" +facts = ["permit", "season", "months"] + +[[hike.source]] +url = "https://backpackingroutes.com/sierra-high-route/" +publisher = "Backpacking Routes" +facts = ["season", "months"] [[link]] title = "Sierra High Route" @@ -219,3 +228,21 @@ basis = "The trail's own description says: \"The Sierra High Route is Steve Rope basis_url = "https://www.mountaineers.org/books/books/sierra-high-route-2nd-edition-traversing-timberline-country" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was set from pages that differ: July to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "The pages that state a season differ and none is the managing body, association or route author, so it was set by judgement from all of them and the climate estimate." +basis_url = "https://andrewskurka.com/adventures/sierra-high-route/logistical-considerations/" +asked_by = "the dataset's own check" +outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "The permit page's publisher was corrected: Andrew Skurka's own site, Skurka Adventures. It is not the route's author, who is Steve Roper." +fields = ["hike.source.publisher"] +basis = "The earlier entry about the permit note called the page's author the route's author. The route's creator in this record is Steve Roper (the guidebook's author); Skurka wrote the route's map set and a series of pages about it." +basis_url = "https://andrewskurka.com/adventures/sierra-high-route/logistical-considerations/" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/siskiyou-peaks-trail/trail.toml b/siskiyou-peaks-trail/trail.toml index 76ca9a4..9fe6d48 100644 --- a/siskiyou-peaks-trail/trail.toml +++ b/siskiyou-peaks-trail/trail.toml @@ -80,7 +80,11 @@ terrain = ["alpine", "lakes"] travel = "some-cross-country" permit = "The Forest Service requires a free wilderness permit to enter the Mount Shasta Wilderness, and a Summit Pass above 10,000 feet on the mountain." caution = "The route's last summit is Mt Shasta, a glaciated volcano that the Forest Service says has no trail to its top. Booksellers' copies of the guidebook's description disagree (read 2026-11-19): one says no advanced mountaineering equipment or specialty training is required in summer, though basic rock scrambling and navigation skills are, and another says advanced mountaineering equipment and specialty training may be required." -checked = "2026-11-19" +checked = "2026-11-20" +season = "July to September" +months = [7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The summits and cirque lakes are snowbound until late June, and Shasta is climbed in summer. Confidence: medium." [[hike.source]] url = "https://outsideways.com/routes/us/siskiyou-peaks-trail/" @@ -149,6 +153,11 @@ slug = "trinity-alps-wilderness" basis = "stated" source = "https://www.booktopia.com.au/the-siskiyou-peaks-trail-aria-zoner/book/9781983447525.html" +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -178,3 +187,12 @@ basis = "The page says: \"Wilderness areas high-pointed on this trail include: - basis_url = "https://www.booktopia.com.au/the-siskiyou-peaks-trail-aria-zoner/book/9781983447525.html" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: July to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/sky-islands-traverse/trail.toml b/sky-islands-traverse/trail.toml index 7085286..64c2f26 100644 --- a/sky-islands-traverse/trail.toml +++ b/sky-islands-traverse/trail.toml @@ -73,7 +73,11 @@ shape = "point-to-point" terrain = ["desert", "forest", "canyon"] travel = "some-cross-country" caution = "Since 2023 its author has withdrawn the detailed route information and does not encourage hiking the exact layout, saying fires and floods have reclaimed many miles of trail." -checked = "2026-11-13" +checked = "2026-11-20" +season = "March to May and September to November" +months = [3, 4, 5, 9, 10, 11] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Summer heat and the July and August monsoon storms in southeastern Arizona push the walk into spring and fall. Confidence: low." [[hike.source]] url = "https://simblissity.net/skit.shtml" @@ -85,6 +89,11 @@ url = "https://edits.nationalmap.gov/apps/gaz-domestic/public/summary/11334" publisher = "U.S. Geological Survey, Geographic Names Information System" facts = ["end_lonlat"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Sky Islands Traverse" publisher = "LongTrailsWiki" @@ -139,3 +148,12 @@ basis = "The page says: \"Farther along the SKIT reaches Fort Bowie National His basis_url = "https://simblissity.net/skit.shtml" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: March to May and September to November." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/solitude-loop/trail.toml b/solitude-loop/trail.toml index f42770b..13da5cd 100644 --- a/solitude-loop/trail.toml +++ b/solitude-loop/trail.toml @@ -59,7 +59,11 @@ terrain = ["alpine", "forest", "lakes"] travel = "trail" caution = "Part of the trail lies in a special regulation area where visitors must pack out all human waste, and uses allowed vary from segment to segment." permit = "A free self-issued Forest Service registration, signed and dated for each visit, is needed to enter Cloud Peak Wilderness, which the loop circles." -checked = "2026-11-19" +checked = "2026-11-20" +season = "July to September" +months = [7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Cloud Peak Wilderness at 9,000 to 11,000 feet holds snow into early July, and winter storms return in late September. Confidence: high." [[hike.source]] url = "https://www.fs.usda.gov/r02/bighorn/recreation/trails/solitude-loop-trail-038" @@ -83,6 +87,11 @@ slug = "cloud-peak-wilderness" basis = "track" km = 67.9 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -130,3 +139,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 = "A season was estimated: July to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/standing-stone/trail.toml b/standing-stone/trail.toml index 0bc3b0e..38bdac0 100644 --- a/standing-stone/trail.toml +++ b/standing-stone/trail.toml @@ -62,7 +62,11 @@ terrain = ["forest"] travel = "trail" high_point = "Greenwood fire tower" high_point_m = 725 -checked = "2026-11-13" +checked = "2026-11-20" +season = "April to June and September to October" +months = [4, 5, 6, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. Humid, buggy summers and icy winters on the Pennsylvania ridges leave spring and fall as the usual window. Confidence: medium." [[hike.source]] url = "https://www.standingstonetrail.org/" @@ -74,6 +78,11 @@ url = "https://www.standingstonetrail.org/about" publisher = "Standing Stone Trail Club" facts = ["high_point"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Standing Stone Trail" publisher = "LongTrailsWiki" @@ -113,3 +122,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 = "A season was estimated: April to June and September to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/stein-valley-traverse/trail.toml b/stein-valley-traverse/trail.toml index 2c48e28..fca4297 100644 --- a/stein-valley-traverse/trail.toml +++ b/stein-valley-traverse/trail.toml @@ -60,7 +60,11 @@ terrain = ["forest", "alpine", "lakes"] travel = "some-cross-country" permit = "BC Parks' park brochure says there is no hiker registration in the Stein Valley." caution = "BC Parks says solid route finding skills are a necessity, because sections of trail may be wet, steep or difficult to see, and the upper valley above treeline is a route marked in places with cairns." -checked = "2026-11-16" +checked = "2026-11-20" +season = "July to September" +months = [7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. The traverse tops out around 7,000 feet, where snow lingers into July, and heavy rain starts in October. Confidence: medium." [[hike.source]] url = "https://bcparks.ca/stein-valley-nlakapamux-heritage-park/" @@ -89,6 +93,11 @@ slug = "coast-mountains" basis = "track" km = 89.0 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -118,3 +127,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 = "A season was estimated: July to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/sunapee-ragged-kearsarge/trail.toml b/sunapee-ragged-kearsarge/trail.toml index d84dafb..f5000aa 100644 --- a/sunapee-ragged-kearsarge/trail.toml +++ b/sunapee-ragged-kearsarge/trail.toml @@ -58,7 +58,11 @@ official_url = "https://www.srkg.org/" shape = "loop" terrain = ["forest", "lakes"] travel = "trail" -checked = "2026-11-13" +checked = "2026-11-20" +season = "June to October" +months = [6, 7, 8, 9, 10] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. New Hampshire snow and mud last into spring and black flies into early June, with foliage-season walking into early October. Confidence: medium." [[hike.source]] url = "https://www.srkg.org/" @@ -71,6 +75,11 @@ slug = "appalachian-mountains" basis = "track" km = 44.1 +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + # History of this record, oldest first. Add to it; never rewrite it. # See docs/schema.md, section [[history]]. @@ -99,3 +108,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 = "A season was estimated: June to October." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/tahoe-yosemite-trail/trail.toml b/tahoe-yosemite-trail/trail.toml index 4702ad4..b4da75a 100644 --- a/tahoe-yosemite-trail/trail.toml +++ b/tahoe-yosemite-trail/trail.toml @@ -72,7 +72,11 @@ shape = "point-to-point" terrain = ["alpine", "forest", "lakes"] travel = "some-cross-country" caution = "The route is unofficial; the Forest Service describes even its northernmost part at Meeks Bay as the unofficial Tahoe-Yosemite Trail." -checked = "2026-11-13" +checked = "2026-11-20" +season = "July to September" +months = [7, 8, 9] +season_basis = "estimate" +season_method = "Judged from the climate at the trail's elevation and from similar trails. High Sierra passes up to about 10,000 feet hold snow until early July, and fall storms arrive in October. Confidence: high." [[hike.source]] url = "https://shop.adventurewithkeen.com/wilderness-press/" @@ -94,6 +98,11 @@ url = "https://edits.nationalmap.gov/apps/gaz-domestic/public/summary/255168" publisher = "U.S. Geological Survey, Geographic Names Information System" facts = ["end_lonlat"] +[[hike.source]] +url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)" +facts = ["season", "months"] + [[link]] title = "Tahoe-Yosemite Trail" publisher = "LongTrailsWiki" @@ -178,3 +187,12 @@ basis = "The trail's own description says: \"The Tahoe-Yosemite Trail is Thomas basis_url = "https://shop.adventurewithkeen.com/wilderness-press/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "A season was estimated: July to September." +fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"] +basis = "No page states a season. It was set by judgement from the climate at the trail's elevation and from similar trails." +basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/tools/estimate_season.py b/tools/estimate_season.py new file mode 100644 index 0000000..1064107 --- /dev/null +++ b/tools/estimate_season.py @@ -0,0 +1,908 @@ +#!/usr/bin/env python3 +"""Estimate a hiking season from climate, for trails no page gives one. + +Python 3 standard library only. The estimator itself is a pure function +over monthly climate normals (tools/season_model.py: thresholds on the +track's high and low ground, blended with the seasons of the most +similar sourced trails); this file finds a trail's sample points, reads +their normals (tools/season_climate.py does the downloading, cached +outside the repository) and runs the model, so its tests run with no +network. See docs/superpowers/specs/2026-11-20-season-on-every-trail-design.md. + +The model cannot know that some trails are walked in snow by choice, or +that a page names only a thru-hike start window; the leave-one-out fit +against sourced seasons says how often that matters. + +Commands: fit (fit the model and record the leave-one-out figure), trial +(compare the climate sources), warm (read every point's climate into the +cache), propose (the review list), estimates (the trails whose season is an +estimate) and check (rerun the machine estimate for every estimate and +flag any whose inputs changed, and the fit). The seasons themselves are +set by judgement from the packets of tools/season_judge.py, which also +stages them for the refresh pipeline; the machine estimate is one input +to that judgement and is not written to a record on its own. +""" +import sys + +sys.dont_write_bytecode = True + +import argparse +import bisect +import csv +import datetime +import hashlib +import json +import math +import os +import statistics +import tomllib +from dataclasses import dataclass, replace + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) + +import refresh # noqa: E402 +import season # noqa: E402 +import season_batches # noqa: E402 +import season_climate # noqa: E402 +import season_model # noqa: E402 + +ROOT = os.path.dirname(HERE) + +RULE_VERSION = 2 + + +@dataclass(frozen=True) +class SamplePoint: + lat: float + lon: float + elev_m: float = None + km: float = None + + +Params = season_model.Params +Reference = season_model.Reference +months_in_season = season_model.months_in_season + + +# --------------------------------------------------------------------------- +# Sample points from a record. Track pieces are joined and oriented with +# the same rule tools/elevation.py uses to build elevation.json (ends +# within 100 m join, the whole track runs south to north or west to +# east, parts in order along that axis, gaps between parts not counted +# in the distance), reimplemented here with the standard library only, +# so a sample point's kilometre matches the profile's kilometre and its +# elevation can be read from the profile. + +EARTH_R_M = 6371008.8 +JOIN_GAP_M = 100.0 +LOOP_FRACTION = 0.1 +SAMPLE_KM = 50.0 +MIN_POINTS = 3 +MAX_POINTS = 12 + + +def _track_parts(data): + if data.get("type") == "FeatureCollection": + geoms = [(f.get("geometry") or {}) for f in data.get("features", [])] + elif data.get("type") == "Feature": + geoms = [data.get("geometry") or {}] + else: + geoms = [data] + parts = [] + for geom in geoms: + if geom.get("type") == "LineString": + parts.append(geom["coordinates"]) + elif geom.get("type") == "MultiLineString": + parts.extend(geom["coordinates"]) + return [[(float(c[0]), float(c[1])) for c in p] for p in parts if len(p) >= 2] + + +def _gap_m(a, b): + dx = (a[0] - b[0]) * math.cos(math.radians((a[1] + b[1]) / 2)) + return math.hypot(dx, a[1] - b[1]) * math.pi / 180.0 * EARTH_R_M + + +def _seg_km(a, b): + return season_climate.haversine_km(a[1], a[0], b[1], b[0]) + + +def _join_parts(parts, gap_m=JOIN_GAP_M): + if not parts: + return [] + cell = max(gap_m, 1.0) + k = math.pi / 180.0 * EARTH_R_M + max_lat = max(abs(c[1]) for p in parts for c in (p[0], p[-1])) + scale = max(math.cos(math.radians(max_lat)), 1e-9) * k + + def cell_of(c): + return (math.floor(c[0] * scale / cell), math.floor(c[1] * k / cell)) + + grid = {} + for i, p in enumerate(parts): + for end in (0, 1): + grid.setdefault(cell_of(p[0] if end == 0 else p[-1]), []).append((i, end)) + used = [False] * len(parts) + + def nearest(point): + gx, gy = cell_of(point) + best = None + for x in (gx - 1, gx, gx + 1): + for y in (gy - 1, gy, gy + 1): + for i, end in grid.get((x, y), ()): + if used[i]: + continue + d = _gap_m(point, parts[i][0] if end == 0 else parts[i][-1]) + if d <= gap_m and (best is None or d < best[0]): + best = (d, i, end) + return best + + out = [] + for i0, first in enumerate(parts): + if used[i0]: + continue + used[i0] = True + chain = list(first) + while True: + hit = nearest(chain[-1]) + if hit is None: + break + _, i, end = hit + used[i] = True + chain.extend(parts[i] if end == 0 else parts[i][::-1]) + while True: + hit = nearest(chain[0]) + if hit is None: + break + _, i, end = hit + used[i] = True + chain[:0] = parts[i][::-1] if end == 0 else parts[i] + out.append(chain) + return out + + +def _orient(chains): + """Chains turned to run south to north or west to east and put in + order along that axis, as tools/elevation.py does.""" + if not chains: + return [] + lons = [c[0] for ch in chains for c in ch] + lats = [c[1] for ch in chains for c in ch] + mid_lat = (min(lats) + max(lats)) / 2.0 + width = (max(lons) - min(lons)) * math.cos(math.radians(mid_lat)) + axis = 1 if (max(lats) - min(lats)) > width else 0 + out = [] + for ch in chains: + length_km = sum(_seg_km(a, b) for a, b in zip(ch, ch[1:])) + if (_gap_m(ch[0], ch[-1]) > LOOP_FRACTION * length_km * 1000.0 + and ch[-1][axis] < ch[0][axis]): + ch = ch[::-1] + out.append(ch) + out.sort(key=lambda ch: sum(c[axis] for c in ch) / len(ch)) + return out + + +def _ordered_track(path): + """(vertices, cumulative km) along the joined, oriented track. + The first vertex of each part sits at the same distance as the last + vertex of the part before it: gaps are not counted.""" + with open(path, encoding="utf-8") as f: + data = json.load(f) + chains = _orient(_join_parts(_track_parts(data))) + verts, cum = [], [] + total = 0.0 + for chain in chains: + for j, vertex in enumerate(chain): + if j: + total += _seg_km(chain[j - 1], vertex) + verts.append(vertex) + cum.append(total) + return verts, cum + + +def _point_at(verts, cum, target_km): + i = bisect.bisect_right(cum, target_km) - 1 + i = max(0, min(i, len(verts) - 2)) + span = cum[i + 1] - cum[i] + frac = 0.0 if span <= 0 else (target_km - cum[i]) / span + frac = max(0.0, min(1.0, frac)) + lon = verts[i][0] + frac * (verts[i + 1][0] - verts[i][0]) + lat = verts[i][1] + frac * (verts[i + 1][1] - verts[i][1]) + if target_km >= cum[-1]: + lon, lat = verts[-1] + return lat, lon + + +def _profile_elev(profile, km): + """Elevation in metres from an elevation.json profile at km.""" + if not profile: + return None + kms = [float(p[0]) for p in profile] + i = bisect.bisect_right(kms, km) - 1 + if i < 0: + return float(profile[0][1]) + if i >= len(profile) - 1: + return float(profile[-1][1]) + km0, el0 = float(profile[i][0]), float(profile[i][1]) + km1, el1 = float(profile[i + 1][0]), float(profile[i + 1][1]) + if km1 <= km0: + return el1 + return el0 + (km - km0) / (km1 - km0) * (el1 - el0) + + +def _load_profile(root, tid): + path = os.path.join(root, tid, "elevation.json") + if not os.path.exists(path): + return None, None + with open(path, encoding="utf-8") as f: + doc = json.load(f) + return doc.get("profile") or None, (doc.get("highest") or None) + + +def _give_high_point(points, hike, highest): + """With no profile, one point carries high_point_m so the high + ground is represented at all: the point nearest the profile's + highest place when that is known, else the first point.""" + high_m = hike.get("high_point_m") + if high_m is None or not points: + return points + idx = 0 + if highest and highest.get("lat") is not None: + idx = min(range(len(points)), + key=lambda i: season_climate.haversine_km( + points[i].lat, points[i].lon, + float(highest["lat"]), float(highest["lon"]))) + return [replace(p, elev_m=float(high_m)) if i == idx else p + for i, p in enumerate(points)] + + +def sample_points(root, rec): + """Sample points for a record and how they were got: "track" (one + per 50 km of track, at least 3, at most 12, evenly spaced, with + elevations from the profile), "ends" (hike.start_lonlat and + hike.end_lonlat), or "place" (the centre of the first region's box + in web/place-bounds.toml). An elevation of None lets the climate + source supply its own cell elevation. With no profile, one point + carries hike.high_point_m when the record has one.""" + tid = rec.get("id") or "" + hike = rec.get("hike") or {} + line_file = (rec.get("source") or {}).get("line_file") or "line.geojson" + line_path = os.path.join(root, tid, line_file) + if tid and os.path.exists(line_path): + try: + verts, cum = _ordered_track(line_path) + except (OSError, ValueError, KeyError, TypeError, IndexError): + verts, cum = [], [] + if len(verts) >= 2 and cum and cum[-1] > 0: + total = cum[-1] + n = min(MAX_POINTS, max(MIN_POINTS, int(round(total / SAMPLE_KM)) + 1)) + profile, highest = _load_profile(root, tid) + points = [] + for i in range(n): + target = total * i / (n - 1) + lat, lon = _point_at(verts, cum, target) + elev = _profile_elev(profile, target) + points.append(SamplePoint(lat=lat, lon=lon, elev_m=elev, + km=round(target, 2))) + if not profile: + points = _give_high_point(points, hike, highest) + return points, "track" + + ends = [] + for key in ("start_lonlat", "end_lonlat"): + value = hike.get(key) + if value and len(value) == 2: + ends.append(SamplePoint(lat=float(value[1]), lon=float(value[0]), + elev_m=None, km=None)) + if ends: + if hike.get("high_point_m") is not None: + ends[0] = replace(ends[0], elev_m=float(hike["high_point_m"])) + return ends, "ends" + + regions = rec.get("regions") or [] + country = rec.get("country") or "" + bounds_path = os.path.join(root, "web", "place-bounds.toml") + if regions and os.path.exists(bounds_path): + with open(bounds_path, "rb") as f: + boxes = (tomllib.load(f) or {}).get("box") or {} + box = boxes.get(f"{country}-{regions[0]}") + if box is None: + for key, value in boxes.items(): + if key.endswith("-" + str(regions[0])): + box = value + break + if box and len(box) == 4: + elev = hike.get("high_point_m") + return [SamplePoint(lat=(float(box[1]) + float(box[3])) / 2, + lon=(float(box[0]) + float(box[2])) / 2, + elev_m=None if elev is None else float(elev), + km=None)], "place" + return [], "place" + + +# --------------------------------------------------------------------------- +# Fitting the model against the sourced seasons, scored leave-one-out +# (tools/season_model.py). Estimates may ship only over the owner's bar, +# held here in one place. + +BAR = {"within1_min": 0.75, "coverage_min": 0.90} + + +def season_kind(months): + """The kind of trail a sourced season describes, from the season + alone: "year-round" (eleven or twelve months), "cool-season" (hiked + in the cool months, none of June to August), "alpine" (a summer + season that leaves out December to February and covers July or + August, at most six months) or "other" (the shoulder seasons and + the rest).""" + months = set(months) + if len(months) >= 11: + return "year-round" + if not months & {6, 7, 8}: + return "cool-season" + if not months & {12, 1, 2} and months & {7, 8} and len(months) <= 6: + return "alpine" + return "other" + + +KINDS = ("alpine", "cool-season", "year-round", "other") + + +def report(sourced, loo): + """How the model did leave-one-out on sourced trails. sourced is + (id, medians or None, months, region group); loo maps id to + (estimated mask, score) from season_model.fit_model. n counts every + sourced trail; no_data those whose points lack climate data; + within1 those that match under the owner's measure (a match is + within one month at each end, window by window for two windows, + ten or more months for a year-round season). classified and + jaccard are means over the estimable trails, by kind and by region + group too.""" + def empty(): + return {"n": 0, "within1": 0, "no_data": 0, "worse": 0, + "classified": 0.0, "jaccard": 0.0} + total, by_group = empty(), {} + by_kind = {k: empty() for k in KINDS} + for tid, med, months, group in sourced: + buckets = (total, by_group.setdefault(group, empty()), + by_kind[season_kind(months)]) + for b in buckets: + b["n"] += 1 + if med is None or tid not in loo: + for b in buckets: + b["no_data"] += 1 + continue + a, c_share, jac = loo[tid][1] + for b in buckets: + if a: + b["within1"] += 1 + else: + b["worse"] += 1 + b["classified"] += c_share + b["jaccard"] += jac + for b in (total, *by_group.values(), *by_kind.values()): + est = b["n"] - b["no_data"] + b["classified"] = round(b["classified"] / est, 4) if est else 0.0 + b["jaccard"] = round(b["jaccard"] / est, 4) if est else 0.0 + total["by_group"] = by_group + total["by_kind"] = by_kind + return total + + +def passes_bar(rep, bar=BAR): + """The owner's bar: at least 75 percent of sourced trails matched + leave-one-out, and at least 90 percent estimable.""" + n = rep.get("n") or 0 + if not n: + return False + return (rep["within1"] / n >= bar["within1_min"] + and 1 - rep["no_data"] / n >= bar["coverage_min"]) + + +def _records(root): + for tid in refresh.trail_ids(root): + yield tid, refresh.load_toml(os.path.join(root, tid, "trail.toml")) + + +def normals_at(points, fetch): + return [fetch(p.lat, p.lon, p.elev_m) for p in points] + + +def sourced_trails(root, fetch, log=None): + """(id, medians or None, sourced months, region group) for every + record whose season comes from a page. Fetching goes through the + climate cache; a network failure aborts the run and a rerun + resumes from the cache, so no point is ever downloaded twice.""" + out = [] + for tid, rec in _records(root): + hike = rec.get("hike") or {} + if not season.read_from_a_page(hike): + continue + points, kind = sample_points(root, rec) + med = season_model.medians(normals_at(points, fetch)) + if log: + log(f"{tid}: {kind}, {len(points)} points") + out.append((tid, med, list(hike.get("months") or []), + season_batches.group_of(rec))) + return out + + +def _fetch_with_cache(cache_dir): + if cache_dir is None: + return season_climate.fetch_normals + return lambda lat, lon, elev: season_climate.fetch_normals( + lat, lon, elev, cache=cache_dir) + + +def fit_sourced(sourced): + """(params fitted on all, leave-one-out report) for sourced trails; + the estimable ones are fitted and the rest counted as no data.""" + usable = [(t[0], t[1], t[2]) for t in sourced if t[1] is not None] + params, loo = season_model.fit_model(usable) + return params, report(sourced, loo), loo + + +def confidence_cut(sourced, loo, params): + """The (close, decisive) limits of season_model.confidence that + make a "high" estimate the most reliable group of at least a + quarter of the sourced trails, by a leave-one-out look: for each + trail, its neighbours leave it out. Returns the pair and the + share of high and low estimates that matched.""" + refs = [Reference(t[0], t[1], t[2]) for t in sourced if t[1] is not None] + rows = [] + for tid, med, months, _g in sourced: + if med is None or tid not in loo: + continue + near = season_model.nearest(med, refs, params.k, exclude=tid) + _mask, scores, fell = season_model.blend(med, near, params) + rows.append((near, scores, fell, med, loo[tid][1][0])) + best = None + for close in (0.08, 0.1, 0.12, 0.15, 0.2, 0.3): + for decisive in (0.5, 0.6, 0.7, 0.8, 0.9): + hi = [r[4] for r in rows + if season_model.confidence(r[3], r[0], r[1], r[2], close, decisive)[0] == "high"] + lo = [r[4] for r in rows + if season_model.confidence(r[3], r[0], r[1], r[2], close, decisive)[0] == "low"] + if len(hi) < len(rows) / 4 or not lo: + continue + gap = sum(hi) / len(hi) - sum(lo) / len(lo) + if best is None or gap > best[0]: + best = (gap, close, decisive, sum(hi) / len(hi), sum(lo) / len(lo), len(hi)) + return best + + +def _params_doc(params): + return params.as_dict() + + +def cmd_fit(args): + fetch = _fetch_with_cache(args.cache) + sourced = sourced_trails(ROOT, fetch, log=lambda line: print(line, flush=True)) + params, rep, loo = fit_sourced(sourced) + doc = { + "computed": datetime.date.today().isoformat(), + "rule_version": RULE_VERSION, + "dataset": season_climate.SOURCE["name"], + "period": season_climate.SOURCE["period"], + "params": _params_doc(params), + "loo": rep, + "bar": BAR, + "passes": passes_bar(rep), + "confidence": None, + } + best = confidence_cut(sourced, loo, params) + if best: + doc["confidence"] = {"close": best[1], "decisive": best[2], + "high_matched": round(best[3], 3), + "low_matched": round(best[4], 3), "high_n": best[5]} + path = os.path.join(ROOT, "tools", "season_fit.json") + with open(path, "w", encoding="utf-8") as f: + json.dump(doc, f, indent=1, sort_keys=True) + f.write("\n") + print(f"sourced {rep['n']}: leave-one-out matched {rep['within1']}/{rep['n']}, " + f"classified {rep['classified']}, jaccard {rep['jaccard']}, " + f"no data {rep['no_data']}, passes {doc['passes']}") + print(f"params {_params_doc(params)}; confidence {doc['confidence']}") + print(f"wrote {path}") + return 0 + + +# --------------------------------------------------------------------------- +# Estimates for trails with no sourced season, the review list a person +# reads, the staged proposals that write accepted estimates through the +# refresh pipeline, and the check that reruns both. + +COARSE_PARAMS = Params(cold_c_min=5.0, heat_c_max=32.0) + +# The trial's twelve, by rule: akshayuk-pass is the far north trail; +# great-divide-trail and west-coast-trail are in Canada; john-muir, +# colorado-trail and uinta-highline are alpine; desert-winter-thru-hike +# and arizona are desert; west-coast-trail and washington-coast-trail +# are coastal; maah-daah-hey is prairie; florida is the southeast; +# superior-hiking fills the dozen from the midwest. +TRIAL_TRAILS = ["akshayuk-pass", "great-divide-trail", "west-coast-trail", + "john-muir", "colorado-trail", "uinta-highline", + "desert-winter-thru-hike", "arizona", "florida", + "washington-coast-trail", "maah-daah-hey", "superior-hiking"] + +FLAG_ORDER = ("no-track", "place-centre", "no-data", "no-month", + "desert", "coast", "far-north", "few-points") + +def _flags(points, kind, normals, med, params, fell_back=False): + found = set() + if kind != "track": + found.add("no-track") + if kind == "place": + found.add("place-centre") + if len(points) < 3: + found.add("few-points") + if points and max(p.lat for p in points) > 60: + found.add("far-north") + if med is None: + found.add("no-data") + else: + elevs = [n.elev_m for n in normals if n is not None] + if elevs and max(elevs) <= 200: + found.add("coast") + high, low = med + for m in range(12): + if high[m] >= params.cold_c_min and low[m] > params.heat_c_max: + found.add("desert") + break + if fell_back: + found.add("no-month") + return [name for name in FLAG_ORDER if name in found] + + +_REFS = {} + + +def references(root, fetch): + """The sourced trails as comparable-trail references, read once per + root per run (sampling and reading every sourced trail again for + each estimate would take minutes).""" + if root not in _REFS: + _REFS[root] = [Reference(t[0], t[1], t[2]) + for t in sourced_trails(root, fetch) if t[1] is not None] + return _REFS[root] + + +def estimate(root, rec, params, fetch=season_climate.fetch_normals, refs=None): + """One trail's estimated season and how much to trust it: months + (None when unestimable, with the reason), the phrase and method + sentence an accepted estimate would carry, how its points were got, + flags for hand review, the comparable trails the estimate drew on + (nearest first, as (id, distance, sourced phrase)) and a confidence + ("high" or "low") with its reason. A trail's own sourced season is + never one of its comparable trails. refs defaults to the sourced + trails read through fetch. Fetch errors propagate; nothing here + touches the network except through fetch.""" + points, kind = sample_points(root, rec) + normals = normals_at(points, fetch) + med = season_model.medians(normals) + if refs is None: + refs = references(root, fetch) + months, near, fell_back, conf, why = None, [], False, "low", "" + if med is not None: + near = season_model.nearest(med, refs, params.k, exclude=rec.get("id")) + mask, scores, fell_back = season_model.blend(med, near, params) + months = season_model.to_months(mask) + limits = {"close": 0.12, "decisive": 0.7} + try: + limits = (load_fit(root).get("confidence") or limits) + except OSError: + pass + conf, why = season_model.confidence( + med, near, scores, fell_back, limits["close"], limits["decisive"]) + if kind != "track" or len(points) < 3: + conf, why = "low", "the location is a fallback (" + ( + "the trail's ends" if kind == "ends" else "the region's centre") + ")" + else: + why = "no data for one of the sample points" + phrases = _phrases(root) + comparable = [(r.id, round(d, 3), phrases.get(r.id, ""), season_model.to_months(r.mask)) + for d, r in near] + return { + "months": months, + "phrase": season.phrase_for(months) if months else "", + "method": season.method_sentence( + season_climate.SOURCE["name"], season_climate.SOURCE["period"], + len(points), kind, RULE_VERSION), + "kind": kind, + "flags": _flags(points, kind, normals, med, params, fell_back), + "comparable": comparable[0][0] if comparable else "", + "comparable_phrase": comparable[0][2] if comparable else "", + "neighbours": comparable, + "confidence": conf, + "confidence_reason": why, + "reason": "" if months else why, + "points": points, + "normals": normals, + } + + +def _phrases(root): + if root not in _PHRASES: + out = {} + for tid, rec in _records(root): + hike = rec.get("hike") or {} + if season.read_from_a_page(hike): + out[tid] = str(hike.get("season")) + _PHRASES[root] = out + return _PHRASES[root] + + +_PHRASES = {} + + +def load_fit(root): + with open(os.path.join(root, "tools", "season_fit.json"), encoding="utf-8") as f: + return json.load(f) + + +def load_params(root): + return Params.from_dict(load_fit(root)["params"]) + + +def _with_cache(fetch_fn, cache_dir): + if cache_dir is None: + return fetch_fn + return lambda lat, lon, elev: fetch_fn(lat, lon, elev, cache=cache_dir) + + +def propose(root, params, fetch, given_dir=None): + """Write the review list, one row per trail with no season, to + /season/estimates.csv and list every unestimable trail + with its reason. Returns the row count.""" + staging = refresh.staging_dir(root, given_dir, create=True) + out_dir = os.path.join(staging, "season") + os.makedirs(out_dir, exist_ok=True) + rows, unestimable = [], [] + for tid, rec in _records(root): + if (rec.get("hike") or {}).get("season"): + continue + est = estimate(root, dict(rec, id=tid), params, fetch) + rows.append([tid, " ".join(str(m) for m in est["months"] or []), + est["phrase"], est["kind"], ";".join(est["flags"]), + est["comparable"], est["comparable_phrase"]]) + if not est["months"]: + unestimable.append((tid, est["reason"])) + path = os.path.join(out_dir, "estimates.csv") + with open(path, "w", newline="", encoding="utf-8") as f: + writer = csv.writer(f) + writer.writerow(["id", "proposed_months", "phrase", "kind", "flags", + "comparable", "comparable_phrase"]) + writer.writerows(rows) + for tid, reason in unestimable: + print(f"{tid}: not estimable: {reason}") + print(f"{len(rows)} rows written to {path} " + f"({len(unestimable)} not estimable)") + return len(rows) + + +def _toml_str(text): + return '"' + str(text).replace("\\", "\\\\").replace('"', '\\"') + '"' + + +def inputs_signature(est): + """What an estimate rests on, as a small comparable record: the machine + estimate's months and a digest of the climate at the high and low + ground and of the sourced trails it was compared with.""" + normals = est["normals"] + med = season_model.medians(normals) if all(n is not None for n in normals) else None + material = json.dumps({"med": med, "near": [n[0] for n in est["neighbours"]]}, + sort_keys=True) + return {"machine": sorted(est["months"] or []), + "digest": hashlib.sha256(material.encode()).hexdigest()[:16]} + + +def load_inputs(root): + path = os.path.join(root, "tools", "season_inputs.json") + try: + with open(path, encoding="utf-8") as f: + return json.load(f) + except OSError: + return {} + + +def estimates(root): + """The ids of the records whose season is an estimate, in order.""" + return [tid for tid, rec in _records(root) + if (rec.get("hike") or {}).get("season_basis") == "estimate"] + + +def points_signature(root, rec): + """A short digest of where a trail's season was estimated: the kind of sample points and their + coordinates and elevations, from the trail's current track (or its ends, or its place). It reads + only files in the repository, so the monthly check can compare it with no network.""" + points, kind = sample_points(root, rec) + material = json.dumps( + {"kind": kind, + "points": [[round(p.lat, 4), round(p.lon, 4), + None if p.elev_m is None else round(p.elev_m)] for p in points]}, + sort_keys=True) + return hashlib.sha256(material.encode()).hexdigest()[:16] + + +def check(root, fetch=None): + """The monthly check, offline. For every estimated season, compares the digest of the trail's + current track and location (points_signature) with the one recorded in + tools/season_inputs.json when the season was set, and returns (ok, lines): not ok when an + estimate has no recorded inputs, when its track or location has changed, when inputs are + recorded for a trail that is no longer an estimate, or when the blind test of the judged method + (tools/season_blind_test.json) is missing, or is below the bar on its ends-only measure (the + strict measure is recorded beside it). The climate normals are a fixed published dataset + (CHELSA, 1981 to 2010), so they are not read again; `fetch` is accepted and unused. A changed + estimate is a flag for a person to look at, not a rewrite.""" + import season_judge + ok, lines, checked = True, [], 0 + recorded = load_inputs(root) + for tid, rec in _records(root): + hike = rec.get("hike") or {} + if hike.get("season_basis") != "estimate": + continue + checked += 1 + now = points_signature(root, dict(rec, id=tid)) + then = (recorded.get(tid) or {}).get("points") + if tid not in recorded or then is None: + ok = False + lines.append(f"{tid}: no inputs are recorded for this estimate: run " + "python3 tools/season_judge.py inputs --points " + tid) + elif now != then: + ok = False + lines.append(f"{tid}: inputs changed: the trail's track or location is no longer the one the " + f"season was estimated for ({then}, now {now}); the season is " + f"{sorted(hike.get('months') or [])}") + for tid in sorted(set(recorded) - set(estimates(root))): + ok = False + lines.append(f"{tid}: has recorded inputs but is no longer an estimate: remove it " + "from tools/season_inputs.json") + try: + blind = season_judge.load_blind_test(os.path.join(root, "tools", "season_blind_test.json")) + problems = season_judge.check_blind_test(blind) + if problems: + ok = False + lines += [f"tools/season_blind_test.json: {p}" for p in problems] + elif blind["share"] < BAR["within1_min"]: + ok = False + lines.append(f"the blind test matched {blind['share']:.2f} on the ends-only measure, under the " + f"bar of {BAR['within1_min']:.2f} on that measure (the strict figure is " + f"{blind['strict_share']:.2f}); estimates must not ship") + except (OSError, ValueError, KeyError): + ok = False + lines.append("tools/season_blind_test.json is missing or unreadable") + if ok: + lines.append(f"check passed: {checked} estimated seasons are still on the track or location " + "they were estimated for") + return ok, lines + + +def cmd_trial(args): + for name, fetch_fn in season_climate.CANDIDATES.items(): + fetch = _with_cache(fetch_fn, args.cache) + print(f"{name}: trail (sourced months) gives estimated months, grade") + data = within = 0 + for tid in TRIAL_TRAILS: + rec = refresh.load_toml(os.path.join(ROOT, tid, "trail.toml")) + sourced = list((rec.get("hike") or {}).get("months") or []) + points, _kind = sample_points(ROOT, rec) + try: + normals = normals_at(points, fetch) + except Exception as exc: + print(f" {tid} ({sourced}): error {type(exc).__name__}: {exc}") + continue + months = months_in_season(normals, COARSE_PARAMS) if points else None + if normals and all(n is not None for n in normals): + data += 1 + grade = season.grade(months, sourced) if months else "no-month" + within += grade in ("exact", "within1") + print(f" {tid} ({sourced}): {months}, {grade}") + else: + print(f" {tid} ({sourced}): no data") + print(f" data for {data} of {len(TRIAL_TRAILS)}, " + f"exact or within one month for {within}") + return 0 + + +def all_sample_points(root): + """Every sample point for every record, as (id, kind, points).""" + out = [] + for tid, rec in _records(root): + points, kind = sample_points(root, rec) + out.append((tid, kind, points)) + return out + + +def cmd_warm(args): + """Read the climate for every sample point of every trail into the + cache, several points at a time. Safe to stop and rerun.""" + from concurrent.futures import ThreadPoolExecutor + fetch = _fetch_with_cache(args.cache) + jobs = [] + seen = set() + for _tid, _kind, points in all_sample_points(ROOT): + for p in points: + key = (round(p.lat, 3), round(p.lon, 3), + None if p.elev_m is None else int(round(p.elev_m))) + if key not in seen: + seen.add(key) + jobs.append(p) + print(f"{len(jobs)} distinct points", flush=True) + done = [0] + nodata = [0] + + def one(p): + n = fetch(p.lat, p.lon, p.elev_m) + done[0] += 1 + if n is None: + nodata[0] += 1 + if done[0] % 25 == 0 or done[0] == len(jobs): + print(f"{done[0]}/{len(jobs)} done, {nodata[0]} without data", + flush=True) + + with ThreadPoolExecutor(max_workers=args.workers) as pool: + list(pool.map(one, jobs)) + print("warm finished", flush=True) + return 0 + + +def cmd_propose(args): + fetch = _fetch_with_cache(args.cache) + propose(ROOT, load_params(ROOT), fetch, args.dir) + return 0 + + +def cmd_estimates(args): + for tid in estimates(ROOT): + print(tid) + return 0 + + +def cmd_check(args): + ok, lines = check(ROOT) + for line in lines: + print(line) + return 0 if ok else 1 + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__) + sub = parser.add_subparsers(dest="command", required=True) + fit_parser = sub.add_parser( + "fit", help="fit the rule against the sourced seasons") + fit_parser.add_argument("--cache", default=None, + help="climate cache directory") + fit_parser.set_defaults(func=cmd_fit) + trial_parser = sub.add_parser( + "trial", help="compare the climate candidates on twelve trails") + trial_parser.add_argument("--cache", default=None, + help="climate cache directory") + trial_parser.set_defaults(func=cmd_trial) + warm_parser = sub.add_parser( + "warm", help="read the climate for every sample point into the cache") + warm_parser.add_argument("--cache", default=None, + help="climate cache directory") + warm_parser.add_argument("--workers", type=int, default=6) + warm_parser.set_defaults(func=cmd_warm) + propose_parser = sub.add_parser( + "propose", help="write the estimate review list") + propose_parser.add_argument("--dir", default=None, + help="staging directory") + propose_parser.add_argument("--cache", default=None, + help="climate cache directory") + propose_parser.set_defaults(func=cmd_propose) + estimates_parser = sub.add_parser( + "estimates", help="list the trails whose season is an estimate") + estimates_parser.set_defaults(func=cmd_estimates) + check_parser = sub.add_parser( + "check", help="offline: compare each estimate's recorded inputs with the trail's " + "current track and location, and check the blind test") + check_parser.set_defaults(func=cmd_check) + argv = ["check" if a == "--check" else a + for a in (sys.argv[1:] if argv is None else argv)] + args = parser.parse_args(argv) + return args.func(args) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/season.py b/tools/season.py index 574c083..a36b4ac 100644 --- a/tools/season.py +++ b/tools/season.py @@ -4,9 +4,41 @@ Python 3 standard library only. tools/validate.py imports this module; it must not import validate.py. The fields are documented in docs/schema.md. """ +import re +import urllib.parse + BASES = ("primary", "sources", "source", "estimate") PROVENANCE_KEYS = frozenset({"season_basis", "season_method"}) -SEASON_REQUIRED = False +SEASON_REQUIRED = True +# The host of the climate data an estimate cites (tools/season_climate.SOURCE). +CLIMATE_HOSTS = frozenset({"www.chelsa-climate.org"}) +CONFIDENCES = ("high", "medium", "low") +_CONFIDENCE_END = re.compile(r"Confidence: (high|medium|low)\.\s*$") + + +def _is_climate(source): + host = urllib.parse.urlparse(str(source.get("url", ""))).hostname + return host in CLIMATE_HOSTS + + +def confidence_of(method): + """"high", "medium" or "low" from the end of a season_method, else "".""" + found = _CONFIDENCE_END.search(str(method or "")) + return found.group(1) if found else "" + + +def read_from_a_page(hike): + """True when a page states the season: one is present, its basis is not + "estimate", and no method records that it was worked out by judgement + (the seasons set from pages that disagree carry one).""" + return bool(hike.get("season")) and hike.get("season_basis") in ( + "primary", "sources", "source") and not hike.get("season_method") + + +def check_present(tid, rec, errors): + """Every record has a hike table (check_season then requires its season).""" + if not isinstance(rec.get("hike"), dict): + errors.append(f"{tid}: hike.season is required") def _naming(sources, fact): @@ -51,10 +83,26 @@ def check_season(tid, hike, errors): errors.append(f"{tid}: hike.season_method must not be empty") elif len(method) >= 400: errors.append(f"{tid}: hike.season_method must be under 400 characters") + elif not _CONFIDENCE_END.search(method): + errors.append( + f"{tid}: hike.season_method must end with " + "\"Confidence: high.\", \"Confidence: medium.\" or \"Confidence: low.\"") elif basis == "estimate": errors.append(f"{tid}: hike.season_method is required with season_basis \"estimate\"") + if basis == "estimate" and has_months and isinstance(hike.get("months"), list): + try: + if hike.get("season") != phrase_for(hike["months"]): + errors.append(f"{tid}: the season phrase of an estimate must be built from its " + f"months: {phrase_for(hike['months'])!r}") + except (ValueError, TypeError): + errors.append(f"{tid}: hike.months must be month numbers 1 to 12") + naming_season = _naming(sources, "season") + if basis != "estimate" and any(_is_climate(x) for x in naming_season): + errors.append( + f"{tid}: a source naming season may not cite climate data unless " + "hike.season_basis is \"estimate\"") if basis in ("primary", "source"): if not naming_season: errors.append( @@ -69,13 +117,137 @@ def check_season(tid, hike, errors): elif basis == "sources": publishers = {str(s.get("publisher", "")).strip().casefold() for s in naming_season if str(s.get("publisher", "")).strip()} - if len(publishers) < 2: + if not naming_season: errors.append( - f"{tid}: hike.season_basis \"sources\" needs two sources from different " - "publishers naming season") + f"{tid}: hike.season_basis \"sources\" needs a [[hike.source]] naming season") + elif len(publishers) < 2: + errors.append( + f"{tid}: hike.season_basis \"sources\" needs pages from at least two different " + "publishers naming season" + (", also when the season is set by judgement from pages that " + "differ (a page or two from one publisher is an estimate)" + if has_method else "")) elif basis == "estimate": - naming = {id(s) for s in _naming(sources, "season") + _naming(sources, "months")} + naming = {id(x): x for x in _naming(sources, "season") + _naming(sources, "months")} if len(naming) != 1: errors.append( f"{tid}: hike.season_basis \"estimate\" needs exactly one source naming " - "season or months") + "season or months, and it must cite the climate data (no page states a season)") + else: + only = next(iter(naming.values())) + facts = only.get("facts") or [] + if not _is_climate(only): + errors.append( + f"{tid}: hike.season_basis \"estimate\" needs its source to cite the " + "climate data (CHELSA, with ETOPO); an ordinary page naming the season " + "makes the basis wrong") + if "season" not in facts or "months" not in facts: + errors.append( + f"{tid}: the climate source of an estimate must name both season and months") + + +# --------------------------------------------------------------------------- +# Shared helpers for the checker and the estimator. Months are a set on a +# circle: a season may wrap the year end (November to March), so spans, +# grades and phrases are all circular. + +MONTH_NAMES = ("January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December") + + +def _months(months): + got = sorted({int(m) for m in months}) + if not got or got[0] < 1 or got[-1] > 12: + raise ValueError(f"not a set of months: {months!r}") + return got + + +def span(months): + """The smallest circular arc covering the months, as (first, last). + + December to February is one arc, (12, 2). Two separate windows give the + arc covering both. All twelve months give (1, 12). + """ + got = _months(months) + if len(got) == 1: + return (got[0], got[0]) + best_gap, first = -1, got[0] + for i, month in enumerate(got): + nxt = got[(i + 1) % len(got)] + gap = (nxt - month) % 12 + if gap == 0: + gap = 12 + # The arc starts after the largest gap. Ties go to the gap whose + # following month is smallest, so all twelve months give (1, 12). + if gap > best_gap or (gap == best_gap and nxt < first): + best_gap, first = gap, nxt + i = got.index(first) + return (first, got[i - 1]) + + +def _circ_distance(a, b): + d = abs(a - b) + return min(d, 12 - d) + + +def grade(estimated, sourced): + """How well an estimated season matches a sourced one. + + "exact" when the arcs have the same first and last month, "within1" + when each end is within one month (counted on the circle), else "worse". + """ + if not estimated or not sourced: + return "worse" + est_first, est_last = span(estimated) + src_first, src_last = span(sourced) + if (est_first, est_last) == (src_first, src_last): + return "exact" + if (_circ_distance(est_first, src_first) <= 1 + and _circ_distance(est_last, src_last) <= 1): + return "within1" + return "worse" + + +def phrase_for(months): + """The plain season phrase built from months, for an estimate. + + One run reads "June to September", a run over the year end reads + "November to March", separate runs are joined with "and", one month + reads "July" and twelve read "All year". Separate runs come in calendar + order, so spring and fall read "March to May and October to November". + """ + got = _months(months) + if len(got) == 12: + return "All year" + runs = [] + start = prev = got[0] + for month in got[1:]: + if month == prev + 1: + prev = month + else: + runs.append((start, prev)) + start = prev = month + runs.append((start, prev)) + if len(runs) > 1 and runs[0][0] == 1 and runs[-1][1] == 12: + runs = [(runs[-1][0], runs[0][1])] + runs[1:-1] + # calendar order, except that a run over the year end comes first + runs.sort(key=lambda run: (run[0] <= run[1], run[0])) + + def words(run): + a, b = run + if a == b: + return MONTH_NAMES[a - 1] + return f"{MONTH_NAMES[a - 1]} to {MONTH_NAMES[b - 1]}" + + return " and ".join(words(run) for run in runs) + + +def method_sentence(dataset, period, n_points, kind, rule_version): + """The one fixed sentence an estimated season carries as its method.""" + where = { + "track": "along the track", + "ends": "at the trail ends", + "place": "at the place centre", + }.get(kind, kind) + noun = "point" if n_points == 1 else "points" + return (f"Estimated from {dataset} monthly climate ({period}) at " + f"{n_points} {noun} {where}; rule version {rule_version}.") diff --git a/tools/season_blind_test.json b/tools/season_blind_test.json new file mode 100644 index 0000000..680a7d5 --- /dev/null +++ b/tools/season_blind_test.json @@ -0,0 +1,33 @@ +{ + "date": "2026-11-20", + "measure": "the first and last months of the reviewer's season within a month of the season a page states", + "strict_measure": "the ends as above, and every window of the season (such as a gap in the middle) also within a month of the page's, with no window added or missing", + "tested": 148, + "matched": 114, + "share": 0.77, + "strict_matched": 105, + "strict_share": 0.71, + "by_confidence": { + "high": { + "tested": 52, + "matched": 48, + "share": 0.92, + "strict_matched": 48, + "strict_share": 0.92 + }, + "medium": { + "tested": 76, + "matched": 55, + "share": 0.72, + "strict_matched": 46, + "strict_share": 0.61 + }, + "low": { + "tested": 20, + "matched": 11, + "share": 0.55, + "strict_matched": 11, + "strict_share": 0.55 + } + } +} diff --git a/tools/season_climate.py b/tools/season_climate.py new file mode 100644 index 0000000..35f1104 --- /dev/null +++ b/tools/season_climate.py @@ -0,0 +1,455 @@ +"""Monthly climate normals for a point, read from bulk gridded files. + +Python 3 standard library only. The estimator (tools/estimate_season.py) +asks this module for the normals at a trail's sample points. The grids +are large public files read in place: only the 512 pixel tiles that +cover a point are fetched (HTTP range requests), each tile is cached +outside the repository once, and the values for a point are cached as +one small file. There is no rate limit to wait out; a tile is never +fetched twice, and an interrupted run resumes from the cache. + +Source chosen +============= +CHELSA V2.1 climatologies (monthly mean daily maximum near-surface air +temperature, 1981-2010, about 1 km, global land), from WSL, with the +elevation of the grid cell taken from NOAA's ETOPO 2022 relief model +(60 arc second, unrestricted version). The temperature at a trail's own +elevation is the cell's value plus a lapse rate of 6.5 C per km times +the cell's elevation minus the trail's. The source carries no snow +variable, so snow-free months are derived from the temperature at the +trail's high ground (the rule's cold limit stands in for snow) and the +estimate says so. + +Why the first choice was dropped. The previous choice was ERA5-Land +served by the Open-Meteo Historical Weather API. Its free tier +allows 5000 weighted units an hour, and one point-year of daily data +for two variables costs about 5 units, so a thirty year normal for the +roughly 900 sample points needs about 139000 units (some 28 hours) and +ten years about 9 hours; only three years fit in about three hours, and +three years is too short to call a normal. Its terms also limit the +free tier to non-commercial use. A bulk grid read locally has no such +limit. + +Why not the other bulk grids. WorldClim 2.1 (monthly 1970-2000, free +download) states at https://www.worldclim.org/about.html: "The data are +freely available for academic use and other non-commercial use. +Redistribution or commercial use is not allowed without prior +permission." That fails the public domain or open licence test. NOAA +and Environment Canada station normals lack the coverage of both +countries and a value at a trail's elevation (see the earlier trial in +the repository history). + +Licences, read on each publisher's own page (2026-11-20): + +- CHELSA, https://www.chelsa-climate.org/datasets/chelsa_climatologies, + field License: "Creative Commons Zero - No Rights Reserved (CC0 1.0)". + The same page asks for the citation: Karger, D. N., Conrad, O., + Boehner, J., Kawohl, T., Kreft, H., Soria-Auza, R. W., Zimmermann, + N. E., Linder, H. P., Kessler, M. (2017). Climatologies at high + resolution for the earth's land surface areas. Scientific Data 4, + 170122. https://doi.org/10.1038/sdata.2017.122. It is credited in + NOTICE.md although CC0 does not require it. +- ETOPO 2022, https://www.ncei.noaa.gov/products/etopo-global-relief-model: + the Unrestricted version is described as "Full global coverage, no + copyright or security distribution restrictions". NOAA NCEI, DOI + 10.25921/fd45-gt74. + +Reading the files. Both are tiled GeoTIFFs. CHELSA's tiles are LZW with a +horizontal predictor, 16 bit unsigned, value times 0.1 in kelvin; ETOPO's +are deflate with the floating point predictor. The small readers below +handle exactly those two layouts and refuse anything else, so no library +is needed in CI or in `web/`. +""" +import sys + +sys.dont_write_bytecode = True + +import array +import hashlib +import json +import math +import os +import re +import struct +import tempfile +import threading +import time +import urllib.error +import urllib.request +import zlib +from dataclasses import dataclass + +CACHE_DIR = os.environ.get("LONGHIKES_CLIMATE_CACHE") or os.path.join( + os.path.expanduser("~"), ".cache", "longhikes-climate") + +SOURCE = { + "name": "CHELSA V2.1 climatologies, with ETOPO 2022 elevation", + "publisher": "WSL (CHELSA) and NOAA NCEI (ETOPO)", + "url": "https://www.chelsa-climate.org/datasets/chelsa_climatologies", + "licence": "CC0 1.0 (CHELSA); NOAA ETOPO 2022 unrestricted", + "period": "1981-2010", +} + +CHELSA_URL = ("https://os.unil.cloud.switch.ch/chelsa02/chelsa/global/" + "climatologies/tasmax/1981-2010/" + "CHELSA_tasmax_{month:02d}_1981-2010_V.2.1.tif") +ETOPO_URL = ("https://www.ngdc.noaa.gov/mgg/global/relief/ETOPO2022/data/" + "60s/60s_surface_elev_gtif/" + "ETOPO_2022_v1_60s_N90W180_surface.tif") + +USER_AGENT = "Mozilla/5.0" +LAPSE_C_PER_KM = 6.5 +HEADER_BYTES = 65536 +SEARCH_RADIUS = 3 # cells to look for land when the nearest cell is sea + +_LOCK = threading.RLock() + + +@dataclass(frozen=True) +class PointNormals: + """Monthly normals at one point: twelve mean daily highs in degrees + C and, when the source has one, twelve mean snow depths in cm.""" + + lat: float + lon: float + elev_m: float + tmax_c: tuple + snow_cm: tuple = None + + +def haversine_km(lat1, lon1, lat2, lon2): + radius = 6371.0088 + p1, p2 = math.radians(lat1), math.radians(lat2) + dphi = math.radians(lat2 - lat1) + dlmb = math.radians(lon2 - lon1) + h = math.sin(dphi / 2) ** 2 + math.cos(p1) * math.cos(p2) * math.sin(dlmb / 2) ** 2 + return 2 * radius * math.asin(math.sqrt(h)) + + +# --------------------------------------------------------------------------- +# Range reads, cached on disk. + +def default_getter(url, start, end): + req = urllib.request.Request(url, headers={ + "User-Agent": USER_AGENT, "Range": f"bytes={start}-{end}"}) + last = None + for attempt in range(6): + try: + with urllib.request.urlopen(req, timeout=120) as resp: + return resp.read() + except (urllib.error.URLError, OSError) as exc: + last = exc + if isinstance(exc, urllib.error.HTTPError) and exc.code in (403, 404): + raise + time.sleep(2 * (attempt + 1)) + raise last + + +class Source: + """One tiled GeoTIFF read by range requests.""" + + def __init__(self, url, cache=CACHE_DIR, getter=default_getter): + self.url = url + self.cache = os.path.join(cache, "tiles") + self.getter = getter + self._tiles = {} + self._ready = False + + # -- cached ranges + def _range(self, start, end): + key = hashlib.sha256(f"{self.url}|{start}|{end}".encode()).hexdigest()[:40] + path = os.path.join(self.cache, key[:2], key + ".bin") + if os.path.exists(path): + with open(path, "rb") as f: + return f.read() + raw = self.getter(self.url, start, end) + if len(raw) != end - start + 1 and start != 0: + raise OSError(f"short read {len(raw)} of {end - start + 1} at {start}") + os.makedirs(os.path.dirname(path), exist_ok=True) + fd, tmp = tempfile.mkstemp(dir=os.path.dirname(path)) + with os.fdopen(fd, "wb") as f: + f.write(raw) + os.replace(tmp, path) + return raw + + # -- header + def _load(self): + with _LOCK: + if self._ready: + return + head = self._range(0, HEADER_BYTES - 1) + if head[:4] != b"II*\x00": + raise ValueError("not a little-endian classic TIFF: " + self.url) + off = struct.unpack("]*>([^<]+)<', meta) + self.scale = float(m.group(1)) if m else 1.0 + m = re.search(r'name="OFFSET"[^>]*>([^<]+)<', meta) + self.offset = float(m.group(1)) if m else 0.0 + nd = tags.get(42113) + self.nodata = float(nd) if nd not in (None, "") else None + self.tiles_across = (self.width + self.tw - 1) // self.tw + if self.compression not in (5, 8): + raise ValueError("unsupported compression %d" % self.compression) + self._ready = True + + # -- tile decoding + def _decode(self, idx): + with _LOCK: + got = self._tiles.get(idx) + if got is not None: + return got + raw = self._range(self.offsets[idx], self.offsets[idx] + self.counts[idx] - 1) + data = lzw_decode(raw) if self.compression == 5 else zlib.decompress(raw) + tile = self._to_values(data) + with _LOCK: + if len(self._tiles) > 24: + self._tiles.clear() + self._tiles[idx] = tile + return tile + + def _to_values(self, data): + w, h = self.tw, self.th + if self.sampleformat == 3 and self.bits == 32 and self.predictor == 3: + out = array.array("f") + for r in range(h): + row = bytearray(data[r * w * 4:(r + 1) * w * 4]) + acc = 0 + for i in range(len(row)): + acc = (acc + row[i]) & 255 + row[i] = acc + be = bytearray(w * 4) + for k in range(4): + be[k::4] = row[k * w:(k + 1) * w] + out.extend(struct.unpack(">%df" % w, bytes(be))) + return out + if self.bits == 16 and self.sampleformat in (1, 2): + code = "H" if self.sampleformat == 1 else "h" + out = array.array(code) + out.frombytes(data[: w * h * 2]) + if sys.byteorder != "little": + out.byteswap() + if self.predictor == 2: + for r in range(h): + acc = 0 + base = r * w + for i in range(w): + acc = (acc + out[base + i]) & 0xFFFF + out[base + i] = acc + elif self.predictor != 1: + raise ValueError("unsupported predictor") + return out + raise ValueError("unsupported sample layout") + + # -- pixels + def pixel(self, col, row): + """Raw value at an integer cell, or None for outside or nodata.""" + self._load() + if row < 0 or row >= self.height: + return None + col %= self.width + idx = (row // self.th) * self.tiles_across + col // self.tw + tile = self._decode(idx) + v = tile[(row % self.th) * self.tw + (col % self.tw)] + if self.nodata is not None and v == self.nodata: + return None + return v + + def value_nearest(self, lon, lat): + """Scaled value of the nearest cell that has data, searching a + few cells outward when the nearest is sea; None if none.""" + self._load() + col = int(math.floor((lon - self.x0) / self.xres + 0.5)) + row = int(math.floor((self.y0 - lat) / self.yres + 0.5)) + for radius in range(SEARCH_RADIUS + 1): + best = None + for dr in range(-radius, radius + 1): + for dc in range(-radius, radius + 1): + if max(abs(dr), abs(dc)) != radius: + continue + v = self.pixel(col + dc, row + dr) + if v is None: + continue + d = dr * dr + dc * dc + if best is None or d < best[0]: + best = (d, v) + if best is not None: + return best[1] * self.scale + self.offset + return None + + def value_bilinear(self, lon, lat): + self._load() + fx = (lon - self.x0) / self.xres + fy = (self.y0 - lat) / self.yres + c0, r0 = int(math.floor(fx)), int(math.floor(fy)) + tx, ty = fx - c0, fy - r0 + total = weight = 0.0 + for dr, wy in ((0, 1 - ty), (1, ty)): + for dc, wx in ((0, 1 - tx), (1, tx)): + v = self.pixel(c0 + dc, r0 + dr) + if v is None: + continue + total += v * wx * wy + weight += wx * wy + if weight <= 0: + return None + return (total / weight) * self.scale + self.offset + + +def lzw_decode(data): + """TIFF LZW (MSB first, early change).""" + out = [] + base = [bytes([i]) for i in range(256)] + [b"", b""] + table = list(base) + bits = 9 + buf = nb = pos = 0 + n = len(data) + prev = None + while True: + while nb < bits: + if pos >= n: + return b"".join(out) + buf = (buf << 8) | data[pos] + pos += 1 + nb += 8 + code = (buf >> (nb - bits)) & ((1 << bits) - 1) + nb -= bits + buf &= (1 << nb) - 1 + if code == 257: + break + if code == 256: + table = list(base) + bits = 9 + prev = None + continue + if prev is None: + entry = table[code] + elif code < len(table): + entry = table[code] + table.append(prev + entry[:1]) + else: + entry = prev + prev[:1] + table.append(entry) + out.append(entry) + prev = entry + ln = len(table) + bits = 12 if ln >= 2047 else 11 if ln >= 1023 else 10 if ln >= 511 else 9 + return b"".join(out) + + +# --------------------------------------------------------------------------- +# Normals for a point. + +_SOURCES = {} + + +def _sources(cache, getter): + key = (cache, id(getter)) + with _LOCK: + if key not in _SOURCES: + _SOURCES[key] = ( + [Source(CHELSA_URL.format(month=m), cache, getter) for m in range(1, 13)], + Source(ETOPO_URL, cache, getter)) + return _SOURCES[key] + + +def _cache_path(cache, lat, lon, elev_m): + elev_key = "cell" if elev_m is None else str(int(round(elev_m))) + return os.path.join(cache, "points", f"chelsa_{lat:.3f}_{lon:.3f}_{elev_key}.json") + + +def _read_cache(path): + """(True, normals or None) when cached, else (False, None). A cached + None means the source had no data for the point.""" + if not os.path.exists(path): + return False, None + with open(path, encoding="utf-8") as f: + doc = json.load(f) + if doc.get("no_data"): + return True, None + snow = doc.get("snow_cm") + return True, PointNormals( + lat=float(doc["lat"]), lon=float(doc["lon"]), elev_m=float(doc["elev_m"]), + tmax_c=tuple(float(v) for v in doc["tmax_c"]), + snow_cm=None if snow is None else tuple(float(v) for v in snow)) + + +def _write_cache(path, normals): + os.makedirs(os.path.dirname(path), exist_ok=True) + if normals is None: + doc = {"no_data": True} + else: + doc = {"lat": normals.lat, "lon": normals.lon, "elev_m": normals.elev_m, + "tmax_c": list(normals.tmax_c), + "snow_cm": None if normals.snow_cm is None else list(normals.snow_cm)} + fd, tmp = tempfile.mkstemp(dir=os.path.dirname(path)) + with os.fdopen(fd, "w", encoding="utf-8") as f: + json.dump(doc, f, sort_keys=True) + f.write("\n") + os.replace(tmp, path) + + +def fetch_normals(lat, lon, elev_m, cache=CACHE_DIR, opener=None, getter=None): + """Normals at the point, at elev_m (the grid cell's own elevation + when None), or None when the grid has no land value there. Never + returns invented zeros. `getter(url, start, end)` replaces the + network for tests; `opener` is accepted and ignored.""" + lat, lon = round(float(lat), 3), round(float(lon), 3) + path = _cache_path(cache, lat, lon, elev_m) + found, normals = _read_cache(path) + if found: + return normals + months, dem = _sources(cache, getter or default_getter) + cell_elev = dem.value_bilinear(lon, lat) + values = [] + for src in months: + v = src.value_nearest(lon, lat) + if v is None: + values = None + break + values.append(v - 273.15) + if values is None or cell_elev is None: + normals = None + else: + use = cell_elev if elev_m is None else float(elev_m) + shift = LAPSE_C_PER_KM * (cell_elev - use) / 1000.0 + normals = PointNormals( + lat=lat, lon=lon, elev_m=use, + tmax_c=tuple(round(v + shift, 1) for v in values), snow_cm=None) + _write_cache(path, normals) + return normals + + +CANDIDATES = {"chelsa": fetch_normals} diff --git a/tools/season_fit.json b/tools/season_fit.json new file mode 100644 index 0000000..919dbc6 --- /dev/null +++ b/tools/season_fit.json @@ -0,0 +1,142 @@ +{ + "bar": { + "coverage_min": 0.9, + "within1_min": 0.75 + }, + "computed": "2026-11-20", + "confidence": { + "close": 0.3, + "decisive": 0.6, + "high_matched": 0.868, + "high_n": 38, + "low_matched": 0.609 + }, + "dataset": "CHELSA V2.1 climatologies, with ETOPO 2022 elevation", + "loo": { + "by_group": { + "Canada east and north": { + "classified": 0.7685, + "jaccard": 0.5546, + "n": 9, + "no_data": 0, + "within1": 5, + "worse": 4 + }, + "Canada west": { + "classified": 0.8512, + "jaccard": 0.6607, + "n": 14, + "no_data": 0, + "within1": 12, + "worse": 2 + }, + "Rockies": { + "classified": 0.8913, + "jaccard": 0.6832, + "n": 23, + "no_data": 0, + "within1": 20, + "worse": 3 + }, + "interior west": { + "classified": 0.7153, + "jaccard": 0.3855, + "n": 12, + "no_data": 0, + "within1": 6, + "worse": 6 + }, + "northeast": { + "classified": 0.7556, + "jaccard": 0.6198, + "n": 15, + "no_data": 0, + "within1": 12, + "worse": 3 + }, + "plains and midwest": { + "classified": 0.6458, + "jaccard": 0.4722, + "n": 8, + "no_data": 0, + "within1": 3, + "worse": 5 + }, + "southeast": { + "classified": 0.6667, + "jaccard": 0.4973, + "n": 13, + "no_data": 0, + "within1": 8, + "worse": 5 + }, + "southwest": { + "classified": 0.6932, + "jaccard": 0.4759, + "n": 22, + "no_data": 0, + "within1": 11, + "worse": 11 + }, + "west coast": { + "classified": 0.7995, + "jaccard": 0.5687, + "n": 32, + "no_data": 0, + "within1": 23, + "worse": 9 + } + }, + "by_kind": { + "alpine": { + "classified": 0.8689, + "jaccard": 0.6547, + "n": 82, + "no_data": 0, + "within1": 67, + "worse": 15 + }, + "cool-season": { + "classified": 0.7292, + "jaccard": 0.4613, + "n": 40, + "no_data": 0, + "within1": 22, + "worse": 18 + }, + "other": { + "classified": 0.5926, + "jaccard": 0.4345, + "n": 18, + "no_data": 0, + "within1": 11, + "worse": 7 + }, + "year-round": { + "classified": 0.3542, + "jaccard": 0.3542, + "n": 8, + "no_data": 0, + "within1": 0, + "worse": 8 + } + }, + "classified": 0.7697, + "jaccard": 0.5594, + "n": 148, + "no_data": 0, + "within1": 100, + "worse": 48 + }, + "params": { + "cold_c_min": 12.0, + "cut": 0.65, + "heat_c_max": 25.0, + "k": 20, + "mix": 0.7, + "power": 1 + }, + "passes": false, + "period": "1981-2010", + "rule_version": 2 +} diff --git a/tools/season_inputs.json b/tools/season_inputs.json new file mode 100644 index 0000000..fcd10e8 --- /dev/null +++ b/tools/season_inputs.json @@ -0,0 +1,699 @@ +{ + "across-utah-route": { + "digest": "1582bd31f8f00ced", + "machine": [ + 5, + 6, + 9, + 10 + ], + "points": "5b3280ac815e9040" + }, + "alpine-trail-7": { + "digest": "efd5e277fbf3b6c1", + "machine": [ + 7, + 8, + 9 + ], + "points": "66d1a158cf32328a" + }, + "avon": { + "digest": "a9120a59a9a1907d", + "machine": [ + 4, + 5, + 6, + 8, + 9, + 10 + ], + "points": "a133f33fe3b019f9" + }, + "batona": { + "digest": "3dbdb3e8b17d2b98", + "machine": [ + 4, + 5, + 9, + 10, + 11 + ], + "points": "560955c481df42f5" + }, + "bay-circuit": { + "digest": "bdb128943b1900ae", + "machine": [ + 4, + 5, + 6, + 8, + 9, + 10 + ], + "points": "90eafebf6ec4f76a" + }, + "bayou-state-trail": { + "digest": "c7c4147060628fa7", + "machine": [ + 1, + 2, + 3, + 4, + 11, + 12 + ], + "points": "a8467e9a59501dd8" + }, + "boundary-trail-mount-st-helens": { + "digest": "01312d045fd17c20", + "machine": [ + 7, + 8, + 9 + ], + "points": "f54416dc9b67f3a3" + }, + "boundary-trail-pasayten": { + "digest": "e97c07b0f68a15a9", + "machine": [ + 7, + 8, + 9 + ], + "points": "d95317240cb4b500" + }, + "bristol-hills-trail": { + "digest": "a5fa7af7ebab8d67", + "machine": [ + 5, + 6, + 7, + 8, + 9, + 10 + ], + "points": "7a56b636555fa553" + }, + "brooks-range-traverse": { + "digest": "8a3c5ef0f30bc7f8", + "machine": [ + 8 + ], + "points": "3e4bc0ab7ded98aa" + }, + "bruce-trail": { + "digest": "ed62c99709c54267", + "machine": [ + 7, + 8, + 9, + 10 + ], + "points": "e6e985acbfb0c18a" + }, + "california-coastal": { + "digest": "5c7fa4913f78b36c", + "machine": [ + 5, + 7, + 8, + 9, + 10 + ], + "points": "46d88fdd32b7c0c8" + }, + "conestoga-trail": { + "digest": "31f1d48bf322e3a7", + "machine": [ + 4, + 5, + 9, + 10 + ], + "points": "8b710f69e6901943" + }, + "conservation-trail": { + "digest": "21bfcf5403bcbfdf", + "machine": [ + 5, + 6, + 8, + 9, + 10 + ], + "points": "2ef8a2830d82f390" + }, + "cranberry-lake-50": { + "digest": "87772fc46ebb73ca", + "machine": [ + 7, + 8, + 9 + ], + "points": "61231407b018812f" + }, + "cross-vermont": { + "digest": "de8f9f0acea8bd21", + "machine": [ + 5, + 6, + 9, + 10 + ], + "points": "0cad6fec0d9afc44" + }, + "deseret-hiking-route": { + "digest": "191f5e4f5cc698cb", + "machine": [ + 3, + 4, + 5, + 10, + 11 + ], + "points": "6079d15e9d183d7f" + }, + "desert-trail": { + "digest": "132108d83a002b0d", + "machine": [ + 7, + 8, + 9, + 10 + ], + "points": "aa33dec22b7500b8" + }, + "donut-hole": { + "digest": "dcc41463939e95a7", + "machine": [ + 4, + 5, + 6, + 9, + 10 + ], + "points": "284c0ef8512572a6" + }, + "eastern-continental-trail": { + "digest": "d40390952a719154", + "machine": [ + 5, + 7, + 8, + 9, + 10 + ], + "points": "a6e0ee1c73858dcb" + }, + "eastern-sierra-high-route": { + "digest": "34c0558ddeedd3f2", + "machine": [ + 7, + 8, + 9 + ], + "points": "55b8981509ad0893" + }, + "finger-lakes": { + "points": "338c0f525d32224b" + }, + "ganaraska": { + "digest": "b414a50c65a31b82", + "machine": [ + 5, + 6, + 7, + 8, + 9, + 10 + ], + "points": "2bdcc55e79a5f683" + }, + "general-george-crook": { + "digest": "f2896d5fe13e417f", + "machine": [ + 4, + 5, + 9, + 10 + ], + "points": "64014e2e7644af9c" + }, + "georgia-loop": { + "digest": "35f1d5133569d0c0", + "machine": [ + 1, + 2, + 3, + 4, + 10, + 11, + 12 + ], + "points": "441770b746069082" + }, + "gila-centennial-loop": { + "digest": "08f4ed745b5d2560", + "machine": [ + 3, + 4, + 5, + 9, + 10, + 11 + ], + "points": "1bde178eb296427c" + }, + "grand-valley-trail": { + "digest": "5f4505a160f8f245", + "machine": [ + 5, + 6, + 9, + 10 + ], + "points": "8d3f4d42f8553ba0" + }, + "great-eastern": { + "digest": "b77ec5d870bbcc88", + "machine": [ + 4, + 5, + 10 + ], + "points": "f75851e040957980" + }, + "great-western-divide-loop": { + "digest": "dd7b6f503f72081b", + "machine": [ + 7, + 8, + 9, + 10 + ], + "points": "64bab16e50d60757" + }, + "high-country-pathway": { + "digest": "b59fdbbf3b1ac6f8", + "machine": [ + 5, + 6, + 8, + 9, + 10 + ], + "points": "0ea28ef5b9723b8d" + }, + "highlands": { + "digest": "8212eeadd24218c3", + "machine": [ + 4, + 5, + 9, + 10 + ], + "points": "28d7e27072f8cc8b" + }, + "hoosier-heritage-trail": { + "digest": "f550667eab910362", + "machine": [ + 3, + 4, + 5, + 10, + 11 + ], + "points": "27fe12298613e61c" + }, + "horse-shoe": { + "digest": "aeff26cf6c7e0143", + "machine": [ + 4, + 5, + 9, + 10 + ], + "points": "ffe09d582ca7a623" + }, + "hot-springs-trail": { + "digest": "fc73ad4cf711d615", + "machine": [ + 2, + 3, + 4, + 5, + 10, + 11 + ], + "points": "f64b708fe0a66d2a" + }, + "iat-newfoundland-labrador": { + "digest": "91eadce2b4ef4c7f", + "machine": [ + 7, + 8, + 9 + ], + "points": "658a452a468fffd1" + }, + "ice-age": { + "points": "6123e99c6a3082fe" + }, + "international-appalachian-trail-maine": { + "digest": "8f488d4dc2b03636", + "machine": [ + 7, + 8, + 9 + ], + "points": "4cac64a291020a9a" + }, + "koroc-palmer-loop": { + "digest": "e18e82c08b6dfd5d", + "machine": [ + 8 + ], + "points": "84ce0d6f0fd7b454" + }, + "la-cloche": { + "digest": "61ce29ac5892d1b8", + "machine": [ + 7, + 8, + 9 + ], + "points": "32195bb88992a86c" + }, + "lost-coast": { + "digest": "971c47b8714b706f", + "machine": [ + 5, + 7, + 8, + 9, + 10 + ], + "points": "46726fb00eebd4cf" + }, + "loyalsock": { + "digest": "7e8067a31ec5da6c", + "machine": [ + 4, + 5, + 6, + 9, + 10 + ], + "points": "589a23f3e8bf86e0" + }, + "mason-dixon": { + "digest": "54cad0c500a1e861", + "machine": [ + 4, + 5, + 9, + 10 + ], + "points": "b67b7d3e33ed925f" + }, + "midland-to-mackinac-trail": { + "digest": "c5ed1765cac4534f", + "machine": [ + 7, + 8, + 9 + ], + "points": "3df8a157582012ce" + }, + "midstate-ma": { + "digest": "edc133c6ae5007c7", + "machine": [ + 5, + 6, + 9, + 10 + ], + "points": "99a2fcf36b45e796" + }, + "north-south": { + "digest": "86641545fa67fd0c", + "machine": [ + 4, + 5, + 6, + 9, + 10 + ], + "points": "b0c1b0a0708e708e" + }, + "north-south-lbl": { + "digest": "25b3d5d788753ae6", + "machine": [ + 3, + 4, + 5, + 10, + 11 + ], + "points": "3d0f9ffedba5dd16" + }, + "north-umpqua": { + "digest": "14231792880f7042", + "machine": [ + 5, + 10 + ], + "points": "81a26b35ce4a2b65" + }, + "oak-ridges": { + "digest": "0646d355131c000c", + "machine": [ + 5, + 6, + 8, + 9, + 10 + ], + "points": "ed723136e55593f2" + }, + "ottawa-temiskaming-highland-trail": { + "digest": "77fbbe8137415f41", + "machine": [ + 7, + 8, + 9 + ], + "points": "89d2a7d8f17525e7" + }, + "ozark-trail": { + "points": "48f5b65c51e0a605" + }, + "paumanok-path": { + "digest": "588eea3017f04c4c", + "machine": [ + 7, + 8, + 9, + 10 + ], + "points": "803699c022c3c997" + }, + "pfiffner-traverse": { + "digest": "61965112f0b75445", + "machine": [ + 7, + 8, + 9 + ], + "points": "d3eecf6f0442939d" + }, + "rideau-trail": { + "digest": "55d2219b607959d1", + "machine": [ + 5, + 6, + 8, + 9, + 10 + ], + "points": "7a16758637f5c4fc" + }, + "ring-the-peak": { + "digest": "858d219cc4ecd8f6", + "machine": [ + 7, + 8, + 9 + ], + "points": "f13e0b5aeec19a5c" + }, + "sawtooth-wilderness-high-route": { + "digest": "0f4f2e2bf5e9bc6e", + "machine": [ + 7, + 8, + 9 + ], + "points": "986a243b2dec421d" + }, + "sea-to-sea-route": { + "digest": "eb6dbcb347f7a83d", + "machine": [ + 6, + 9, + 10 + ], + "points": "18927e8fccda17e4" + }, + "shawangunk-ridge-trail": { + "digest": "d3b38e00538fd900", + "machine": [ + 4, + 5, + 6, + 9, + 10 + ], + "points": "6fe7bf6b493b24a4" + }, + "shenipsit-trail": { + "digest": "a713c4e4a679b6fa", + "machine": [ + 4, + 5, + 9, + 10 + ], + "points": "a4533e0f9dfca3b2" + }, + "siskiyou-peaks-trail": { + "digest": "2b4dff26c8e71b80", + "machine": [ + 7, + 8, + 9 + ], + "points": "6ff6148206cdf66b" + }, + "sky-islands-traverse": { + "digest": "eed4f15ecdf6114d", + "machine": [ + 3, + 4, + 5, + 9, + 10, + 11 + ], + "points": "840db2e4fcb1de1c" + }, + "solitude-loop": { + "digest": "c091a7bb7336deb5", + "machine": [ + 7, + 8, + 9 + ], + "points": "3f2a5bcfbaf1ebe2" + }, + "standing-stone": { + "digest": "cdc4f7ed39a2c205", + "machine": [ + 4, + 5, + 9, + 10 + ], + "points": "30d3a7085e711b49" + }, + "stein-valley-traverse": { + "digest": "59cd7e9a35c5c732", + "machine": [ + 6, + 9 + ], + "points": "4bf13dd8bff38e69" + }, + "sunapee-ragged-kearsarge": { + "digest": "f5d7131d547be861", + "machine": [ + 8, + 9 + ], + "points": "401dd7ea1ce18086" + }, + "tahoe-yosemite-trail": { + "digest": "23aa94cfbefd3f86", + "machine": [ + 8, + 9 + ], + "points": "e77f9a0b7900a3d1" + }, + "tuscarora": { + "digest": "606d9fe137a8347d", + "machine": [ + 4, + 5, + 9, + 10 + ], + "points": "9e75f481d596079f" + }, + "vagabond-loop": { + "digest": "33378ec42f73f8d5", + "machine": [ + 4, + 10 + ], + "points": "b56fa26d9315370d" + }, + "warrior-trail": { + "digest": "cecd19f5c7ba6ae4", + "machine": [ + 4, + 5, + 9, + 10 + ], + "points": "a1fa2f53436ddcbd" + }, + "wasatch-traverse": { + "digest": "1582bd31f8f00ced", + "machine": [ + 5, + 6, + 9, + 10 + ], + "points": "5b3280ac815e9040" + }, + "waskahegan": { + "digest": "d7993fbe810051fd", + "machine": [ + 7, + 8, + 9 + ], + "points": "3d85be5f038811c6" + }, + "western-uplands": { + "digest": "464d6cd6bfe3257c", + "machine": [ + 7, + 8, + 9 + ], + "points": "57288e3504dc6d55" + }, + "yosemite-high-route": { + "digest": "eee24b0c39473ab0", + "machine": [ + 7, + 8, + 9 + ], + "points": "10d56319fea3c478" + } +} diff --git a/tools/season_judge.py b/tools/season_judge.py new file mode 100644 index 0000000..df3284b --- /dev/null +++ b/tools/season_judge.py @@ -0,0 +1,682 @@ +#!/usr/bin/env python3 +"""Packets, blind scoring and proposals for seasons set by judgement. + +Python 3 standard library only. Where no page states a season, a reviewer +sets it from a packet: the trail's location, elevation, monthly climate +normals (tools/season_climate.py), the machine estimate of +tools/estimate_season.py and the most similar sourced trails. The method +was tested blind: the same reviewers estimated the trails whose season a +page states, from identical packets with the season hidden. The shares they +matched are in tools/season_blind_test.json, which the site reads, by two +measures that are always given together: the ends only (the first and last +months within a month of the page's) and the strict one (also no wrong gap +or missing window in the middle). +docs/season-judging.md says how a reviewer works. + +Commands: + packets write one packet per trail, and the three part lists + score score reviewers' answer files against the sourced seasons + (prints both measures; --write records them in + tools/season_blind_test.json) + proposals stage the judged seasons for the trails with no season, for + python3 tools/refresh.py collect and apply + inputs record what every estimate rests on (the digest of its track + and location, and the machine estimate), so the monthly check, + which runs offline, can see when a track or location changes + +An answer file is tab separated, one trail a line, no header: id, months +(comma separated, 1 to 12), season phrase, confidence (high, medium or +low) and one sentence saying what sets the season there. +""" +import sys + +sys.dont_write_bytecode = True + +import argparse +import datetime +import json +import os +import random +import re +import statistics + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) + +import estimate_season as E # noqa: E402 +import refresh # noqa: E402 +import season # noqa: E402 +import season_climate as C # noqa: E402 +import season_model as M # noqa: E402 + +ROOT = os.path.dirname(HERE) +BLIND_TEST = os.path.join(ROOT, "tools", "season_blind_test.json") +JUDGED = os.path.join(ROOT, "tools", "season_judged.tsv") +PAGES = os.path.join(ROOT, "tools", "season_judged_pages.json") +INPUTS = os.path.join(ROOT, "tools", "season_inputs.json") + +SEED = 20261120 +PARTS = 3 +NCOMP = 10 +PLACE_WEIGHT = 0.1 # climate-distance units per 1000 km between sample-point centres +KM_PER_MILE = 1.609344 +CONFIDENCES = ("high", "medium", "low") +LEAD = "Judged from the climate at the trail's elevation and from similar trails." +MONTHS = ["January", "February", "March", "April", "May", "June", "July", + "August", "September", "October", "November", "December"] +ABB = [m[:3] for m in MONTHS] + +# --------------------------------------------------------------------------- +# Hiding the season: a packet never carries a sentence that bears on timing. + +_MONTH_RE = re.compile( + r"\b(?:January|February|March|April|May|June|July|August|September|October|November|" + r"December|Jan|Feb|Mar|Apr|Jun|Jul|Aug|Sept?|Oct|Nov|Dec)\b(?!\s+[A-Z])\.?") +_SEASON_RE = re.compile( + r"\b(?:summer|winter|spring|fall|autumn|seasons?|seasonal|year[- ]?round|all[- ]year|" + r"snow[- ]?free|snowmelt|snow[- ]melt|snowpack|monsoons?|best time|time of year|when to go|" + r"(?:warm|warmer|cold|colder|cool|cooler|hot|wet|dry|snowy|shoulder) months?)\b", re.I) +_LEAD_SEASON_RE = re.compile(r"^(?:Summer|Winter|Spring|Fall|Autumn|Seasons?|Seasonal)\b") +_SPLIT = re.compile(r"(?<=[.!?])\s+(?=[A-Z0-9\"'(])") + + +def mentions_season(sentence): + """True when a sentence names a month or a season. A capitalised month + counts unless it starts a name ("May Lake"); a season word counts in + lower case or opening the sentence, so "Summer Lake" does not.""" + sentence = re.sub(r"\bhot springs?\b", "", sentence, flags=re.I) + if _MONTH_RE.search(sentence): + return True + for found in _SEASON_RE.finditer(sentence): + word = found.group(0) + if word[0].islower() or word.lower().startswith(("year", "all", "snow")): + return True + return bool(_LEAD_SEASON_RE.match(sentence)) + + +def clean(text): + """(text without the sentences that bear on timing, those sentences).""" + kept, removed = [], [] + for sentence in _SPLIT.split(str(text or "").strip()): + if not sentence: + continue + (removed if mentions_season(sentence) else kept).append(sentence) + return " ".join(kept), removed + + +def shown(kept, original): + if not original: + return "(not on file)" + return kept or "(none left after removing sentences that mention a season)" + + +# --------------------------------------------------------------------------- +# The blind protocol: trails are split into parts, and a trail's comparable +# trails never come from its own part. + +def split_parts(sourced, others, n=PARTS, seed=SEED): + """Deal the sourced and the other trails separately into n parts, in a + seeded shuffle, so every part holds a share of each.""" + rng = random.Random(seed) + parts = [[] for _ in range(n)] + for group in (sourced, others): + group = list(group) + rng.shuffle(group) + for k, tid in enumerate(group): + parts[k % n].append(tid) + return [sorted(p) for p in parts] + + +def comparables(tid, part_of, sourced_ids, meds, centres, k=NCOMP, place_weight=PLACE_WEIGHT): + """The k sourced trails closest to tid in climate and place, never itself + and never one dealt to its own part.""" + if tid not in meds: + return [] + rows = [] + for other in sourced_ids: + if other == tid or part_of.get(other) == part_of.get(tid) or other not in meds: + continue + d = M.distance(meds[tid], meds[other]) + km = C.haversine_km(*centres[tid], *centres[other]) + rows.append((d + place_weight * km / 1000.0, other)) + rows.sort() + return [other for _score, other in rows[:k]] + + +# --------------------------------------------------------------------------- +# The packet. + +def _ft(metres): + return int(round(metres * 3.28084)) + + +def _f(celsius): + return celsius * 9 / 5 + 32 + + +def _ll(lat, lon): + return (f"{abs(lat):.1f}{'N' if lat >= 0 else 'S'}", + f"{abs(lon):.1f}{'W' if lon <= 0 else 'E'}") + + +def packet_text(rec, info, machine, comparables, pages=None, precip=None): + """The packet for one trail, as text. + + info: {"points": [PointNormals or None], "kind": "track"|"ends"|"place", + "profile": (highest_m, lowest_m) or None}. machine: the machine + estimate's months. comparables: rows of (name, regions, high ground + feet, season phrase, months). pages: what disagreeing pages say, or + None. precip: millimetres a month at each point, or None. The trail's + own season is never used.""" + hike = rec.get("hike") or {} + tid = rec["id"] + out = [f"# Trail packet: {tid}", "", "## The trail", ""] + out += [f"- id: {tid}", f"- name: {rec['name']}", + f"- common name: {rec.get('common_name') or '(none on file)'}", + f"- country: {rec['country']}", + f"- states or provinces: {', '.join(rec.get('regions') or []) or '(none on file)'}", + f"- length: {rec['length_km'] / KM_PER_MILE:.0f} miles", + f"- kind: {rec.get('kind') or '(not on file)'}", + f"- shape: {hike.get('shape') or '(not on file)'}", + f"- terrain: {', '.join(hike.get('terrain') or []) or '(not on file)'}", + f"- travel: {hike.get('travel') or '(not on file)'}"] + hp, name = hike.get("high_point_m"), hike.get("high_point") + out.append("- high point: " + (f"{_ft(hp)} ft" + (f" ({name})" if name else "") + if hp is not None else "(not on file)")) + days = hike.get("days") + out.append("- typical days: " + (f"{days[0]} to {days[1]}" if days and len(days) == 2 + and days[0] != days[1] else (str(days[0]) if days else "(not on file)"))) + out += ["", "## Summary, start and end", "", + "(Sentences that bear on timing have been removed.)", ""] + for label, key in (("Summary", "summary"), ("Start", "start"), ("End", "end")): + kept, _removed = clean(hike.get(key)) + out.append(f"{label}: {shown(kept, hike.get(key))}") + points = M.usable(info["points"]) + out += ["", "## Where it is", ""] + if points: + lats, lons = [p.lat for p in points], [p.lon for p in points] + south, _ = _ll(min(lats), 0) + north, _ = _ll(max(lats), 0) + _, west = _ll(0, min(lons)) + _, east = _ll(0, max(lons)) + out += [f"- sample points: {len(points)}", + f"- southernmost: {south}; northernmost: {north}", + f"- westernmost: {west}; easternmost: {east}", + f"- rough extent: {south} to {north}, {west} to {east}" if len(points) > 1 + else f"- rough extent: a single point at {south}, {west}"] + out.append("- location is: " + { + "track": "a real track (points spaced along it)", + "ends": "start and end points only (no track)", + "place": "a region-centre fallback (no track and no end points; the centre of " + "the first region's box)"}[info["kind"]]) + out += ["", "## Elevation", ""] + if points: + high, low = M.high_low(points) + out.append(f"- high ground (the upper quarter of the sample points): " + f"{_ft(statistics.median(p.elev_m for p in high))} ft") + out.append(f"- low ground (the lower half of the sample points): " + f"{_ft(statistics.median(p.elev_m for p in low))} ft") + prof = info.get("profile") + out.append("- track's highest and lowest points: " + ( + f"{_ft(prof[0])} ft and {_ft(prof[1])} ft" if prof else "(no track elevation on file)")) + out += ["", "## Climate normals (1981 to 2010)", ""] + if points: + pr_of = {} + if precip and len(precip) == len(points) and all(precip): + pr_of = {id(p): pr for p, pr in zip(points, precip)} + + def by_month(group, get): + return [statistics.median(get(p)[m] for p in group) for m in range(12)] + hh = by_month(high, lambda p: p.tmax_c) + ll = by_month(low, lambda p: p.tmax_c) + out.append("Mean daily high in degrees F, " + ("and monthly precipitation in inches, " + if pr_of else "") + + "at the high ground and at the low ground.") + out.append("") + if pr_of: + ph = by_month(high, lambda p: pr_of[id(p)]) + pl = by_month(low, lambda p: pr_of[id(p)]) + out += ["| month | high ground F | low ground F | high ground precip in | low ground precip in |", + "|---|---|---|---|---|"] + out += [f"| {ABB[m]} | {_f(hh[m]):.0f} | {_f(ll[m]):.0f} | {ph[m] / 25.4:.1f} | {pl[m] / 25.4:.1f} |" + for m in range(12)] + else: + out += ["| month | high ground F | low ground F |", "|---|---|---|"] + out += [f"| {ABB[m]} | {_f(hh[m]):.0f} | {_f(ll[m]):.0f} |" for m in range(12)] + out += ["", "(Precipitation is not available for this trail.)"] + else: + out.append("No climate data is available for this trail's location.") + out += ["", "## Machine estimate", "", + "Labelled: machine estimate, right about two times in three.", "", + "Months: " + (", ".join(map(str, machine)) + " (" + ", ".join(MONTHS[m - 1] for m in machine) + ")" + if machine else "none"), + "", "## Comparable trails", "", + "The ten trails with a season on record that are most similar in climate and " + "nearest in place (this trail is never listed).", ""] + if comparables: + out += ["| trail | state | high ground elevation | season | months |", "|---|---|---|---|---|"] + out += [f"| {n} | {', '.join(regions)} | {feet} ft | {phrase} | {', '.join(map(str, months))} |" + for n, regions, feet, phrase, months in comparables] + else: + out.append("(none)") + if pages: + out += ["", "## What pages say", "", "Published pages disagree about this trail's season.", "", pages] + return "\n".join(out) + "\n" + + +# --------------------------------------------------------------------------- +# Answers and the blind score. + +def read_answers(path, known): + """({id: (months, phrase, confidence, why)}, [(line number, problem)]).""" + answers, problems, known = {}, [], set(known) + with open(path, encoding="utf-8") as f: + for n, raw in enumerate(f, 1): + line = raw.rstrip("\n") + if not line.strip() or line.startswith("#") or line.lower().startswith("id\t"): + continue + c = line.split("\t") + if len(c) < 4: + problems.append((n, f"expected at least 4 tab-separated columns, got {len(c)}")) + continue + tid, text, phrase, conf = c[0].strip(), c[1].strip(), c[2].strip(), c[3].strip().lower() + why = c[4].strip() if len(c) > 4 else "" + if tid not in known: + problems.append((n, f"unknown id {tid!r}")) + elif tid in answers: + problems.append((n, f"duplicate id {tid}")) + elif conf not in CONFIDENCES: + problems.append((n, f"{tid}: confidence must be high, medium or low: {conf!r}")) + else: + try: + months = sorted({int(x) for x in re.split(r"[,\s]+", text) if x}) + except ValueError: + problems.append((n, f"{tid}: months are not numbers: {text!r}")) + continue + if not months or months[0] < 1 or months[-1] > 12: + problems.append((n, f"{tid}: months empty or outside 1 to 12: {text!r}")) + continue + answers[tid] = (months, phrase, conf, why) + return answers, problems + + +def score(answers, truth): + """The blind result: for every trail whose season a page states (truth, + {id: months}) whether the reviewer's months match, in all and by the + reviewer's confidence, by two measures: `matched`, the first and last + months within a month of the page's, and `strict_matched`, which also + needs every window of the season, and no other, to correspond (so a gap + the page does not have, or one it has and the reviewer lacks, is a miss). + A trail with no answer is + tested and counts as missed; an answer for a trail not in truth is not + scored.""" + by = {c: {"tested": 0, "matched": 0, "strict_matched": 0} for c in CONFIDENCES} + tested = matched = strict_matched = unanswered = 0 + for tid, months in sorted(truth.items()): + tested += 1 + if tid not in answers: + unanswered += 1 + continue + got, _phrase, conf, _why = answers[tid] + hit = bool(M.score(got, months)[0]) + strict = M.match_strict(got, months) + matched += hit + strict_matched += strict + by[conf]["tested"] += 1 + by[conf]["matched"] += hit + by[conf]["strict_matched"] += strict + return {"tested": tested, "matched": matched, "strict_matched": strict_matched, + "unanswered": unanswered, "by_confidence": by} + + +def _share(matched, tested): + return round(matched / tested, 2) if tested else 0.0 + + +ENDS_MEASURE = ("the first and last months of the reviewer's season within a month of the season " + "a page states") +STRICT_MEASURE = ("the ends as above, and every window of the season (such as a gap in the middle) " + "also within a month of the page's, with no window added or missing") + + +def write_blind_test(path, figures, date): + def part(v): + return {"tested": v["tested"], "matched": v["matched"], + "share": _share(v["matched"], v["tested"]), + "strict_matched": v["strict_matched"], + "strict_share": _share(v["strict_matched"], v["tested"])} + doc = {"date": date, "measure": ENDS_MEASURE, "strict_measure": STRICT_MEASURE} + doc.update(part(figures)) + doc["by_confidence"] = {c: part(v) for c, v in figures["by_confidence"].items()} + with open(path, "w", encoding="utf-8") as f: + json.dump(doc, f, indent=1, sort_keys=False) + f.write("\n") + + +def load_blind_test(path=BLIND_TEST): + with open(path, encoding="utf-8") as f: + return json.load(f) + + +def check_blind_test(doc): + """Problems with the figure file: both measures must be present, the + parts must add up to the whole, each share must be the count over the + tested count, and the strict count may not exceed the ends-only count.""" + problems = [] + by = doc.get("by_confidence") or {} + if sorted(by) != sorted(CONFIDENCES): + problems.append("by_confidence must hold high, medium and low") + return problems + parts = [("all", doc)] + list(by.items()) + for name, v in parts: + for key in ("tested", "matched", "share", "strict_matched", "strict_share"): + if key not in v: + problems.append(f"{name}: {key} is missing") + if problems: + return problems + for key in ("tested", "matched", "strict_matched"): + if sum(v[key] for v in by.values()) != doc[key]: + problems.append(f"the confidence groups do not add up to the trails {key.replace('_', ' ')}") + for name, v in parts: + if v["matched"] > v["tested"] or v["strict_matched"] > v["tested"]: + problems.append(f"{name}: more matched than tested") + elif v["strict_matched"] > v["matched"]: + problems.append(f"{name}: the strict measure cannot match more than the ends-only one") + elif v["share"] != _share(v["matched"], v["tested"]): + problems.append(f"{name}: the share is not matched over tested") + elif v["strict_share"] != _share(v["strict_matched"], v["tested"]): + problems.append(f"{name}: the strict share is not matched over tested") + return problems + + +# --------------------------------------------------------------------------- +# Writing the judged seasons: proposals for refresh.py collect and apply. + +def method_text(why, confidence, lead=LEAD): + """The season_method an estimate carries: how it was set, what sets the + season there, and the confidence.""" + return f"{lead} {why.strip()} Confidence: {confidence}." + + +def proposals(root, answers_path, pages_path, given_dir=None): + """Stage one proposal for every trail with no season that has an answer. + A trail named in the pages file was set by judgement from pages that + differ: its season is `sources`, citing those pages, with the sentences + the file gives as its method. Every other is an `estimate` citing the + climate data. Returns how many were staged.""" + ids = refresh.trail_ids(root) + answers, problems = read_answers(answers_path, ids) + if problems: + raise ValueError("; ".join(f"line {n}: {t}" for n, t in problems)) + pages = {} + if pages_path and os.path.exists(pages_path): + with open(pages_path, encoding="utf-8") as f: + pages = json.load(f) + staging = refresh.staging_dir(root, given_dir, create=True) + out = os.path.join(staging, "staged", "season-judged") + today = datetime.date.today().isoformat() + source = C.SOURCE + report = [] + for tid in ids: + rec = refresh.load_toml(os.path.join(root, tid, "trail.toml")) + hike = rec.get("hike") or {} + if hike.get("season") or tid not in answers: + continue + months, _phrase, conf, why = answers[tid] + phrase = season.phrase_for(months) + judged_pages = pages.get(tid) + if judged_pages: + basis = "sources" + method = f"{judged_pages['why'].strip()} Confidence: {conf}." + cites = [(s["url"], s["publisher"], s["quote"]) for s in judged_pages["sources"]] + note = "the pages differ; set by judgement" + else: + basis = "estimate" + method = method_text(why, conf) + quote = (f"Monthly climate ({source['period']}) from {source['name']} " + f"at the trail elevation, read with the seasons of similar trails.") + cites = [(source["url"], source["publisher"], quote)] + note = "estimated from climate" + page, _publisher, quote = cites[0] + lines = ["[[proposal]]", 'kind = "change"', f"id = {E._toml_str(tid)}", + f"date = {E._toml_str(today)}", + f"summary = {E._toml_str('Add a season, ' + note + ': ' + phrase + '.')}", ""] + + def edit(field, new_toml, old_toml=None): + lines.append("[[proposal.edit]]") + lines.append(f"field = {E._toml_str(field)}") + if old_toml is not None: + lines.append(f"old = {old_toml}") + lines.append(f"new = {new_toml}") + lines.append(f"page = {E._toml_str(page)}") + lines.append(f"quote = {E._toml_str(quote)}") + lines.append("") + + edit("hike.season", E._toml_str(phrase)) + edit("hike.months", "[" + ", ".join(str(m) for m in months) + "]") + edit("hike.season_basis", E._toml_str(basis)) + edit("hike.season_method", E._toml_str(method)) + checked_old = hike.get("checked") + edit("hike.checked", E._toml_str(today), E._toml_str(checked_old) if checked_old else None) + for url, publisher, q in cites: + lines += ["[[proposal.append]]", 'table = "hike.source"', + f"page = {E._toml_str(url)}", f"quote = {E._toml_str(q)}", "", + "[proposal.append.entry]", + f"url = {E._toml_str(url)}", + f"publisher = {E._toml_str(publisher)}", + 'facts = ["season", "months"]', ""] + if basis == "estimate": + change = f"A season was estimated: {phrase}." + why_basis = ("No page states a season. It was set by judgement from the climate " + "at the trail's elevation and from similar trails.") + else: + change = f"A season was set from pages that differ: {phrase}." + why_basis = ("The pages that state a season differ and none is the managing body, " + "association or route author, so it was set by judgement from all of " + "them and the climate estimate.") + lines += ["[proposal.history]", f"change = {E._toml_str(change)}", + f"basis = {E._toml_str(why_basis)}", + f"basis_url = {E._toml_str(page)}", + 'asked_by = "the dataset\'s own check"', + 'fields = ["hike.season", "hike.months", "hike.season_basis", "hike.season_method"]', + ""] + d = os.path.join(out, tid) + os.makedirs(d, exist_ok=True) + with open(os.path.join(d, "proposal.toml"), "w", encoding="utf-8") as f: + f.write("\n".join(lines)) + report.append((tid, "changed", page, f"season {phrase}; {note}")) + os.makedirs(out, exist_ok=True) + import csv + with open(os.path.join(out, "report.csv"), "w", newline="", encoding="utf-8") as f: + writer = csv.writer(f) + writer.writerow(["id", "outcome", "pages", "remark"]) + writer.writerows(report) + return len(report) + + +# --------------------------------------------------------------------------- +# Command line. + +def _truth(root): + truth = {} + for tid, rec in E._records(root): + hike = rec.get("hike") or {} + if season.read_from_a_page(hike): + truth[tid] = sorted(int(m) for m in hike.get("months") or []) + return truth + + +def build_packets(root, out_dir, fetch, precip_file=None, pages_text=None): + """Write packets/.md and part-N.txt under out_dir. Reads the climate + through fetch (the cache); returns the number of packets.""" + recs = {tid: dict(rec, id=tid) for tid, rec in E._records(root)} + ids = sorted(recs) + truth = _truth(root) + precip = {} + if precip_file: + with open(precip_file, encoding="utf-8") as f: + precip = json.load(f) + params = E.load_params(root) + refs = E.references(root, fetch) + info, meds, centres = {}, {}, {} + for tid in ids: + pts, kind = E.sample_points(root, recs[tid]) + norms = E.normals_at(pts, fetch) + profile = None + if kind == "track": + try: + with open(os.path.join(root, tid, "elevation.json"), encoding="utf-8") as f: + data = json.load(f) + profile = (data["highest"]["m"], data["lowest"]["m"]) + except (OSError, KeyError, TypeError, ValueError): + profile = None + got = M.usable(norms) + info[tid] = {"points": got or [], "kind": kind, "profile": profile} + if got: + meds[tid] = M.medians(got) + centres[tid] = (sum(p.lat for p in got) / len(got), sum(p.lon for p in got) / len(got)) + parts = split_parts([t for t in ids if t in truth], [t for t in ids if t not in truth]) + part_of = {t: n for n, p in enumerate(parts) for t in p} + os.makedirs(os.path.join(out_dir, "packets"), exist_ok=True) + for n, part in enumerate(parts, 1): + with open(os.path.join(out_dir, f"part-{n}.txt"), "w", encoding="utf-8") as f: + f.write("\n".join(part) + "\n") + pages = {} + if os.path.exists(PAGES): + with open(PAGES, encoding="utf-8") as f: + pages = json.load(f) + for tid in ids: + rec = recs[tid] + est = E.estimate(root, rec, params, fetch, refs) + comp = [] + for other in comparables(tid, part_of, sorted(truth), meds, centres): + o = recs[other] + high, _low = M.high_low(info[other]["points"]) + comp.append((o["name"], o.get("regions") or [], + _ft(statistics.median(p.elev_m for p in high)), + str((o.get("hike") or {}).get("season")), truth[other])) + text = packet_text(rec, info[tid], est["months"] or [], comp, + pages=_pages_text(pages.get(tid)), + precip=precip.get(tid)) + with open(os.path.join(out_dir, "packets", f"{tid}.md"), "w", encoding="utf-8") as f: + f.write(text) + return len(ids) + + +def _pages_text(entry): + if not entry: + return None + publishers = "; ".join(s["publisher"] for s in entry["sources"]) + return f"Publisher(s): {publishers}\nMonths each gives: {entry.get('months_text', '')}" + + +def cmd_packets(args): + fetch = E._fetch_with_cache(args.cache) + n = build_packets(ROOT, args.out, fetch, args.precip) + print(f"{n} packets written to {args.out}/packets") + return 0 + + +def cmd_score(args): + ids = refresh.trail_ids(ROOT) + truth = _truth(ROOT) + answers = {} + for path in args.answers: + got, problems = read_answers(path, ids) + for n, text in problems: + print(f"{path} line {n}: {text}") + answers.update(got) + figures = score(answers, truth) + t, m, s = figures["tested"], figures["matched"], figures["strict_matched"] + print(f"ends only (first and last months within a month of the page's): {m} of {t} = {100 * m / t:.1f}%" + f" ({figures['unanswered']} unanswered)") + print(f"strict (also no wrong gap or missing window in the middle): {s} of {t} = {100 * s / t:.1f}%") + for c in CONFIDENCES: + v = figures["by_confidence"][c] + n = v["tested"] or 1 + print(f" {c:<7} ends only {v['matched']:>3} of {v['tested']:<3} = {100 * v['matched'] / n:.1f}%" + f" strict {v['strict_matched']:>3} of {v['tested']:<3} = {100 * v['strict_matched'] / n:.1f}%") + if args.write: + write_blind_test(args.write, figures, args.date or datetime.date.today().isoformat()) + print(f"written to {args.write}") + return 0 + + +def cmd_proposals(args): + n = proposals(ROOT, args.answers, args.pages, args.dir) + print(f"{n} proposals staged") + return 0 + + +def cmd_inputs(args): + """Record what each estimate rests on: the digest of the trail's track and location (offline, + all the monthly check compares) and, unless --points, the machine estimate and the digest of the + climate and similar trails at the time (which reads the climate, so it needs the network).""" + try: + with open(args.write, encoding="utf-8") as f: + doc = json.load(f) + except OSError: + doc = {} + params = refs = fetch = None + if not args.points: + fetch = E._fetch_with_cache(args.cache) + params = E.load_params(ROOT) + refs = E.references(ROOT, fetch) + estimates = {tid: rec for tid, rec in E._records(ROOT) + if (rec.get("hike") or {}).get("season_basis") == "estimate"} + unknown = [t for t in args.ids if t not in estimates] + if unknown: + print("not an estimate: " + ", ".join(unknown)) + return 1 + for tid in sorted(set(doc) - set(estimates)): + del doc[tid] + for tid, rec in estimates.items(): + if args.ids and tid not in args.ids: + continue + entry = dict(doc.get(tid, {})) + if not args.points: + entry.update(E.inputs_signature(E.estimate(ROOT, dict(rec, id=tid), params, fetch, refs))) + entry["points"] = E.points_signature(ROOT, dict(rec, id=tid)) + doc[tid] = entry + for tid, rec in estimates.items(): # every estimate has its digest, even when only some were asked for + doc.setdefault(tid, {"points": E.points_signature(ROOT, dict(rec, id=tid))}) + with open(args.write, "w", encoding="utf-8") as f: + json.dump(doc, f, indent=1, sort_keys=True) + f.write("\n") + print(f"inputs of {len(doc)} estimates written to {args.write}") + return 0 + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) + sub = parser.add_subparsers(dest="command", required=True) + p = sub.add_parser("packets", help="write the packets and part lists") + p.add_argument("--out", required=True) + p.add_argument("--precip", default=None, + help="JSON {id: [twelve monthly mm for each sample point]}; optional") + p.add_argument("--cache", default=None) + p.set_defaults(func=cmd_packets) + p = sub.add_parser("score", help="score answer files against the sourced seasons") + p.add_argument("answers", nargs="+") + p.add_argument("--write", default=None, help="record the figures in this JSON file") + p.add_argument("--date", default=None) + p.set_defaults(func=cmd_score) + p = sub.add_parser("proposals", help="stage the judged seasons for refresh.py") + p.add_argument("--answers", default=JUDGED) + p.add_argument("--pages", default=PAGES) + p.add_argument("--dir", default=None) + p.set_defaults(func=cmd_proposals) + p = sub.add_parser("inputs", help="record the inputs of every estimate (or of the trail ids named)") + p.add_argument("ids", nargs="*", help="only these estimates; default every estimate") + p.add_argument("--points", action="store_true", + help="record only the digest of the track and location (offline, quick)") + p.add_argument("--write", default=INPUTS) + p.add_argument("--cache", default=None) + p.set_defaults(func=cmd_inputs) + args = parser.parse_args(argv) + return args.func(args) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/season_judged.tsv b/tools/season_judged.tsv new file mode 100644 index 0000000..c2ddf89 --- /dev/null +++ b/tools/season_judged.tsv @@ -0,0 +1,223 @@ +across-utah-route 4,5,6,9,10 April to June and September to October medium Desert heat in summer and snow in the Henrys, La Sals and Bryce country in winter leave spring and fall. +akshayuk-pass 7,8 July to August medium Arctic Baffin Island is frozen and snowbound until late June and freezes up again by September, so the walkable window is the two summer months. +alexander-mackenzie 6,7,8,9 June to September medium Snow lingers on the Interior Plateau and Tweedsmuir highlands into June and autumn rain and early snow return in October. +allegheny-trail 4,5,6,7,8,9,10 April to October medium Mid-elevation West Virginia mountains are mild and green from April to October, with winter snow and ice and summer humidity making the edges less pleasant. +alpine-trail-7 7,8,9 July to September high Heavy winter snow at 7,000 feet in the Swan Range melts out by mid-July, and snow returns in October. +american-discovery-trail 4,5,6,7,8,9,10 April to October low A coast-to-coast thru-hike starts in spring and must reach the Colorado and Sierra high ground in summer before autumn snow, so the whole route fits April to October. +appalachian 3,4,5,6,7,8,9,10 March to October high A northbound thru-hike starts in March-April in Georgia and reaches Katahdin by September-October before Maine's snow, so the season spans March to October. +appalachian-high-route 4,5,6,9,10 Spring and fall medium Mountain loop over 5,000-foot ridges in NC and TN where summer is hot and humid and winter is icy, so spring and fall are the comfortable windows. +arizona 3,4,5,9,10,11 Spring and fall medium Low desert is too hot in summer and the high forest and Grand Canyon rim hold snow in winter, so thru-hikers go north from March to May or flip into fall. +avon 4,5,6,7,8,9,10 April to October medium Winter snow and early-spring mud on Ontario farmland end with the thaw, and the walk runs until late fall. +backbone 1,2,3,4,5,10,11,12 October to May medium Santa Monica Mountains chaparral is baking hot and dry from June to September, so the cool wetter months and spring wildflowers are the walking season. +baker 4,5,6,9,10 April to June and September to October medium Humid, buggy summers and icy, muddy winters in western Pennsylvania make spring and fall the usual walking months. +bartram 3,4,5,9,10,11 Spring and fall medium Blue Ridge route with summer heat and haze below and winter ice on the 5,000-foot balds, so spring and fall are best. +basin-and-range-trail 4,5,9,10 Spring and fall high Nevada desert route with scorching summer heat and little water and snow on the high ranges in winter, so spring and fall are the windows. +batona 10,11,12,1,2,3,4 October to April medium Flat Pine Barrens walking has no high ground to wait out, so the cool months are the season; summer brings heat, ticks and biting flies. +bay-circuit 3,4,5,9,10,11 March to May and September to November medium Humid, buggy summers and icy winters in low-lying eastern Massachusetts leave spring and fall, though it can be walked all year. +bayou-state-trail 1,2,3,4,11,12 November to April medium Summer heat, humidity, mosquitoes and storms in Louisiana push hiking into the cool, dry winter and early spring. +beartooth-high-route 7,8,9 July to September high Cross-country route at about 11,000 feet in the Beartooths where snow lingers into July and returns by late September, so only mid-summer works. +benton-mackaye 3,4,5,9,10,11 Spring and fall medium Southern Appalachian ridges up to 5800 ft are pleasant in spring and fall, while summer is hot, humid and buggy and winter brings ice. +big-bend-100 1,2,3,11,12 November to March high Chihuahuan Desert heat above 90F from May to September makes the cool months the only sensible window. +big-seki-loop 7,8,9 July to September high High Sierra passes up to 13,000 ft hold snow into early July and fresh snow returns by October, leaving July to September. +bigfoot-trail 7,8,9 July to September medium Klamath-Siskiyou high ground holds snow into June and gets heavy autumn rain from October, so the dry summer months fit. +bitterroots-80-mile-route 7,8,9 July to September medium High Selway-Bitterroot ground near 7,900 ft holds snow into early July and fall snow returns by October. +black-canyon 1,2,3,4,10,11,12 October to April high Sonoran Desert foothills are dangerously hot from May to September, so the cool months from October to April are the season. +blue-mountains-trail 5,6,9,10 May to June and September to October low Hot dry summers in the canyons and snow in the Wallowas and Blues outside late spring and early fall limit the window, though high sections are fine in midsummer. +border-route 5,6,7,8,9,10 Late May to October medium Northern Minnesota boundary-waters ridges are snow-bound and muddy until May and bugs peak in June and July, but the trail is walkable from May through fall. +boreal-trail 6,7,8,9 June to September medium Saskatchewan boreal forest has long cold winters and is frozen into May, leaving the short warm summer for hiking. +boundary-trail-mount-st-helens 7,8,9,10 July to October high Cascade ridges around 5,000 feet hold snow until July, and heavy rain starts in late October. +boundary-trail-pasayten 7,8,9 July to September high The Pasayten high country at 5,500 to 7,500 feet is under snow until early July, and snow returns in October. +brazeau-loop 7,8,9 July to September high Jasper's high passes and river fords need snowmelt to subside, so it is walkable from July until the first snow in September. +bristol-hills-trail 5,6,7,8,9,10 May to October medium Snow and mud make winter and early spring uncommon for walking, so the comfortable months run from late spring through fall. +brooks-range-traverse 6,7,8,9 June to September low Arctic tundra is frozen and snowbound most of the year, with river breakup in early June and freeze-up and snow by mid-September. +bruce-trail 4,5,6,7,8,9,10 April to October medium The Niagara Escarpment is icy and muddy through winter and early spring, so end-to-end hikes run from the April thaw to the end of October. +buckeye 3,4,5,9,10,11 Spring and fall medium Ohio summers are hot, humid and buggy and winters are cold and muddy, so spring and fall are the comfortable thru-hiking windows. +california-coastal 1,2,3,4,5,6,7,8,9,10,11,12 All year low The coast is walked all year, and the southern sections are at their best in winter. +canol 7,8 July and August medium Mackenzie Mountains trail where snow lingers on the passes into late June and the first snow returns in early September, leaving July and August. +centennial-sd 5,6,9,10 May to June and September to October medium Black Hills summer heat and thunderstorms and winter snow leave late spring and early fall as the best months. +central-wilderness-grand-tour 6,7,8,9,10 June to October medium Mid-elevation Golden Trout Wilderness melts out early, but Coyote Lakes Pass and Kern crossings need low snow and low water, so summer through early fall. +central-wind-rivers-loop 7,8,9 July to September high Wind River Range snow and swollen creeks persist until mid-July and winter returns by late September. +chinese-wall-circuit 7,8,9 July to September high The Bob Marshall high country near 8,500 ft holds snow until July and gets fall snow by late September. +circle-of-solitude 7,8,9 July to September high High passes like Colby, Avalanche and Forester stay snowbound and high-water crossings last into July, with autumn storms after September. +cohos 6,7,8,9,10 June to October medium The pages differ: The Trek gives May to October and Backpacking Routes gives June to November. It was set by judgement from both and from the climate, since snow and mud last into late May and cold sets in by late October. +colorado-trail 7,8,9 July to September high San Juan and Collegiate high ground above 12,000 ft is snow-covered until early July and snows again by late September. +condor-trail 3,4,5,10,11 Spring and fall medium Los Padres coast ranges are very hot and dry from June to September and wet in midwinter, so spring and fall are the windows. +conestoga-trail 3,4,5,9,10,11 March to May and September to November medium The low Lancaster County hills are hot, humid and tick-ridden in summer, so the cool months suit it best. +conservation-trail 4,5,6,7,8,9,10 April to October medium Low-elevation western New York is snowy in winter and muddy in March, and can be walked from April until late fall. +continental-divide 5,6,7,8,9,10 May to October medium A thru-hike must start north of the Mexican border after the desert winter and clear the San Juans, Wyoming and Montana high ground between the June snowmelt and the first October storms. +corvallis-to-the-sea 5,6,7,8,9,10 May to October medium Very wet, muddy Coast Range winters push the walk into the drier months from late spring through early fall. +cottonwood-trail 6,7,8,9 June to September medium Yukon mountain passes are snow-covered until June and cold and snowy again by late September, leaving the short summer. +cranberry-lake-50 6,7,8,9,10 June to October medium Adirondack snow and mud in spring and black flies into June leave summer and fall as the usual window. +cross-vermont 5,6,7,8,9,10 May to October medium A low-elevation route of mostly rail trail and quiet roads, where winter snow and mud season bracket a long snow-free stretch from May to October. +dan-zhur-donjek 7,8 July to August medium Subarctic Kluane high country with glacial river crossings is snowbound until late June and snows again by early September. +deadman-and-cloud-canyons 7,8,9 July to September high High Sierra passes like Elizabeth Pass and Colby Pass hold snow and stream crossings run high until July, and autumn storms begin in October. +deadman-creek-loop 1,2,3,4,11,12 November to April medium Low Sonoran desert at about 2,200 ft reaches 90 to 100 F from May to September, so the walk belongs in the cool season. +deseret-hiking-route 5,6,7,8,9,10 May to October low A route from southern Utah desert canyons to the Pioneer Mountains of Idaho needs the high ground clear of snow and the south not scorching. +desert-trail 4,5,6,9,10 April to June and September to October low Waterless desert is too hot in summer and snowy in winter, so a full walk runs through spring and early fall. +desert-winter-thru-hike 1,2,3,11,12 November to March medium Designed as a winter route through Sonoran, Colorado and Mojave deserts that are too hot from April through October. +donut-hole 4,5,6,9,10 April to June and September to October low Unbridged streams run high in early spring, and the valleys are hot, humid and buggy in midsummer, so the shoulder months suit best. +eagle-cap-traverse 7,8,9 July to September high Wallowa high passes near 7,000 ft hold snow until early July and fall storms arrive in October. +east-beach-trail 5,6,7,8,9 May to September medium Haida Gwaii beach walking is best in the drier months, as heavy rain and storms dominate from October through winter. +east-coast-trail 6,7,8,9 June to September medium Newfoundland's cold, foggy shoulder seasons and lingering snow and ice leave summer into early fall as the comfortable window. +eastern-continental-trail 1,2,3,4,5,6,7,8,9,10 January to October low A thru-hike of about 300 days starts in the Florida winter and has to finish in the Gaspe before the November snows. +eastern-sierra-high-route 7,8,9 July to September high Cross-country passes above 10,500 feet need the snow to have melted, which is from mid-July through September. +finger-lakes 4,5,6,7,8,9,10 April to October medium A page was found but it contradicts itself, giving winter, spring, summer and fall in one place and spring, summer and fall in another, so no page is relied on. The season was estimated from the climate and similar trails: snow lies from December to March and early spring is muddy. +florida 1,2,3,11,12 November to March high Subtropical heat, wet-season flooding and bugs from May to October make the cool dry months the thru-hiking season. +foothills 3,4,5,9,10,11 Spring and fall medium Blue Ridge escarpment trail is comfortable in spring and fall, with hot humid summers and some winter ice at the higher end. +fremont 6,7,8,9,10 June to October medium Oregon ridge route at 6,000 to 8,000 feet is snow-covered into early June and snowy again by November, with dry summers. +ganaraska 4,5,6,7,8,9,10 April to October medium Southern Ontario is snowy in winter and muddy in March, and the trail can be walked from April until late fall. +general-george-crook 4,5,6,9,10 April to June and September to October medium Rim country is snowy in winter, and the July and August monsoon brings lightning and storms, leaving spring and fall. +georgia-loop 3,4,5,9,10,11 March to May and September to November medium The north Georgia mountains are hot, humid and stormy in summer and cold and icy on the ridges in winter. +gila-centennial-loop 3,4,5,9,10,11 March to May and September to November medium Gila canyons at 6,000 feet are hot from June to August, with monsoon storms and flash floods, and cold in winter. +gospel-hump-loop 7,8,9 July to September high Idaho subalpine ridges around 7,000 feet hold snow until late June and get snow again by October, so only summer into early fall works. +grand-enchantment 3,4,5,10,11 March to May, and October to November low The route crosses hot Sonoran desert and 10,000 ft Mogollon peaks, so a spring or fall thru-hike avoids summer heat at low ground and winter snow high up. +grand-moab-route 6,9,10 June and September to October low The route crosses 12,000-foot La Sal snow until June and desert canyons above 95F in July and August, which leaves early summer and fall. +grand-sawtooth-loop 7,8,9 July to September high Sawtooth passes and lake basins hold snow into early July and fall storms return in late September. +grand-teton-loop 7,8,9 July to September high Paintbrush Divide and Hurricane Pass hold snow into July and are snowy again by October, leaving July to September. +grand-valley-trail 4,5,6,7,8,9,10 April to October medium A low-elevation southern Ontario footpath that can be walked in all but deep winter and the muddy early spring. +great-basin-trail 4,5,6,9,10 April to June and September to October low Scarce water and 80 F summer heat in the valleys, plus winter snow on the ranges, favour spring and early fall. +great-colorado-route 6,7,8,9 June to September medium A route linking fourteeners and passes above 12,000 ft needs the snow gone, so it runs from early summer into early fall. +great-divide-trail 7,8,9 July to September high Alberta and BC Rockies passes stay snow-covered until early July and fresh snow returns in September, so thru-hikers walk July to mid-September. +great-eastern 4,5,6,7,8,9,10 April to October low A very long Appalachian walk, started in spring in Alabama and carried through summer humidity and into fall to avoid winter in the north. +great-plains-trail 5,6,7,8,9,10 May to October low A north-to-south prairie route from Saskatchewan to Texas is walked from late spring to fall, avoiding cold northern winters and heat in the south by timing. +great-western-divide-loop 7,8,9 July to September medium Kaweah Gap and the Great Western Divide hold deep snow into early July, and autumn storms return by October. +great-western-loop 4,5,6,7,8,9,10 April to October low A roughly 208-day circuit of western trails starts in spring from the Arizona desert and must clear the Sierra, Rockies and Cascades in summer before fall snow. +green-river-lakes-titcomb-basin-loop 7,8,9 July to September high The northern Wind Rivers hold snow and high water into mid-July and get fall storms by late September. +guadalupe-ridge-trail 3,4,10,11 Spring and fall medium Chihuahuan Desert lowlands are very hot from May to September and the ridge gets cold and windy in winter, so spring and fall are best. +hayduke-trail 4,5,9,10 April to May and September to October medium Canyon country is too hot in summer and the Henry Mountains and Boulder snow in winter, so thru-hikers start in spring or fall. +heart-lake-two-ocean-plateau-loop 7,8,9 July to September high Yellowstone's high backcountry has deep snow and high water into late June and returns to winter by October, so July to September is the window. +high-country-pathway 5,6,7,8,9,10 May to October medium Northern Michigan forest is snowbound in winter and muddy in early spring, and walkable from May to October, with bugs the main summer complaint. +high-sierra 7,8,9 July to September high Kaweah Gap and Whitney's high ground hold snow and run high streams until July, and autumn storms start in October. +highlands 3,4,5,9,10,11 March to May and September to November medium The low New Jersey and New York Highlands ridges are hot, humid and buggy in summer and icy in midwinter. +highline 4,5,6,9,10 April to June, and September to October medium Mogollon Rim at 6,000 ft is warm and dry in spring and fall, with summer monsoon storms in July and August and snow in winter. +hoosier-heritage-trail 3,4,5,9,10,11 March to May and September to November medium Indiana has hot, humid summers with ticks and thick vegetation, so spring and fall are the most comfortable months. +horse-shoe 3,4,5,9,10,11 March to May and September to November medium Southeast Pennsylvania has humid, buggy summers and icy winters, which leaves spring and fall. +hot-springs-trail 4,5,6,7,8,9 April to September low A northbound route of about 110 days from coastal California to Idaho needs the Sierra and the northern mountains clear of snow, so it runs from spring to early fall. +iat-newfoundland-labrador 6,7,8,9 June to September medium Western Newfoundland is cold, snowy and boggy until June, and storms and snow return in October. +ice-age 5,6,7,8,9,10 May to October medium One publisher's two pages were found and they differ, one giving summer and fall and the other summer only, so no page is relied on. The season was estimated from the climate and similar trails: snow and mud last through April and a hard freeze comes by November. +idaho-centennial 6,7,8,9 June to September medium Snow on the mountain sections lasts into June while the southern desert gets hot, so a north-bound walk runs June through September. +international-appalachian-trail-maine 6,7,8,9,10 June to October medium Northern Maine is snowbound and muddy until late May and frozen from November, and fall is best once the bugs fade. +island-walk 6,7,8,9,10 June to October medium Prince Edward Island is cold and wet in spring and late fall, so the walk is done in the warm months. +itijjagiaq-trail 7,8 July to August medium Baffin Island's Katannilik park is frozen and used by skiers and snowmobilers until June, so summer hiking is limited to July and August before September freeze. +john-muir 7,8,9 July to September high High Sierra passes above 11,000 ft are snow-choked until early July and storms and cold return in late September, so thru-hikes run July to September. +kanab-canyon-loop 3,4,5,10,11 Spring and fall high Grand Canyon inner gorge is dangerously hot from June to September with monsoon storms, so spring and fall are the standard seasons. +kings-canyon-high-basin-route 7,8,9 July to September high Off-trail travel over 12,000 ft passes needs the snow gone and stable weather, which only holds from July to September. +knobstone 3,4,5,9,10,11 March to May and September to November medium Southern Indiana summers are hot, humid and tick-ridden, while the steep, leafless bluffs in the cool shoulder seasons are the draw. +koroc-palmer-loop 7,8 July to August medium The Torngat Mountains in the Arctic are snowbound until late June and freeze again by September, leaving a short July and August window. +la-cloche 6,7,8,9,10 June to October medium Killarney is snowbound in winter and buggy in spring, so the warm months are the main window, with September and early October the best. +laurel-highlands 4,5,6,7,8,9,10 April to October medium Moderate Pennsylvania ridge at about 2,500 feet is snowy in midwinter but mild enough from April to October. +lone-star 1,2,3,11,12 November to March high East Texas piney woods are hot, humid and buggy for much of the year, so the cool winter months are the hiking season. +long-path 4,5,6,9,10 April to June and September to October medium Humid, buggy summers and icy winters in the Hudson Valley and Catskills favour spring and fall. +long-trail 6,7,8,9,10 June to October high Green Mountain ridges are muddy and snowy until late May and wintry by November, so thru-hikers walk June to October. +lost-coast 5,6,7,8,9 May to September high Heavy winter rain, slides and high tides make parts of the coast impassable, so the dry months with workable low tides are used. +lowest-to-highest-route 5,6,10 Late May to June, or October low Badwater is lethal in summer heat while Whitney holds snow until June, so the route fits a narrow window in late spring or early fall. +loyalsock 4,5,6,9,10 April to June and September to October medium Rocky, wet terrain in northern Pennsylvania is best in the cool shoulder seasons, before the humid, buggy summer. +maah-daah-hey 5,6,9,10 May to June and September to October medium Badlands clay turns to impassable gumbo when wet and summer is hot, so late spring and early fall are the usual months. +maricopa-trail 1,2,3,4,10,11,12 October to April high Phoenix-area Sonoran Desert is above 95F from May to September, so the cool months from October to April are the season. +mason-dixon 3,4,5,9,10,11 March to May and September to November medium The low Susquehanna valley is hot and humid in summer, so the cool spring and fall months suit best. +massanutten 3,4,5,9,10,11 Spring and fall medium Virginia ridge circuit with hot humid summers and cold winters, so spring and fall are most comfortable. +mattabesett 3,4,5,9,10,11 Spring and fall medium Low Connecticut traprock ridges are best in spring and fall, with summer humidity, heat and ticks and some winter ice on ledges. +metacomet-monadnock 4,5,6,9,10 Spring and early summer, and fall low New England ridge walking is cold and icy in winter and humid and buggy in midsummer, so spring and fall are favoured. +mid-state 4,5,6,7,8,9,10 April to October medium Pennsylvania ridge and plateau trail at about 2,000 feet is snowy in winter but fine from April to October, with summer humidity and ticks. +middle-fork-kings-river 7,8,9 July to September high Muir Pass and Hell-for-Sure Pass hold snow into early July and storms return in autumn, so July to September. +middle-fork-trail 6,7,8,9,10 June to October low Idaho river canyon and high bench trail clears of snow in June and gets cold wet weather by November, though low canyon heat peaks in July. +midland-to-mackinac-trail 6,7,8,9,10 June to October medium Snow and mud last into April in northern Michigan, and the walk is comfortable from June through early fall. +midstate-ma 4,5,6,9,10,11 April to June and September to November medium The gentle central Massachusetts hills are pleasant in spring and fall, with humid, buggy summers and cold, icy winters. +milestone-basin-and-the-upper-kern 7,8,9 July to September high Sierra passes above 10,000 ft and Kern fords stay snowy and high into early July, with autumn storms returning in October. +mogollon-rim-trail 4,5,9,10 April to May and September to October low Low desert sections reach 90 F by June and the White Mountains and Blue Range hold snow in winter, so spring and fall fit a full crossing. +mojave-sonoran-trail 1,2,3,11,12 November to March high Colorado River desert lowlands reach 100F from May to September, so the cool winter months are the only practical window. +monadnock-sunapee 6,7,8,9,10 June to October medium New Hampshire snow, mud and black flies linger into early June and the summit ridges are snowy from late fall. +montana-trail 6,7,8,9 June to September low A 90-to-122-day crossing from the Divide to the plains starts after mountain snow clears in June and aims to finish before winter on the Missouri breaks. +mountains-to-sea 3,4,5,9,10,11 March to May and September to November medium High Smokies and Blue Ridge are cold in winter while the Piedmont and coast are hot and humid in summer, so cool shoulder seasons suit a full walk. +nankoweap-bright-angel-loop 5,9,10 May and September to October low The Grand Canyon inner canyon is dangerously hot from June to August and the North Rim road is snowed in over winter, leaving late spring and early fall. +nepisiguit-migmaq-trail 6,7,8,9 June to September medium Northern New Brunswick is snowy and muddy through May and cold by October, with river and bug conditions favouring summer. +new-england 4,5,6,9,10 April to June and September to October medium Traprock ridges are cold and icy in winter and hot, humid and buggy in July and August, so spring and fall suit best. +north-boundary 7,8,9 July to September medium Snake Indian Pass and the Smoky River crossings need snowmelt in the Jasper backcountry, and winter returns by October. +north-country 5,6,7,8,9,10 May to October low A thru-hike across the northern states starts after the North Dakota spring thaw and must finish before winter sets in the Adirondacks and Vermont by late October. +north-south 3,4,5,9,10,11 March to May and September to November medium Rhode Island woods are humid and buggy in summer and cold in winter. +north-south-lbl 3,4,5,9,10,11 March to May and September to November medium The forests of western Kentucky and Tennessee are hot, humid and tick-ridden in summer, so spring and fall are favoured. +north-umpqua 6,7,8,9,10 June to October medium The upper Cascade sections near 6,000 feet hold snow into June and see heavy rain and snow from late October, though the river canyon can be walked earlier. +northern-colorado-trail 7,8,9 July to September medium Flat Tops and Rocky Mountain high ground above 11,000 ft is snowbound until early July and snows again by late September. +northern-new-mexico-loop 6,7,8,9,10 June to October low The Sangre de Cristo and Jemez high ground holds snow into June, and lower desert stretches are hot in midsummer, so a whole loop fits June to October. +northville-placid 6,7,8,9,10 June to October medium Adirondack wilderness trail is wet, snowy and muddy until late May, with black flies in May and June and cold weather by late October. +oak-ridges 4,5,6,7,8,9,10 April to October medium The southern Ontario moraine is snowy and muddy over winter and can be walked from April until late fall. +ocean-to-lake 1,2,3,11,12 November to March high South Florida is hot, wet and buggy from May to October with flooded swamp and prairie, so the cooler dry months are used. +oregon-coast 5,6,7,8,9 May to September medium The coast gets 10-16 inches of rain a month from November to March and the drier months from May to September make beach walking and creek crossings workable. +oregon-desert 4,5,6,9,10 Spring and fall medium High desert at 3,000-8,000 ft is hot and waterless in July and August and cold in winter, so spring and fall are the walking windows. +ottawa-temiskaming-highland-trail 6,7,8,9,10 June to October medium Northeastern Ontario forest is snowbound and muddy until May, with black flies in early summer, and cold by November. +ouachita 10,11,12,1,2,3,4,5 October to May medium The pages differ: one gives April to November, one gives late October to late March, and one gives all year. It was set by judgement from all three and the climate: a classic cool-season trail, since summers are hot, humid and full of ticks. +ozark-highlands 3,4,5,10,11 Spring and fall medium Arkansas Ozark summers are hot, humid and buggy and winters are cold but popular for leaf-off views, so spring and fall are the typical seasons. +ozark-trail 9,10,11,12,1,2,3,4,5 September to May medium One publisher's two pages were found and they differ, one giving spring or fall and the other adding winter, so no page is relied on. The season was estimated from the climate and similar trails: it runs fall through spring, and the heat, humidity and ticks of summer set the gap. +pacific-crest 4,5,6,7,8,9,10 April to October medium A thru-hike starts at the desert border in April or May, crosses the Sierra after the June to July snowmelt, and must finish the Washington Cascades by early October. +pacific-northwest 7,8,9 July to September medium An east-to-west thru-hike starts in Glacier after the snow clears in early July and must finish through the wet Olympic coast before October rain and early snow. +paumanok-path 3,4,5,9,10,11 March to May and September to November medium Long Island is humid and tick-heavy in summer, and the pine barrens are pleasant in the cool shoulder seasons. +pfiffner-traverse 7,8,9 July to September high A Continental Divide crest route above 11,000 feet with off-trail passes needs the snow gone, which is from July until the first big September storms. +pinhoti 3,4,5,10,11 Spring and fall medium Alabama and Georgia hills are hot and humid from June to September, and winter is wet and cold, so spring and fall are best. +powell-plateau-loop 5,9,10 May and September to October low The Grand Canyon's North Rim access is snowed in until May and the inner canyon is very hot in June to August, leaving late spring and early fall. +prescott-circle 3,4,5,9,10,11 March to May and September to November medium Prescott's high desert is hot in June to August with monsoon storms in July and August, while winters are cool but usually walkable, so shoulder seasons are best. +ptarmigan-glenns-lake-highline-loop 7,8,9 July to September high Glacier's Ptarmigan Tunnel, Stoney Indian Pass and Highline are snow-blocked until mid-July and the first snows come in late September. +quehanna 4,5,6,7,8,9,10 April to October medium Pennsylvania state forest trail at about 2,000 ft is walkable from April to October, with winter snow and March mud outside the season. +rae-lakes-loop 7,8,9 July to September high Glen Pass at 11,978 ft keeps snow into early July and the Kings River crossings run high, with autumn storms after September. +rideau-trail 4,5,6,7,8,9,10 April to October medium Eastern Ontario is snowy and muddy over winter, and the trail can be walked from April until late fall. +ring-the-peak 6,7,8,9,10 June to October low A loop around Pikes Peak that mixes stretches near 11,000 feet with lower trails, and is snow-free from about June to October. +river-to-river 3,4,5,10,11 Spring and fall medium Southern Illinois summers are hot, humid and buggy, with trailside poison ivy and ticks, so spring and fall are the comfortable seasons. +route-in-between 4,5,6,7,8,9,10 April to October low A Mexico-to-Canada link route through Arizona desert, Utah canyons and Idaho mountains has to chain a spring start with high Idaho snow clearing by summer and finishing before fall. +rutherford-lake-loop 7,8,9 July to September high Yosemite's south boundary passes at over 9,000 feet hold snow until early July, and autumn storms begin in October. +san-diego-trans-county-trail 1,2,3,4,11,12 November to April medium The Salton Sea end and the desert washes are over 100F in summer, so the cool months are used, with the 4,900-foot mountains still mild in winter. +santa-fe-to-taos 7,8,9 July to September medium Sangre de Cristo peaks near 12,000 ft are snowbound until late June and afternoon monsoon storms peak in July and August. +sawtooth-wilderness-high-route 7,8,9 July to September high Mostly cross-country passes near 9,000 feet and above need the snow gone, which is from mid-July through September. +sea-to-sea-route 1,2,3,4,5,6,7,8,9,10,11,12 All year low A transcontinental route of about 7,775 miles takes about a year to walk, so no single window fits and it is listed for all twelve months. +selway-river-trail 4,5,6,9,10 Spring and fall medium A low river canyon at 2,000 to 3,000 feet is free of snow early but reaches the mid-80s with fire risk in July and August, so spring and early fall are used. +sentier-international-appalaches 6,7,8,9 June to September medium Gaspesie's Chic-Choc summits keep snow into June and the cold and snow return in October, so summer is the window. +shawangunk-ridge-trail 3,4,5,9,10,11 March to May and September to November medium A Hudson Valley ridge with humid, buggy summers and icy winters, so spring and fall are the most comfortable months. +sheltowee-trace 3,4,5,10,11 Spring and fall medium Kentucky's Daniel Boone National Forest is hot, humid and buggy in summer and cold in winter, so spring and fall are best. +shenipsit-trail 3,4,5,9,10,11 March to May and September to November medium Central Connecticut has humid, buggy summers and cold, icy winters, so spring and fall are best. +sierra-grand-traverse 7,8,9 July to September high Over 40 passes between 9,000 and 12,000 ft are snow-covered until July, and fall storms close the high country by October. +sierra-high-route 7,8,9 July to September high The pages differ: Backpacking Routes gives late July to mid-September, and Skurka warns the route is off-limits to all but expert mountaineers from November through May. It was set by judgement from both and from the climate at the passes, which are near 12,000 feet. +silver-moccasin-trail 4,5,6,10,11 April to June and October to November medium San Gabriel low canyons exceed 85 F in midsummer and Mount Baden-Powell is snowy in winter, so spring and autumn suit best. +siskiyou-peaks-trail 7,8,9 July to September medium The summits and cirque lakes are snowbound until late June, and Shasta is climbed in summer. +sky-islands-traverse 3,4,5,9,10,11 March to May and September to November low Summer heat and the July and August monsoon storms in southeastern Arizona push the walk into spring and fall. +solitude-loop 7,8,9 July to September high Cloud Peak Wilderness at 9,000 to 11,000 feet holds snow into early July, and winter storms return in late September. +south-boundary 7,8,9 July to September high Jasper's Cairn and Rocky passes near 6,000 ft and glacial river fords need snowmelt and low water, so early July to mid-September. +south-lake-to-north-lake 7,8,9 July to September high Bishop, Muir and Piute passes above 11,000 ft hold snow into early July and storms return in late September. +southeastern-serpentine-trail 3,4,5,10,11 Spring and fall medium A 30-35 day link of southern Appalachian trails is walked in spring and fall to dodge summer heat, humidity and bugs and winter ice on the higher sections. +southern-sierra-high-route 7,8,9 July to September high Cross-country passes above 12,000 ft near Whitney hold snow into July and storms return by late September. +southwestern-horseshoe 3,4,5,9,10,11 Spring and fall low Joining the Hayduke, Arizona and Grand Enchantment trails across Utah, Arizona and New Mexico desert means spring or fall to avoid summer heat and monsoon, with the highest ground snow-free by late spring. +standing-stone 4,5,6,9,10 April to June and September to October medium Humid, buggy summers and icy winters on the Pennsylvania ridges leave spring and fall as the usual window. +stein-valley-traverse 7,8,9 July to September medium The traverse tops out around 7,000 feet, where snow lingers into July, and heavy rain starts in October. +sunapee-ragged-kearsarge 6,7,8,9,10 June to October medium New Hampshire snow and mud last into spring and black flies into early June, with foliage-season walking into early October. +sunshine-coast 6,7,8,9 June to September medium The coast is drenched by 8-14 inches of rain a month from October to March and the mountaintop sections hold snow until June, so the dry summer months are the season. +superior-hiking 5,6,7,8,9,10 May to October medium Lake Superior's North Shore is snowy and cold from November to April and buggy in June and July, so May to October with September and October favoured. +susquehannock 5,6,7,8,9,10 May to October medium Northern Pennsylvania plateau stays snowy and wet through April, so late spring through early fall is the walking season. +sycamore-canyon-az 3,4,10,11 March to April and October to November medium Low canyon country at 3,800 ft tops 90 F from June to September, so the loop belongs in the cooler spring and fall months. +tahoe-rim 6,7,8,9,10 June to October medium The 10,000 ft ridgelines are snow-covered into June and again from late October, so thru-hikers walk from about late June to early October. +tahoe-yosemite-trail 7,8,9 July to September high High Sierra passes up to about 10,000 feet hold snow until early July, and fall storms arrive in October. +teton-crest 7,8,9 July to September high Crest passes above 10,000 feet hold snow until mid-July and storms and snow return by late September or October. +teton-crest-route 7,8,9 July to September high Crest passes up to 10,700 ft hold snow into July and are wintry again by October, so July to September. +teton-range-traverse 7,8,9 July to September high The Teton crest and Yellowstone Plateau are snow-covered until early July and wintry again by October, so July to September. +teton-wilderness-loop 7,8,9 July to September high Two Ocean Pass and the Yellowstone River fords need snowmelt runoff to drop, which comes in mid-July, and fall storms arrive in late September. +thames-valley-trail 5,6,7,8,9,10 May to October low Southwestern Ontario farmland trail is muddy and cold in early spring and snow-covered in winter, so it is walked from late spring to fall. +thorofare-and-south-boundary-trail 7,8,9 July to September high Remote Yellowstone backcountry with deep snow and high river fords until early July, and snow returns in October. +timberline 7,8,9 July to September high Mount Hood's snowfields and glacial stream crossings are at their best from mid-July through September before heavy autumn rain returns. +toiyabe-crest 7,8,9 July to September medium Nevada crest at 10,000 feet is snow-covered into late June and cold again by October, leaving the dry summer. +tonto-trail 1,2,3,4,11,12 November to April medium The Grand Canyon Tonto Platform is 90-100F from May to September with scarce water, so the cool months from November to April are the walking season. +trans-adirondack-route 6,7,8,9,10 June to October low Adirondack wilderness with deep snow and mud into May, black flies in May and June, and winter returning in November. +traversee-charlevoix 6,7,8,9,10 June to October medium The guided cabin crossing runs from after the Quebec thaw and black-fly peak through early October, avoiding the snowbound winter. +tuscarora 3,4,5,9,10,11 March to May and September to November medium The Ridge and Valley Appalachians are hot, humid and buggy in summer and icy in winter, so spring and fall are the comfortable months. +uinta-highline 7,8,9 July to September high Most of the trail is above 10,000 ft over 12,000 ft passes, so snow keeps it closed until early July and storms return by late September. +vagabond-loop 3,4,5,6,7,8,9,10 March to October low A 3,500-mile circuit of Arizona, Utah, Colorado and New Mexico must start in the desert in early spring and cross the high Colorado Trail country in summer, before fall snow. +vancouver-island 6,7,8,9 June to September medium Heavy Pacific rain from October to April and snow on the high alpine sections make early summer to September the window. +vancouver-island-backbone 7,8,9 July to September medium Alpine ridges in the island interior hold snow until July and wet autumn storms begin in October; the packet's low elevation looks like a location error. +warrior-trail 3,4,5,9,10,11 March to May and September to November medium Farmland ridges in southwestern Pennsylvania are overgrown, humid and buggy in summer and icy in winter. +wasatch-traverse 7,8,9 July to September low The high Wasatch ridges and off-trail sections hold snow until late June and get early autumn storms, so midsummer fits a whole traverse. +washington-coast-trail 5,6,7,8,9 May to September high Heavy rain from October to April and tide-dependent headlands make the drier months from May to September the usual window. +waskahegan 5,6,7,8,9,10 May to October low Edmonton-area farmland and parkland is snow-covered and muddy from November to April, and walked from late spring to early fall. +west-coast-trail 5,6,7,8,9 May to September high The trail is only open and reservable from May to September because of heavy autumn to spring rain and storms. +western-uplands 5,6,7,8,9,10 May to October medium The Algonquin backcountry is frozen and snowy into April, buggy in late spring and cold by late October. +wind-river-high-route-dixon-wilson 7,8,9 July to September medium Days above 10,000 ft on the Divide need the snow gone, which happens in mid-July, and storms return in September. +wind-river-high-route-skurka 7,8,9 July to September high A mostly off-trail route at 10,000-12,000 ft with snowfields and big stream fords needs melt-out, which comes in mid-July and ends with September storms. +wind-river-highline-trail 7,8,9 July to September high Bridger Wilderness benchlands and passes hold snow and high water into early July and winter returns by late September. +wonderland 7,8,9 July to September high Mount Rainier's high ground keeps snow into July and heavy autumn rain begins in October, so mid-July to September is the window. +wyoming-range 7,8,9 July to September high Crest-top trail at 9,000 ft or more is snowbound until early July and snows again by late September. +yosemite-high-route 7,8,9 July to September high Mostly off-trail at 8,000 to 11,000 feet, so snowmelt, high stream crossings and early snow limit it to July through September. +yosemite-high-sierra-camp-loop 7,8,9 July to September high Tuolumne's high passes and the camps are snow-bound until late June and shut for the season by early September, so July to September. diff --git a/tools/season_judged_pages.json b/tools/season_judged_pages.json new file mode 100644 index 0000000..4572fc2 --- /dev/null +++ b/tools/season_judged_pages.json @@ -0,0 +1,55 @@ +{ + "sierra-high-route": { + "why": "The pages differ: Backpacking Routes gives late July to mid-September, and Skurka warns the route is off-limits to all but expert mountaineers from November through May. It was set by judgement from both and from the climate at the passes, which are near 12,000 feet.", + "months_text": "The Skurka page says the route is probably off-limits to all but the most experienced mountaineers from November through May and lists hazards by month; Backpacking Routes gives late July to mid-September", + "sources": [ + { + "url": "https://andrewskurka.com/adventures/sierra-high-route/logistical-considerations/", + "publisher": "Andrew Skurka (Skurka Adventures)", + "quote": "For all but the most experienced mountaineers, the SHR is probably off-limits from November through May" + }, + { + "url": "https://backpackingroutes.com/sierra-high-route/", + "publisher": "Backpacking Routes", + "quote": "The best time to hike the Sierra High Route is late July to mid-September." + } + ] + }, + "cohos": { + "why": "The pages differ: The Trek gives May to October and Backpacking Routes gives June to November. It was set by judgement from both and from the climate, since snow and mud last into late May and cold sets in by late October.", + "months_text": "The Trek 5-10; Backpacking Routes 6-11", + "sources": [ + { + "url": "https://thetrek.co/10-trails-can-find-long-distance-solitude-2020/", + "publisher": "The Trek", + "quote": "Thru-hiking season : May to October" + }, + { + "url": "https://backpackingroutes.com/cohos-trail/", + "publisher": "Backpacking Routes", + "quote": "Season : Summer , Fall" + } + ] + }, + "ouachita": { + "why": "The pages differ: one gives April to November, one gives late October to late March, and one gives all year. It was set by judgement from all three and the climate: a classic cool-season trail, since summers are hot, humid and full of ticks.", + "months_text": "The Hiking Life 4-11; Backpacking Routes 10-3; The Trek 1-12", + "sources": [ + { + "url": "https://thehikinglife.com/2014/07/ouachita-trail/", + "publisher": "The Hiking Life", + "quote": "Season : April to November." + }, + { + "url": "https://backpackingroutes.com/ouachita-trail/", + "publisher": "Backpacking Routes", + "quote": "Late October through late March is very possible, with the bulk of the hikers hitting it in November." + }, + { + "url": "https://thetrek.co/10-trails-can-find-long-distance-solitude-2020/", + "publisher": "The Trek", + "quote": "Thru-hiking season: Year-round" + } + ] + } +} diff --git a/tools/season_model.py b/tools/season_model.py new file mode 100644 index 0000000..3051307 --- /dev/null +++ b/tools/season_model.py @@ -0,0 +1,454 @@ +"""The season estimator: a pure function over monthly climate normals. + +Python 3 standard library only, no network. tools/estimate_season.py +finds a trail's sample points and their normals (tools/season_climate.py +downloads them, cached outside the repository) and hands them to this +module. See docs/superpowers/specs/2026-11-20-season-on-every-trail-design.md. + +The method, in three parts: + +1. Thresholds. A month is in season when the high ground (points at or + above the upper quartile of the track's elevations) has a median mean + daily high of at least cold_c_min, and the low ground (points at or + below the median elevation) has one of at most heat_c_max. +2. Comparable trails. Each trail is described by twelve monthly + high-ground highs and twelve low-ground highs. The k most similar + sourced trails (a season some page states) vote, each weighted by + 1 / (distance + 0.05) ** power, on every month. +3. The blend. Each month scores mix * (share of the comparable trails' + weight that has the month in season) + (1 - mix) * (1 if the + thresholds pass it else 0), and the month is in season when the score + reaches cut. The thresholds propose and the comparable trails confirm + or add, so a desert trail inherits a cool-season pattern and an arctic + trail a short summer from trails like it. + +A month set is never empty: when no month reaches the cut the three +highest scoring months are used and the result says so. + +The measure (match, score) is the owner's: a trail's estimated season +matches a sourced one when each end is within one month, a two-window +season is compared window by window, and a year-round season matches +only an estimate of ten or more months. fit_model scores the method by +leave-one-out over the sourced trails: every trail is predicted by a +model that never saw it, including the choice of the numbers above. +""" +import sys + +sys.dont_write_bytecode = True + +import math +import statistics + +import season + +EPS = 0.05 +FALLBACK_MONTHS = 3 +GRID_COLD = list(range(-10, 26)) +GRID_HEAT = list(range(15, 46)) +GRID_K = (3, 5, 8, 12, 20) +GRID_POWER = (1, 2) +GRID_CUT = (0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7) +GRID_MIX = (0.5, 0.6, 0.7, 0.8, 0.9) +GRID_BLEND_CUT = (0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8) +FULL = 0xFFF + + +class Params: + """cold_c_min, heat_c_max (the thresholds), k and power (the comparable + trails), mix and cut (the blend).""" + + __slots__ = ("cold_c_min", "heat_c_max", "k", "power", "mix", "cut") + + def __init__(self, cold_c_min, heat_c_max, k=20, power=1, mix=0.7, cut=0.65): + self.cold_c_min = float(cold_c_min) + self.heat_c_max = float(heat_c_max) + self.k = int(k) + self.power = int(power) + self.mix = float(mix) + self.cut = float(cut) + + def as_dict(self): + return {name: getattr(self, name) for name in self.__slots__} + + @classmethod + def from_dict(cls, doc): + return cls(**{name: doc[name] for name in cls.__slots__}) + + def __eq__(self, other): + return isinstance(other, Params) and self.as_dict() == other.as_dict() + + def __repr__(self): + return "Params(%s)" % ", ".join(f"{k}={v!r}" for k, v in self.as_dict().items()) + + +# --------------------------------------------------------------------------- +# Months as 12-bit masks (bit 0 is January) inside; lists of 1..12 outside. + +def to_mask(months): + mask = 0 + for m in months: + mask |= 1 << (int(m) - 1) + return mask + + +def to_months(mask): + return [m + 1 for m in range(12) if mask >> m & 1] + + +def _runs(mask): + """Circular runs of months as (first, last) pairs; December to + January joins into one run.""" + runs = [] + for m in to_months(mask): + if runs and m == runs[-1][1] + 1: + runs[-1][1] = m + else: + runs.append([m, m]) + if len(runs) > 1 and runs[0][0] == 1 and runs[-1][1] == 12: + runs[0][0] = runs.pop()[0] + return [tuple(r) for r in runs] + + +def _near(a, b): + d = abs(a - b) + return min(d, 12 - d) <= 1 + + +def match(estimated, sourced): + """The owner's measure, on month lists or masks. A sourced season of + eleven or twelve months matches an estimate of ten or more. A sourced + season in two or more windows matches when every window has an + estimated window within a month at both ends and the estimate has no + window of its own left over. Any other sourced season matches when + the estimate's span (season.span) is within a month at each end.""" + est = estimated if isinstance(estimated, int) else to_mask(estimated) + src = sourced if isinstance(sourced, int) else to_mask(sourced) + if not est or not src: + return False + if bin(src).count("1") >= 11: + return bin(est).count("1") >= 10 + src_runs = _runs(src) + if len(src_runs) >= 2: + est_runs = _runs(est) + return (all(any(_near(a, c) and _near(b, d) for c, d in est_runs) + for a, b in src_runs) + and all(any(_near(a, c) and _near(b, d) for c, d in src_runs) + for a, b in est_runs)) + return season.grade(to_months(est), to_months(src)) != "worse" + + +def match_strict(estimated, sourced): + """The stricter measure: match() and, besides, every window of the + estimate and of the sourced season must have a partner within a month at + both ends in the other. An estimate with a gap in the middle that the + sourced season does not have (or the other way round) is a miss, which + match() does not see when the sourced season is a single window. A + sourced season of eleven or twelve months is judged as match() judges + it.""" + est = estimated if isinstance(estimated, int) else to_mask(estimated) + src = sourced if isinstance(sourced, int) else to_mask(sourced) + if not match(est, src): + return False + if bin(src).count("1") >= 11: + return True + est_runs, src_runs = _runs(est), _runs(src) + return (all(any(_near(a, c) and _near(b, d) for c, d in est_runs) for a, b in src_runs) + and all(any(_near(a, c) and _near(b, d) for c, d in src_runs) for a, b in est_runs)) + + +def score(estimated, sourced): + """(match 1 or 0, share of the twelve months classified correctly, + Jaccard overlap of the month sets).""" + est = estimated if isinstance(estimated, int) else to_mask(estimated) + src = sourced if isinstance(sourced, int) else to_mask(sourced) + union = bin(est | src).count("1") + return (1.0 if match(est, src) else 0.0, + bin(~(est ^ src) & FULL).count("1") / 12, + bin(est & src).count("1") / union if union else 0.0) + + +# --------------------------------------------------------------------------- +# Climate summary of a trail. + +def usable(points): + """The points as a list, or None when any point lacks data. A trail + with a gap in its climate data is unestimable, never filled in.""" + if not points: + return None + got = list(points) + for point in got: + if point is None or len(getattr(point, "tmax_c", ()) or ()) != 12: + return None + return got + + +def high_low(points): + """Split points into high ground (at or above the upper quartile of + the elevations, at least one point) and low ground (at or below + the median). A single point is both.""" + elevs = sorted(p.elev_m for p in points) + if len(elevs) == 1: + return points, points + upper = statistics.quantiles(elevs, n=4, method="inclusive")[2] + median = statistics.median(elevs) + high = [p for p in points if p.elev_m >= upper] + low = [p for p in points if p.elev_m <= median] + if not high: + high = [max(points, key=lambda p: p.elev_m)] + if not low: + low = [min(points, key=lambda p: p.elev_m)] + return high, low + + +def medians(points): + """(high-ground, low-ground): each twelve median mean daily highs + rounded to a tenth. None when a point lacks data.""" + got = usable(points) + if got is None: + return None + high, low = high_low(got) + + def med(group): + return tuple(round(statistics.median(p.tmax_c[m] for p in group), 1) + for m in range(12)) + return med(high), med(low) + + +def threshold_mask(med, params): + high, low = med + mask = 0 + for m in range(12): + if high[m] >= params.cold_c_min and low[m] <= params.heat_c_max: + mask |= 1 << m + return mask + + +def _margins(med, params): + high, low = med + return [min(high[m] - params.cold_c_min, params.heat_c_max - low[m]) + for m in range(12)] + + +def _top(scores, n=FALLBACK_MONTHS): + order = sorted(range(12), key=lambda m: (-scores[m], m))[:n] + return sum(1 << m for m in order) + + +# --------------------------------------------------------------------------- +# Comparable trails. + +class Reference: + """A sourced trail the estimate may compare with.""" + + __slots__ = ("id", "med", "mask") + + def __init__(self, tid, med, months): + self.id = tid + self.med = med + self.mask = to_mask(months) + + +def distance(a, b): + """Root mean square difference, in tens of degrees, over the + twenty-four high-ground and low-ground monthly highs.""" + total = 0.0 + for ga, gb in zip(a, b): + for m in range(12): + total += ((ga[m] - gb[m]) / 10) ** 2 + return math.sqrt(total / 24) + + +def nearest(med, refs, k, exclude=None): + """The k closest references as (distance, reference), nearest first, + leaving out the reference whose id is exclude.""" + found = sorted(((distance(med, r.med), r.id, r) for r in refs + if r.id != exclude)) + return [(d, r) for d, _id, r in found[:k]] + + +def vote(near, power): + """Weighted share of the comparable trails that have each month.""" + total = 0.0 + acc = [0.0] * 12 + for d, r in near: + w = 1.0 / (d + EPS) ** power + total += w + for m in range(12): + if r.mask >> m & 1: + acc[m] += w + return [a / total for a in acc] if total else [0.0] * 12 + + +def blend(med, near, params): + """(mask, scores, fell_back). Without comparable trails the + thresholds stand alone.""" + thr = threshold_mask(med, params) + if not near: + if thr: + return thr, [float(thr >> m & 1) for m in range(12)], False + margins = _margins(med, params) + return _top(margins), margins, True + votes = vote(near, params.power) + scores = [params.mix * votes[m] + (1 - params.mix) * (thr >> m & 1) + for m in range(12)] + mask = sum(1 << m for m in range(12) if scores[m] >= params.cut) + if mask: + return mask, scores, False + return _top(scores), scores, True + + +def months_in_season(points, params, refs=(), exclude=None): + """Sorted month numbers in season, or None when some point has no + data. Never an empty list.""" + med = medians(points) + if med is None: + return None + near = nearest(med, list(refs), params.k, exclude) if refs else [] + return to_months(blend(med, near, params)[0]) + + +def confidence(med, near, scores, fell_back, close=0.12, decisive=0.7): + """("high" or "low", reason). High when the comparable trails are + close (mean distance at most `close`) and agree (at least `decisive` + of the twelve months have a weighted vote of 0.2 or less or 0.8 or + more) and the empty-set fallback was not needed. These two numbers + were chosen from the leave-one-out predictions: see + tools/season_fit.json, confidence.""" + if not near: + return "low", "no comparable trails" + mean_d = sum(d for d, _ in near) / len(near) + shares = vote(near, 1) + sure = sum(1 for s in shares if s <= 0.2 or s >= 0.8) / 12 + if fell_back: + return "low", "no month reached the cut" + if mean_d > close: + return "low", f"comparable trails are far (mean distance {mean_d:.2f})" + if sure < decisive: + return "low", f"comparable trails disagree ({sure:.0%} of months settled)" + return "high", f"comparable trails are close ({mean_d:.2f}) and agree" + + +# --------------------------------------------------------------------------- +# Fitting by leave-one-out. + +def _obj(s): + return s[0] + 1e-3 * s[2] + + +def fit_model(trails, params_grid=None): + """Fit the method on sourced trails and score it leave-one-out. + + trails: list of (id, medians, sourced months). Returns (params, + loo) where params is fitted on all of them and loo maps id to + (estimated mask, score) from a model that never saw that trail. + Each of the three parts is chosen by the same objective (matches, + then Jaccard overlap): thresholds over the cold and heat grids, + comparable trails over k, power and a month cut (nested: when + trail i is held out, every other trail's score is recomputed + without i among its neighbours), and the blend over mix and cut + from the other trails' leave-one-out predictions.""" + ids = [t[0] for t in trails] + index = {tid: n for n, tid in enumerate(ids)} + meds = [t[1] for t in trails] + truth = [to_mask(t[2]) for t in trails] + n = len(trails) + + # -- thresholds + combos = [(c, h) for c in GRID_COLD for h in GRID_HEAT] + thr_masks, thr_obj = [], [] + for c, h in combos: + p = Params(c, h) + row = [] + for j in range(n): + mk = threshold_mask(meds[j], p) or _top(_margins(meds[j], p)) + row.append(mk) + thr_masks.append(row) + thr_obj.append([_obj(score(row[j], truth[j])) for j in range(n)]) + totals = [sum(row) for row in thr_obj] + full_t = max(range(len(combos)), key=lambda ci: totals[ci]) + thr_loo = [] + for i in range(n): + ci = max(range(len(combos)), key=lambda ci: totals[ci] - thr_obj[ci][i]) + thr_loo.append(thr_masks[ci][i]) + + # -- comparable trails + refs = [Reference(ids[j], meds[j], t[2]) for j, t in enumerate(trails)] + order = [sorted(((distance(meds[j], meds[r]), r) for r in range(n) if r != j)) + for j in range(n)] + pos = [{r: p for p, (_d, r) in enumerate(order[j])} for j in range(n)] + bits = [[(truth[r] >> m) & 1 for m in range(12)] for r in range(n)] + + def shares(j, k, power, skip=None): + total, acc, got = 0.0, [0.0] * 12, 0 + for d, r in order[j]: + if r == skip: + continue + w = 1.0 / (d + EPS) ** power + total += w + for m in range(12): + if bits[r][m]: + acc[m] += w + got += 1 + if got == k: + break + return [a / total for a in acc] if total else [0.0] * 12 + + def mask_of(v, cut): + mk = sum(1 << m for m in range(12) if v[m] >= cut) + return mk or _top(v) + + knn = [(k, p, c) for k in GRID_K for p in GRID_POWER for c in GRID_CUT] + base = {} + for k in GRID_K: + for p in GRID_POWER: + for j in range(n): + v = shares(j, k, p) + base[k, p, j] = [_obj(score(mask_of(v, c), truth[j])) for c in GRID_CUT] + knn_totals = {} + for k in GRID_K: + for p in GRID_POWER: + for ci, c in enumerate(GRID_CUT): + knn_totals[k, p, ci] = sum(base[k, p, j][ci] for j in range(n)) + full_k = max(knn_totals, key=lambda key: knn_totals[key]) + knn_choice = [] + for i in range(n): + best, best_total = None, None + for k in GRID_K: + for p in GRID_POWER: + row = [knn_totals[k, p, ci] - base[k, p, i][ci] + for ci in range(len(GRID_CUT))] + # trails that had i among their k neighbours are rescored without it + for j in range(n): + if j != i and pos[j][i] < k: + v = shares(j, k, p, skip=i) + for ci, c in enumerate(GRID_CUT): + row[ci] += (_obj(score(mask_of(v, c), truth[j])) + - base[k, p, j][ci]) + for ci in range(len(GRID_CUT)): + if best_total is None or row[ci] > best_total: + best, best_total = (k, p, ci), row[ci] + knn_choice.append(best) + knn_votes = [shares(i, knn_choice[i][0], knn_choice[i][1]) for i in range(n)] + + # -- the blend + blends = [(mix, cut) for mix in GRID_MIX for cut in GRID_BLEND_CUT] + b_masks, b_obj = [], [] + for mix, cut in blends: + row = [] + for j in range(n): + v = [mix * knn_votes[j][m] + (1 - mix) * (thr_loo[j] >> m & 1) + for m in range(12)] + row.append(mask_of(v, cut)) + b_masks.append(row) + b_obj.append([_obj(score(row[j], truth[j])) for j in range(n)]) + b_totals = [sum(row) for row in b_obj] + full_b = max(range(len(blends)), key=lambda bi: b_totals[bi]) + loo = {} + for i in range(n): + bi = max(range(len(blends)), key=lambda bi: b_totals[bi] - b_obj[bi][i]) + mk = b_masks[bi][i] + loo[ids[i]] = (mk, score(mk, truth[i])) + cold, heat = combos[full_t] + k, p, _ci = full_k + mix, cut = blends[full_b] + return Params(cold, heat, k, p, mix, cut), loo diff --git a/tools/tests/test_estimate_season.py b/tools/tests/test_estimate_season.py new file mode 100644 index 0000000..2898114 --- /dev/null +++ b/tools/tests/test_estimate_season.py @@ -0,0 +1,525 @@ +"""Tests for tools/estimate_season.py. The rule tests use hand-made +normals, so they run with no network. + +Run from the repository root: + python3 -m unittest discover tools/tests +""" +import csv +import json +import os +import shutil +import sys +import tempfile +import unittest + +sys.dont_write_bytecode = True +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +import estimate_season as E # noqa: E402 +import test_refresh as TR # noqa: E402 +import season_climate as C # noqa: E402 + +PARAMS = E.Params(cold_c_min=5.0, heat_c_max=32.0) + + +def normals(elev, tmax, snow=None): + return C.PointNormals(lat=45.0, lon=-110.0, elev_m=float(elev), + tmax_c=tuple(float(v) for v in tmax), + snow_cm=None if snow is None + else tuple(float(v) for v in snow)) + + +class RuleTest(unittest.TestCase): + """The thresholds on their own: with no sourced trails to compare + with, the model is the cold and heat limits.""" + + def test_a_cold_high_point_closes_the_winter(self): + point = normals(3000, [0, 1, 3, 6, 10, 15, 20, 20, 15, 10, 4, 1]) + self.assertEqual(E.months_in_season([point], PARAMS), + [4, 5, 6, 7, 8, 9, 10]) + + def test_heat_at_the_low_ground_closes_a_summer_month(self): + desert = normals(400, [19, 22, 26, 31, 36, 42, 44, 43, 39, 32, 24, 19]) + self.assertEqual(E.months_in_season([desert], PARAMS), + [1, 2, 3, 4, 10, 11, 12]) + + def test_high_ground_is_the_upper_quartile_of_points(self): + low = [normals(e, [15] * 12) for e in (100, 200, 300)] + high = normals(400, [15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15]) + got = E.months_in_season(low + [high], PARAMS) + self.assertNotIn(6, got) # only the highest point is cold in June + self.assertEqual(len(got), 11) + + def test_a_wrapped_season_is_returned_sorted(self): + point = normals(400, [15, 15, 15, 15, 15, 40, 40, 40, 40, 40, 15, 15]) + self.assertEqual(E.months_in_season([point], PARAMS), + [1, 2, 3, 4, 5, 11, 12]) + + def test_a_trail_that_never_qualifies_still_gets_three_months(self): + arctic = normals(500, [-5, -4, -2, 0, 3, 4, 4, 3, 1, -1, -3, -5]) + got = E.months_in_season([arctic], PARAMS) + self.assertEqual(got, [5, 6, 7]) # the three nearest the cold limit + + def test_all_twelve_months_is_allowed(self): + coast = normals(20, [15] * 12) + self.assertEqual(E.months_in_season([coast], PARAMS), list(range(1, 13))) + + def test_a_point_with_missing_data_makes_the_trail_unestimable(self): + point = normals(20, [15] * 12) + self.assertIsNone(E.months_in_season([point, None], PARAMS)) + self.assertIsNone(E.months_in_season([], PARAMS)) + + +class SamplePointsTest(unittest.TestCase): + def make_root(self, td, parts=None, profile=None, multi=False): + import json + import tempfile # noqa: F401 (td is made by the caller) + d = os.path.join(td, "trail-x") + os.makedirs(os.path.join(td, "web")) + os.makedirs(d) + with open(os.path.join(td, "web", "place-bounds.toml"), "w") as f: + f.write('[box]\n"US-VT" = [-73.5, 42.7, -71.5, 45.0]\n') + if parts is not None: + if multi: + geom = {"type": "MultiLineString", "coordinates": parts} + else: + geom = {"type": "LineString", "coordinates": parts[0]} + doc = {"type": "FeatureCollection", + "features": [{"type": "Feature", "geometry": geom}]} + with open(os.path.join(d, "line.geojson"), "w") as f: + json.dump(doc, f) + if profile is not None: + with open(os.path.join(d, "elevation.json"), "w") as f: + json.dump({"profile": profile}, f) + return td + + @staticmethod + def meridian(lat0, lat1, step=0.1, lon=-110.0): + n = int(round((lat1 - lat0) / step)) + return [[lon, lat0 + i * step] for i in range(n + 1)] + + def rec(self, **hike): + base = {"summary": "x", "checked": "2026-01-01", "source": []} + base.update(hike) + return {"id": "trail-x", "country": "US", "regions": ["VT"], + "source": {"line_file": "line.geojson"}, "hike": base} + + def test_a_track_gives_points_spaced_along_it(self): + import tempfile + with tempfile.TemporaryDirectory() as td: + root = self.make_root(td, parts=[self.meridian(43.0, 44.8)], + profile=[[0, 1000], [200, 1000]]) + points, kind = E.sample_points(root, self.rec()) + self.assertEqual(kind, "track") + self.assertEqual(len(points), 5) # about 200 km, one per 50 km + self.assertEqual(points[0].km, 0.0) + self.assertAlmostEqual(points[0].lat, 43.0, places=3) + self.assertLess(abs(points[-1].km - 200.15), 50) + self.assertAlmostEqual(points[-1].lat, 44.8, places=3) + + def test_a_short_track_still_gets_three_points(self): + import tempfile + with tempfile.TemporaryDirectory() as td: + root = self.make_root(td, parts=[self.meridian(43.0, 43.09, 0.03)], + profile=[[0, 500], [10, 500]]) + points, kind = E.sample_points(root, self.rec()) + self.assertEqual(len(points), 3) + + def test_a_very_long_track_is_capped_at_twelve(self): + import tempfile + with tempfile.TemporaryDirectory() as td: + root = self.make_root(td, parts=[self.meridian(35.0, 45.0, 0.5)], + profile=[[0, 500], [1112, 500]]) + points, kind = E.sample_points(root, self.rec()) + self.assertEqual(len(points), 12) + + def test_a_multipart_track_is_sampled_along_all_parts(self): + import tempfile + parts = [self.meridian(43.0, 43.9), self.meridian(44.1, 45.0)] + with tempfile.TemporaryDirectory() as td: + root = self.make_root(td, parts=parts, multi=True, + profile=[[0, 500], [200, 500]]) + points, kind = E.sample_points(root, self.rec()) + self.assertEqual(kind, "track") + self.assertTrue(any(p.lat > 44.1 for p in points)) + self.assertTrue(any(p.lat < 43.9 for p in points)) + + def test_elevation_comes_from_the_profile_by_distance(self): + import tempfile + with tempfile.TemporaryDirectory() as td: + root = self.make_root(td, parts=[self.meridian(43.0, 44.8)], + profile=[[0, 1000], [100, 2000], [200, 1500]]) + points, kind = E.sample_points(root, self.rec()) + middle = points[len(points) // 2] + self.assertLess(abs(middle.elev_m - 2000), 30) + self.assertLess(abs(points[0].elev_m - 1000), 30) + + def test_a_track_without_a_profile_uses_the_high_point_for_the_top_only(self): + import tempfile + with tempfile.TemporaryDirectory() as td: + root = self.make_root(td, parts=[self.meridian(43.0, 44.8)]) + points, kind = E.sample_points(root, self.rec(high_point_m=3000)) + elevs = [p.elev_m for p in points] + self.assertEqual(elevs.count(3000), 1) + self.assertEqual(elevs.count(None), len(elevs) - 1) + + def test_no_track_uses_the_two_ends(self): + import tempfile + with tempfile.TemporaryDirectory() as td: + root = self.make_root(td) + points, kind = E.sample_points( + root, self.rec(start_lonlat=[-110.0, 43.0], + end_lonlat=[-109.0, 44.0])) + self.assertEqual(kind, "ends") + self.assertEqual(len(points), 2) + self.assertEqual((points[0].lat, points[0].lon), (43.0, -110.0)) + self.assertEqual((points[1].lat, points[1].lon), (44.0, -109.0)) + + def test_no_track_and_no_ends_uses_the_place_centre(self): + import tempfile + with tempfile.TemporaryDirectory() as td: + root = self.make_root(td) + points, kind = E.sample_points(root, self.rec()) + self.assertEqual(kind, "place") + self.assertEqual(len(points), 1) + self.assertTrue(-73.5 <= points[0].lon <= -71.5) + self.assertTrue(42.7 <= points[0].lat <= 45.0) + self.assertAlmostEqual(points[0].lon, -72.5) + self.assertAlmostEqual(points[0].lat, 43.85) + + +class ReportTest(unittest.TestCase): + def loo(self, **kw): + """loo entries (mask, (match, classified, jaccard)) by id.""" + return {tid: (0, v) for tid, v in kw.items()} + + def test_report_counts_matches_and_no_data(self): + med = ((15.0,) * 12, (15.0,) * 12) + sourced = [("a", med, [7, 8], "g"), ("b", med, [7, 8], "g"), + ("c", None, [6, 7, 8], "h")] + loo = self.loo(a=(1.0, 1.0, 1.0), b=(0.0, 0.5, 0.25)) + rep = E.report(sourced, loo) + self.assertEqual((rep["n"], rep["within1"], rep["worse"], rep["no_data"]), + (3, 1, 1, 1)) + self.assertEqual(rep["within1"] + rep["worse"] + rep["no_data"], rep["n"]) + self.assertEqual(rep["classified"], 0.75) + self.assertEqual(rep["jaccard"], 0.625) + self.assertEqual(rep["by_group"]["g"]["within1"], 1) + self.assertEqual(rep["by_group"]["h"]["no_data"], 1) + + def test_passes_is_false_below_the_bar_and_true_at_it(self): + def rep(within1, no_data=0, n=100): + return {"n": n, "within1": within1, + "worse": n - within1 - no_data, "no_data": no_data} + self.assertFalse(E.passes_bar(rep(74))) + self.assertTrue(E.passes_bar(rep(75))) + self.assertFalse(E.passes_bar(rep(90, no_data=11))) # coverage 89% + + def test_the_report_splits_by_kind(self): + med = ((20.0,) * 12, (20.0,) * 12) + sourced = [("a", med, list(range(1, 13)), "x")] + rep = E.report(sourced, self.loo(a=(1.0, 1.0, 1.0))) + self.assertEqual(rep["by_kind"]["year-round"]["n"], 1) + self.assertEqual(rep["by_kind"]["year-round"]["within1"], 1) + self.assertEqual(rep["by_kind"]["alpine"]["n"], 0) + + def test_the_same_input_gives_the_same_fit_twice(self): + med = lambda v: (tuple([v] * 12), tuple([v] * 12)) + sourced = [(f"t{i}", med(10.0 + i), [5, 6, 7, 8], "g") for i in range(6)] + first = E.fit_sourced(sourced) + second = E.fit_sourced(sourced) + self.assertEqual(first[0], second[0]) + self.assertEqual(first[1], second[1]) + + +def mild_fetch(lat, lon, elev): + return C.PointNormals(lat=float(lat), lon=float(lon), + elev_m=float(elev if elev is not None else 100.0), + tmax_c=tuple([15.0] * 12)) + + +def warm_with_latitude(lat, lon, elev): + """Warmer to the south: five degrees a degree of latitude.""" + return C.PointNormals(lat=float(lat), lon=float(lon), + elev_m=float(elev if elev is not None else 100.0), + tmax_c=tuple([15.0 + 5.0 * (43.0 - float(lat))] * 12)) + + +def none_fetch(lat, lon, elev): + return None + + +def bounds_root(td): + os.makedirs(os.path.join(td, "web")) + with open(os.path.join(td, "web", "place-bounds.toml"), "w") as f: + f.write('[box]\n"US-VT" = [-73.5, 42.7, -71.5, 45.0]\n') + return td + + +def ends_rec(tid="trail-x", lat=43.0, extra=None): + hike = {"summary": "x", "checked": "2026-01-01", "source": [], + "start_lonlat": [-110.0, lat], "end_lonlat": [-109.0, lat + 1.0]} + hike.update(extra or {}) + return {"id": tid, "country": "US", "regions": ["VT"], + "source": {"line_file": "line.geojson"}, "hike": hike} + + +class EstimateTest(unittest.TestCase): + def test_a_no_track_record_is_flagged(self): + import tempfile + with tempfile.TemporaryDirectory() as td: + est = E.estimate(bounds_root(td), ends_rec(), PARAMS, fetch=mild_fetch) + self.assertIn("no-track", est["flags"]) + self.assertEqual(est["months"], list(range(1, 13))) + self.assertEqual(est["phrase"], "All year") + + def test_a_trail_with_no_data_is_listed_not_estimated(self): + import tempfile + with tempfile.TemporaryDirectory() as td: + est = E.estimate(bounds_root(td), ends_rec(), PARAMS, fetch=none_fetch) + self.assertIsNone(est["months"]) + self.assertIn("no-data", est["flags"]) + self.assertIn("no data", est["reason"]) + + def test_flags_include_far_north_above_sixty_degrees(self): + import tempfile + with tempfile.TemporaryDirectory() as td: + est = E.estimate(bounds_root(td), ends_rec(lat=61.0), PARAMS, + fetch=mild_fetch) + self.assertIn("far-north", est["flags"]) + + def test_nothing_in_estimate_touches_the_network_without_a_fetch(self): + import tempfile + + def raising(lat, lon, elev): + raise AssertionError("network touched") + + with tempfile.TemporaryDirectory() as td: + with self.assertRaises(AssertionError): + E.estimate(bounds_root(td), ends_rec(), PARAMS, fetch=raising) + + def test_comparable_trails_are_listed_nearest_first(self): + import tempfile, shutil + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp, True) + root = TR.make_repo(tmp, trails=[ + ("near-one", "Near", {"extra_hike": + 'season = "June to September"\nmonths = [6, 7, 8, 9]\n' + 'season_basis = "source"\n' + 'start_lonlat = [-110.0, 43.1]\nend_lonlat = [-110.0, 43.3]\n'}), + ("far-one", "Far", {"extra_hike": + 'season = "July to August"\nmonths = [7, 8]\n' + 'season_basis = "source"\n' + 'start_lonlat = [-100.0, 35.0]\nend_lonlat = [-100.0, 35.2]\n'}), + ("target-one", "Target", {"extra_hike": + 'start_lonlat = [-110.0, 43.0]\nend_lonlat = [-110.0, 43.2]\n'}), + ]) + os.makedirs(os.path.join(root, "web")) + with open(os.path.join(root, "web", "place-bounds.toml"), "w") as f: + f.write('[box]\n"US-VT" = [-73.5, 42.7, -71.5, 45.0]\n') + import refresh as R + rec = R.load_toml(os.path.join(root, "target-one", "trail.toml")) + # fixture records claim line_file "" so sampling uses the ends + rec["source"]["line_file"] = "line.geojson" + est = E.estimate(root, rec, PARAMS, fetch=warm_with_latitude) + self.assertEqual(est["comparable"], "near-one") + self.assertEqual(est["comparable_phrase"], "June to September") + self.assertEqual([n[0] for n in est["neighbours"]], + ["near-one", "far-one"]) + self.assertEqual(est["confidence"], "low") # the location is a fallback + + +class ProposeCheckTest(unittest.TestCase): + def fit_doc(self, root, passes=True, within1=3, n=4): + os.makedirs(os.path.join(root, "tools"), exist_ok=True) + doc = {"computed": "2026-11-20", "rule_version": E.RULE_VERSION, + "dataset": "test", "period": "2011-2020", + "params": E.Params(5.0, 32.0).as_dict(), + "loo": {"n": n, "within1": within1, "worse": n - within1, + "no_data": 0, "classified": 0.8, "jaccard": 0.6, + "by_group": {}, "by_kind": {}}, + "confidence": None, "bar": E.BAR, "passes": passes} + with open(os.path.join(root, "tools", "season_fit.json"), "w") as f: + json.dump(doc, f) + + def repo_with(self, tmp, trails): + root = TR.make_repo(tmp, trails=trails) + os.makedirs(os.path.join(root, "web")) + with open(os.path.join(root, "web", "place-bounds.toml"), "w") as f: + f.write('[box]\n"US-VT" = [-73.5, 42.7, -71.5, 45.0]\n') + # fixture records name no track file; point them at the default + for tid, _name, _kw in trails: + path = os.path.join(root, tid, "trail.toml") + text = TR.read(root, f"{tid}/trail.toml").replace( + 'line_file = ""', 'line_file = "line.geojson"') + TR.write(path, text) + return root + + ENDS = 'start_lonlat = [-110.0, 43.0]\nend_lonlat = [-110.0, 43.2]\n' + + def test_propose_writes_one_row_per_unsourced_trail(self): + import tempfile, shutil, csv + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp, True) + root = self.repo_with(tmp, [ + ("aaa", "Aaa", {"extra_hike": self.ENDS}), + ("bbb", "Bbb", {"extra_hike": + 'season = "June to September"\nmonths = [6, 7, 8, 9]\n' + 'season_basis = "source"\n' + self.ENDS}), + ("ccc", "Ccc", {"hike": False}), + ]) + stage = os.path.join(tmp, "stage") + n = E.propose(root, PARAMS, mild_fetch, stage) + self.assertEqual(n, 2) # aaa and ccc have no season + with open(os.path.join(stage, "season", "estimates.csv"), + newline="") as f: + rows = list(csv.DictReader(f)) + self.assertEqual([r["id"] for r in rows], ["aaa", "ccc"]) + # the one sourced trail has the same climate, so its June to + # September carries the estimate + self.assertEqual(rows[0]["phrase"], "June to September") + + def est_repo(self, tmp, months_extra): + return self.repo_with(tmp, [ + ("aaa", "Aaa", {"extra_hike": months_extra + self.ENDS}), + ]) + + EST = ('season = "All year"\n' + 'months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n' + 'season_basis = "estimate"\n' + 'season_method = "Judged from climate. Confidence: low."\n') + + def blind_doc(self, root, share=0.77, tested=100): + matched = int(round(share * tested)) + sh = round(matched / tested, 2) + doc = {"date": "2026-11-20", "tested": tested, "matched": matched, "share": sh, + "strict_matched": matched, "strict_share": sh, + "by_confidence": { + "high": {"tested": tested, "matched": matched, "share": sh, + "strict_matched": matched, "strict_share": sh}, + "medium": {"tested": 0, "matched": 0, "share": 0.0, "strict_matched": 0, "strict_share": 0.0}, + "low": {"tested": 0, "matched": 0, "share": 0.0, "strict_matched": 0, "strict_share": 0.0}}} + with open(os.path.join(root, "tools", "season_blind_test.json"), "w") as f: + json.dump(doc, f) + + def record_inputs(self, root, tid="aaa", **change): + rec = E.refresh.load_toml(os.path.join(root, tid, "trail.toml")) + sig = {"points": E.points_signature(root, dict(rec, id=tid))} + sig.update(change) + with open(os.path.join(root, "tools", "season_inputs.json"), "w") as f: + json.dump({tid: sig}, f) + + def checked_repo(self, tmp, **kw): + root = self.est_repo(tmp, self.EST) + self.fit_doc(root) + self.blind_doc(root, **kw) + return root + + @staticmethod + def no_network(lat, lon, elev): + raise AssertionError("the monthly check must not read the climate") + + def test_check_passes_when_nothing_changed_and_reads_no_climate(self): + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp, True) + root = self.checked_repo(tmp) + self.record_inputs(root) + ok, lines = E.check(root, self.no_network) + self.assertTrue(ok, lines) + ok, lines = E.check(root) + self.assertTrue(ok, lines) + + def test_check_flags_an_estimate_whose_location_moved(self): + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp, True) + root = self.checked_repo(tmp) + self.record_inputs(root) + path = os.path.join(root, "aaa", "trail.toml") + with open(path, encoding="utf-8") as f: + text = f.read() + with open(path, "w", encoding="utf-8") as f: + f.write(text.replace("end_lonlat = [-110.0, 43.2]", "end_lonlat = [-111.5, 44.2]")) + ok, lines = E.check(root, self.no_network) + self.assertFalse(ok) + self.assertTrue(any("aaa" in line and "inputs changed" in line and "track or location" in line + for line in lines), lines) + + def test_check_flags_an_estimate_whose_recorded_inputs_differ(self): + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp, True) + root = self.checked_repo(tmp) + self.record_inputs(root, points="0" * 16) + ok, lines = E.check(root, self.no_network) + self.assertFalse(ok) + self.assertTrue(any("aaa" in line and "inputs changed" in line for line in lines), lines) + + def test_the_points_signature_does_not_move_for_changes_that_are_not_the_location(self): + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp, True) + root = self.checked_repo(tmp) + rec = E.refresh.load_toml(os.path.join(root, "aaa", "trail.toml")) + before = E.points_signature(root, dict(rec, id="aaa")) + rec["hike"]["summary"] = "Something else." + self.assertEqual(E.points_signature(root, dict(rec, id="aaa")), before) + + def test_check_flags_an_estimate_with_no_recorded_inputs(self): + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp, True) + root = self.checked_repo(tmp) + ok, lines = E.check(root, self.no_network) + self.assertFalse(ok) + self.assertTrue(any("aaa" in line and "no inputs are recorded" in line for line in lines), lines) + + def test_check_flags_inputs_recorded_for_a_trail_that_is_no_longer_an_estimate(self): + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp, True) + root = self.checked_repo(tmp) + self.record_inputs(root) + with open(os.path.join(root, "tools", "season_inputs.json"), "w") as f: + json.dump({"aaa": {"points": E.points_signature( + root, dict(E.refresh.load_toml(os.path.join(root, "aaa", "trail.toml")), id="aaa"))}, + "gone": {"points": "x"}}, f) + ok, lines = E.check(root) + self.assertFalse(ok) + self.assertTrue(any("gone" in line for line in lines), lines) + + def test_check_fails_when_the_blind_test_is_under_the_bar_on_the_ends_only_measure(self): + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp, True) + root = self.checked_repo(tmp, share=0.6) + self.record_inputs(root) + ok, lines = E.check(root) + self.assertFalse(ok) + self.assertTrue(any("blind test" in line and "ends-only" in line for line in lines), lines) + + def test_the_estimates_command_lists_only_estimates(self): + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp, True) + root = self.repo_with(tmp, [ + ("aaa", "Aaa", {"extra_hike": self.EST + self.ENDS}), + ("bbb", "Bbb", {"extra_hike": 'season = "June"\nmonths = [6]\n' + 'season_basis = "source"\n' + self.ENDS}), + ]) + self.assertEqual(E.estimates(root), ["aaa"]) + + def test_a_season_with_a_method_is_not_a_sourced_season(self): + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp, True) + root = self.repo_with(tmp, [ + ("aaa", "Aaa", {"extra_hike": 'season = "June"\nmonths = [6]\nseason_basis = "sources"\n' + 'season_method = "The pages differ. Confidence: low."\n' + self.ENDS}), + ]) + E._PHRASES.clear() + self.assertEqual(E._phrases(root), {}) + + +class SeasonKindTest(unittest.TestCase): + def test_kinds_of_sourced_seasons(self): + self.assertEqual(E.season_kind(list(range(1, 13))), "year-round") + self.assertEqual(E.season_kind([7, 8, 9]), "alpine") + self.assertEqual(E.season_kind([10, 11, 12, 1, 2, 3, 4]), "cool-season") + self.assertEqual(E.season_kind([4, 5, 6, 7, 8, 9, 10]), "other") + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/tests/test_season_audit.py b/tools/tests/test_season_audit.py new file mode 100644 index 0000000..f1f22e3 --- /dev/null +++ b/tools/tests/test_season_audit.py @@ -0,0 +1,105 @@ +"""Tests for the written audit checklist and the monthly season check. + +Run from the repository root: + python3 -m unittest discover tools/tests +""" +import os +import re +import sys +import unittest + +sys.dont_write_bytecode = True +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +import estimate_season as E # noqa: E402 + +ROOT = E.ROOT + + +def read(*parts): + with open(os.path.join(ROOT, *parts), encoding="utf-8") as f: + return f.read() + + +def section(text, heading): + start = text.index(f"## {heading}") + nxt = text.find("\n## ", start + 1) + return text[start:nxt if nxt != -1 else len(text)] + + +class AuditChecklistTest(unittest.TestCase): + def test_the_audit_checklist_has_a_seasons_section_naming_both_steps(self): + doc = read("docs", "audit.md") + seasons = section(doc, "Seasons") + self.assertIn("estimate_season.py check", seasons) + self.assertIn("estimate_season.py estimates", seasons) + self.assertIn("docs/season-research.md", seasons) + self.assertIn("search afresh for a page that states the season", seasons.lower().replace("\n", " ")) + self.assertIn("downloads nothing", seasons) + self.assertIn("fixed published dataset", seasons) + self.assertIn("1. ", seasons) + self.assertIn("2. ", seasons) + + def test_the_commands_it_names_exist(self): + import contextlib + import io + import season_judge + for module, subs in ((E, ("check", "estimates")), (season_judge, ("inputs", "packets", "score", "proposals"))): + for sub in subs: + out = io.StringIO() + with contextlib.redirect_stdout(out), self.assertRaises(SystemExit) as stop: + module.main([sub, "--help"]) + self.assertEqual(stop.exception.code, 0, sub) + self.assertIn(f" {sub}", out.getvalue()) + + def test_every_command_in_the_audit_runs_as_written(self): + """Each `python3 tools/