Commit 93bf7aea authored by Paul Rougieux's avatar Paul Rougieux
Browse files

Move road closure pages to impl_opus/index.html and impl_sonnet/index.html

The site build only publishes events/<date>/<name>/index.html.

Co-Authored-By: default avatarClaude Opus 5.5 <noreply@anthropic.com>
parent 80c15338
Loading
Loading
Loading
Loading
Loading
+1 −2
Changes for events/20261021/impl_opus/.gitignore: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -5,6 +5,5 @@ __pycache__/
*.pyc
cache/

# Generated outputs: keep only the HTML pages in git
# Generated outputs (the page itself is index.html in this folder)
output/*
!output/*.html
+4 −4
Changes for events/20261021/impl_opus/05_page.py: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ BRIDGE=gelbingen). Buttons at the top switch between them; the data of each
bridge (figures and map layers) is embedded as JSON; one Leaflet map shows
the layer group of the active bridge.

Output: output/index.html, one self-contained file (Leaflet and the OSM tiles load from the web)
Output: index.html (in this folder), one self-contained file (Leaflet and the OSM tiles load from the web)
"""

import html
@@ -18,7 +18,7 @@ import networkx as nx
import osmnx as ox
import pandas as pd

from common import OUTPUT, load_config, run_dir
from common import HERE, OUTPUT, load_config, run_dir

N_ROUTES = 8  # main OD routes drawn on the map
WITH_COLOR, WITHOUT_COLOR = "#2a78d6", "#eb6834"
@@ -390,10 +390,10 @@ def main():
            .replace("__DEFAULT__", cfg["bridge"]).replace("__DAYS__", str(cfg["days_per_year"]))
            .replace("__C_WITH__", WITH_COLOR).replace("__C_WITHOUT__", WITHOUT_COLOR)
            .replace("__N_ROUTES__", str(N_ROUTES)))
    (OUTPUT / "index.html").write_text(page, encoding="utf-8")
    (HERE / "index.html").write_text(page, encoding="utf-8")
    for old in OUTPUT.glob("map*.html"):  # separate map files of earlier page versions
        old.unlink()
    print(f"Wrote {OUTPUT / 'index.html'} for {', '.join(data)}")
    print(f"Wrote {HERE / 'index.html'} for {', '.join(data)}")


if __name__ == "__main__":
+3 −5
Changes for events/20261021/impl_opus/README.md: 3 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ python3 -m venv .venv
.venv/bin/python -I 03_routing.py     # t0/t1, d0/d1 for all municipality pairs that cross the bridge
.venv/bin/python -I 03b_bpr.py        # optional, only does something when optional_costs.bpr.enabled
.venv/bin/python -I 04_cost.py        # scaling, cost, sensitivity table -> output/results.json, sensitivity.csv
.venv/bin/python -I 05_page.py        # output/index.html + output/map.html
.venv/bin/python -I 05_page.py        # index.html (one self-contained page)
```

The page covers all three candidate bridges. Run 01-04 once per bridge (`BRIDGE=<key>` overrides
@@ -29,11 +29,11 @@ done
```

04 keeps `data/<bridge>/results.json` and `sensitivity.csv` per bridge (and copies the last run to
`output/`). 05 writes one self-contained file, `output/index.html` (about 0.8 MB): one button per bridge,
`output/`). 05 writes one self-contained file, `index.html` in this folder (about 0.8 MB): one button per bridge,
and the figures and map layers of every bridge embedded as JSON. A single Leaflet map shows the layer group
of the active bridge (buffer circle, municipalities, the 8 main routes with and without the bridge, the
bridge and the count station) and zooms to it. Only Leaflet (cdnjs) and the OpenStreetMap tiles load from
the web; there are no fetch calls and no local iframes, so it works with `python3 -m http.server -d output`,
the web; there are no fetch calls and no local iframes, so it works with `python3 -m http.server`,
GitLab Pages, or as a single file. The choice is kept in the URL hash (`index.html#gelbingen`); the default
is the `bridge:` from the config (oberkochen). Opening the page via `file://` can block the map tiles;
serve it over http.
@@ -152,5 +152,3 @@ does not capture) and when Lkw > 7.5 t are sent over the A 7.
  gravity model against other stations.
- The Hessian corner of a 65 km radius around Künzelsau is not in the OSM extracts (no effect on the
  default bridge).
- `scripts/build_site.py` only picks up `events/YYYYMMDD/<dashboard>/index.html`; this page lives in
  `impl_opus/output/index.html` and is not linked from the site yet.
+1 −2
Changes for events/20261021/impl_sonnet/.gitignore: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,5 @@ __pycache__/
*.pyc
.cache/

# Generated outputs: keep only the HTML pages in git
# Generated outputs (the page itself is index.html in this folder)
output/*
!output/*.html
Loading