diff --git a/CHANGELOG.md b/CHANGELOG.md index 191ddeb..b8d64df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,34 @@ All notable changes to the learning modules. Versions are per module (`manifest.json` and the manifest embedded in `module.html` carry the same number). +## 2026-11-24 — Light theme fast-track (shared theme tokens, two pilot lessons) + +Owner approved the fast-track of docs/vision-2040/findings/module-theme-study-2026-11-24.md. Text, numbers and claims are unchanged; only colours and styles moved. + +### Shared theme (new) +- `shared/theme.css`: `--hy-*` colour tokens for four themes (light, dark, hc-dark, hc-light) and the precedence `html[data-aihydro-theme]` (set by the Studio host) > `forced-colors` > `prefers-color-scheme` > light. Light is the default when nothing signals a theme. Also: dark "plate" tokens for maps, 3-D stages and diagram panels, a paper card for every matplotlib figure (`.aihydro-output img`), token versions of the quiz and focus-ring colours, and a light `@media print` sheet. +- `shared/theme.js`: `HydroTheme.kind() / color(name) / series(i) / dash(i) / onChange(cb)` so SVG, canvas, three.js and Plotly code read the same tokens and redraw on a theme change. +- Tests: `tests/test_theme_tokens.py` (contrast, tinted-panel contrast, colour-vision separation, print block, plate), `tests/js/theme.test.js` (HydroTheme), `tests/test_theme_ratchet.py` + `tests/theme_hex_baseline.json` (hard-coded colour count per lesson only goes down). + +### reading-a-hydrograph 0.4.0 → 0.5.0 +- Fully on the tokens: prose, cards, callouts, the scrolly tour, the three SVG charts (grid, axes and ticks now `--hy-grid`/`--hy-axis`), controls, quiz, buttons and the gradient headings (a solid fallback colour in every theme and in forced-colors). Inactive tour steps are no longer dimmed with `opacity` (that put their text below 4.5:1); the active step is marked by its border. +- The python cell draws its figure in a light "paper" style (white figure, series colours of the shared palette) and the static output was re-rendered; the figure sits on a paper card in all themes. Same data, same plot. + +### watershed-runoff 0.4.0 → 0.5.0 +- Prose, cards, callouts, controls and the quiz on the tokens. The two pre-rendered chart PNGs (white) sit on the paper card; their dots and lines now use colours that read on white (the rational-method worked-example dot is orange, the alt text says so; it was cyan on white). +- Maps (routing canvas, Fish River drop-rain map), both 3-D stages, the poster and the two diagrams stay on a dark plate (`--hy-plate*`) in every theme. See DECISIONS.md. +- The horseshoe scene's blue ambient and cyan key lights are replaced by white lights (the elevation colours were tinted), as the Fish River scene already did; the horseshoe scene sets its own plate-coloured background; both scenes read their line, marker and light colours from the tokens. A test pins white lights and the plate stage for both scenes; the plate is put back after each theme switch in case the host bridge repaints the stage colour. +- Page size 228,789 B → 246,682 B (hard cap 250,000 kept; the added-bytes budget in `tests/test_scene3d.py` 130,000 → 140,000 for the 15 KB of shared theme code). + +### evapotranspiration-budyko 0.1.0 → 0.1.1 +- P0 contrast fix: axis strokes `#475569` (2.6:1 on the page) and the matplotlib `axes.edgecolor` `#334155` (1.8:1) become `#8b949e` (6.4:1), above the 3:1 needed for axes. Static outputs re-rendered (axis colour only). + +### Course intro-to-hydrology 0.4.1 → 0.4.2 +- Version follows the three lessons above; no course content change. + +### Not changed (known, queued) +- The other eight lessons are untouched and stay dark-only until the follow-up migration. `#475569` / `#334155` still appear in capstone-basin-story, dem-to-twi, precipitation-point-to-basin, real-streamflow-data and runoff-generation (same P0 defect, outside this change). + ## 2026-11-17 — dem-to-twi forward claims ### dem-to-twi 0.4.0 → 0.4.1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 324909b..91dc0fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -58,7 +58,7 @@ The embedded block also carries `ai_hydro_preview_min_version`. `scripts/validat ## Branding contract Every module must follow the [AI-Hydro brand guide](https://github.com/AI-Hydro/AI-Hydro/blob/main/branding.md): -- Dark-first design (`#0a0a15` background) +- Themeable: colours come from the shared `--hy-*` tokens (`shared/theme.css`); light by default, dark and high contrast follow the host (`html[data-aihydro-theme]`) or `prefers-color-scheme`. New lessons use the tokens; the brand look (cyan on dark) is the dark theme - Cyan/blue accent palette (`#00A3FF`, `#00DDFF`) - Quicksand (display), Poppins (headings), Nunito (body), JetBrains Mono (code), loaded from the Google Fonts link with system-font fallbacks; that link is the **only** external host a module may reference - AI-Hydro logo in the module header @@ -82,6 +82,7 @@ Code used by more than one module lives in `shared/` and is inlined between `@@B | `shared/ready.js` | one shared promise behind `whenReady()`; never write your own `setInterval` poll | | `shared/quiz.js`, `quiz.css` | the checkpoint engine | | `shared/a11y.js`, `a11y.css` | keyboard sliders, `activatable`, `data-scroll` navigation, live regions, reduced-motion helper, focus styles | +| `shared/theme.css`, `theme.js` | colour tokens for light, dark and high contrast, the dark "plate" for maps and 3-D stages, the paper card for matplotlib figures, print sheet; `HydroTheme` reads them from script (canvas, three.js, Plotly) and fires `onChange`. No new hard-coded colours: `tests/test_theme_ratchet.py` counts them | | `shared/cmap.js` | viridis colour map and shaded-relief renderer (use it instead of red-green scales) | | `shared/geosketch.js` | longitude/latitude SVG sketch of points and polygons | | `shared/lyne_hollick.*`, `shared/d8.*` | the one baseflow filter and D8 pipeline (JS and Python twins) | diff --git a/DECISIONS.md b/DECISIONS.md index da27eb6..7cbdef6 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -56,3 +56,14 @@ Owner approved the pilot ("go ahead with the three.js feasibility check") and ru - **Synthetic content kept.** The horseshoe teaches D8 on terrain whose answer is known; the real basin adds a real divide, real lakes and a task, it does not replace the derivation. Sections 5 and 6 of the old page are now 6 and 7 (rain to runoff, checkpoint). - **Task.** One checkpoint item (question 6): the D8 path length from the highest mesh cell to the outlet. It is a function of the payload and the shared router, recomputed independently with the Python twin (`shared/d8.py`) in the tests. - **Not done / open.** `estimatedMinutes` 40 → 50 for watershed-runoff (review fix); the course total is 430 min, so `estimatedHours` = ceil(430/60) = 8 (7 → 8), the certificate text says "~8 Hours" (certificate 0.1.3 → 0.1.4) and the course abstract for the lesson mentions the Fish River scene. The live canvas was exercised only where WebGL exists in the Browser pane (see PROGRESS); fps on the M2, a pack-mode run with 0 network requests and the installed-build side-by-side with the 2-D V1 figure are still to be done. The dem-to-twi claim that the capstone runs `scene3d`, and the dem-to-twi `whenReady` loop, are untouched. A TWI colour toggle on this mesh (P3) is next if the pilot passes. + +## 2026-11-24 — Light theme fast-track: tokens, plates, paper cards + +- **One token set, light by default.** `shared/theme.css` carries four themes. Values are the study's (module-theme-study-2026-11-24.md section 3.3), with one measured deviation: the light `--hy-ok` is `#176d30`, not `#1a7f37`, because `#1a7f37` was 4.21:1 on the tinted "tip" callout (the study checked it on white and on the card only). `tests/test_theme_tokens.py` now also checks text on tinted panels. Hue alone cannot separate five series in the high-contrast sets, so those define distinct dash patterns (`--hy-dash-*`) and the test requires them. +- **Theme signal.** `html[data-aihydro-theme]` first, then `forced-colors`, then `prefers-color-scheme`, else light. The attribute is set by the Studio host (extension side); this repository only reads it. +- **Plates stay dark in every theme (watershed-runoff).** The Fish River poster is a baked `#0a1622` raster that the drop-rain map also draws, `tools/build_scene3d.py` cannot be re-run without the DEMO-1 evidence (not in this repository), and the study measured that no single background gives both viridis ends 3:1. A light stage was not tried: WebGL is not available outside the AI-Hydro bridge, so legibility there could not be checked here. Kill criterion (b) of the study therefore applies to the 3-D stages: prose, cards and 2-D chart colours follow the theme; stages, maps and the two diagrams sit on a dark plate (`--hy-plate*`, theme-independent, contrast-tested) framed by the page. Outlines are white and the lights white and untinted. Follow-up if wanted: re-render the poster transparent and try `--hy-stage` in a build that has WebGL. +- **Paper card for matplotlib.** Every static or live matplotlib figure sits on `--hy-figure-bg` (white) in all themes (study option (a)); one rendering per figure, so `render_static_outputs.py --check` stays one-to-one. The reading-a-hydrograph cell dropped its dark rcParams for the same reason; the watershed-runoff cells had none (their PNGs were white rectangles on a black page). +- **Tour steps are not dimmed.** `opacity:0.55` on inactive scrolly steps dropped their text below 4.5:1 in light (3.8:1 at the 0.75 opacity tried first); opacity-dimming of text is gone, the active step is marked by border and shadow. +- **Page budget.** watershed-runoff is at 246,682 B of the 250,000 B cap. The added-bytes budget was raised 130,000 → 140,000 for the shared theme code; the cap was not raised. Any further growth in that lesson needs a trim first. +- **Ratchet, not a zero target.** `tests/theme_hex_baseline.json` stores the allowed colour literals per lesson (outside generated regions); it may only go down. Counts before and after are in the file (`main_before` and `max`). + diff --git a/PROGRESS.md b/PROGRESS.md index 59b8924..4af8470 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -33,3 +33,9 @@ Merged the three lesson packets (precipitation-point-to-basin, evapotranspiratio Phase B: course 0.4.0 (eleven modules, ten learning modules plus the certificate, estimatedHours 7), certificate 0.1.3 (counts), renumbered cross-references, DOI scan fixed for SICI-style DOIs, tests tightened (module set equals course set; SYNTHETIC labelling covers the new lessons), generated README/course page/API rebuilt. Verification (no network): `build_modules.py --check`, `render_static_outputs.py --check`, `gen_docs.py --check`, `validate_manifests.py`, `check_csp.py`, `build_api.py --check`, `/opt/miniconda3/bin/python -s -E -m pytest tests -q` (with and without `CAMELS_ROOT`), `node --test tests/js/*.test.js`. Not done: rendering the three new lessons inside the installed AI-Hydro build; owner decisions on the references without DOI (FAO-56, Budyko 1974, NEH-4). + +## 2026-11-24 — Light theme fast-track (Modules side) + +Branch `feat/light-theme-fasttrack`. Shared `theme.css`/`theme.js`; reading-a-hydrograph 0.5.0 and watershed-runoff 0.5.0 on the tokens; evapotranspiration-budyko 0.1.1 axis contrast fix; course 0.4.2; catalog regenerated. Tests: T1 (tokens), T2 (ratchet), T3 (HydroTheme) added; the existing suites pass (see the PR for the commands and counts). +Not done: the other eight lessons; the extension side that sets `data-aihydro-theme` (separate PR); a check in the installed AI-Hydro build (owner's T5); a light stage for the Fish River scene. + diff --git a/README.md b/README.md index ef75f99..e2e6275 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,13 @@ The table is generated from `modules/*/manifest.json` by `python scripts/gen_doc | [Capstone: A Basin's Water Story](modules/capstone-basin-story/) | Catchment analysis | Intro | 60 min | 0.4.0 | | [Congratulations: Course Complete](modules/course-certificate/) | Course completion | Intro | 5 min | 0.1.4 | | [The Shape of the Land: DEM to TWI](modules/dem-to-twi/) | Terrain analysis | Intro | 55 min | 0.4.1 | -| [The Return Flow: Evapotranspiration and the Budyko Curve](modules/evapotranspiration-budyko/) | Evapotranspiration | Intro | 40 min | 0.1.0 | +| [The Return Flow: Evapotranspiration and the Budyko Curve](modules/evapotranspiration-budyko/) | Evapotranspiration | Intro | 40 min | 0.1.1 | | [Rain and Snow: From Gauge to Basin](modules/precipitation-point-to-basin/) | Precipitation | Intro | 35 min | 0.1.0 | -| [Reading a Hydrograph](modules/reading-a-hydrograph/) | Streamflow | Intro | 30 min | 0.4.0 | +| [Reading a Hydrograph](modules/reading-a-hydrograph/) | Streamflow | Intro | 30 min | 0.5.0 | | [Catching the Flow: Real Streamflow Data](modules/real-streamflow-data/) | Streamflow | Intro | 45 min | 0.4.0 | | [Runoff Generation: Infiltration Excess and Saturation Excess](modules/runoff-generation/) | Runoff generation | Intro | 40 min | 0.1.0 | | [The Water Cycle in Motion](modules/water-cycle-in-motion/) | Hydrology fundamentals | Intro | 30 min | 0.3.0 | -| [The Watershed: Where Rain Becomes Runoff](modules/watershed-runoff/) | Watershed hydrology | Intro | 50 min | 0.4.0 | +| [The Watershed: Where Rain Becomes Runoff](modules/watershed-runoff/) | Watershed hydrology | Intro | 50 min | 0.5.0 | ## Contribute a module diff --git a/api/courses.json b/api/courses.json index 62c2403..11ac120 100644 --- a/api/courses.json +++ b/api/courses.json @@ -3,7 +3,7 @@ "courseId": "intro-hydro-2026", "title": "Introduction to Hydrology", "abstract": "A hands-on, animated tour through the whole hydrologic cycle \u2014 from the first flash of water vapour rising off the ocean, through precipitation, evapotranspiration and runoff generation, to a full basin characterisation at your fingertips. Ten learning modules, each showcasing a different interactive capability of the AI-Hydro learning hub, followed by a personalised certificate of completion.", - "version": "0.4.1", + "version": "0.4.2", "author": "Mohammad Galib, Purdue University", "authorAffiliation": "Purdue University", "authorUrl": "https://github.com/mgalib", @@ -132,6 +132,6 @@ "isFeatured": true, "manifestUrl": "https://raw.githubusercontent.com/AI-Hydro/Modules/main/courses/intro-to-hydrology/course.json", "githubUrl": "https://github.com/AI-Hydro/Modules/tree/main/courses/intro-to-hydrology", - "updatedAt": "2026-11-17" + "updatedAt": "2026-11-24" } ] diff --git a/api/modules.json b/api/modules.json index 7206eec..8fd4a5f 100644 --- a/api/modules.json +++ b/api/modules.json @@ -210,7 +210,7 @@ "moduleId": "evapotranspiration-budyko", "title": "The Return Flow: Evapotranspiration and the Budyko Curve", "description": "Compute potential evapotranspiration two ways (Hargreaves\u2013Samani and Priestley\u2013Taylor) from real Daymet weather, reproduce the tabulated CAMELS pet_mean as a check, derive long-term actual evapotranspiration from P \u2212 Q, and place 670 CAMELS basins in Budyko space with a Fu curve whose \u03c9 you fit yourself.", - "version": "0.1.0", + "version": "0.1.1", "license": "CC-BY-4.0", "topic": "evapotranspiration", "level": "intro", @@ -247,7 +247,7 @@ "downloadCount": 0, "githubReactions": 0, "discussionUrl": "", - "updatedAt": "2026-11-17", + "updatedAt": "2026-11-24", "certification": { "metadata_complete": true, "checks_passed": [ @@ -318,7 +318,7 @@ "moduleId": "reading-a-hydrograph", "title": "Reading a Hydrograph", "description": "Anatomy of a storm hydrograph \u2014 rising limb, peak, recession \u2014 with an interactive BFI explorer on a synthetic event, a curve-number storm-pair comparison showing non-linear runoff response, and a live Python cell that plots a real CAMELS-US water year (observed flow and basin precipitation) for three contrasting gauges.", - "version": "0.4.0", + "version": "0.5.0", "license": "CC-BY-4.0", "topic": "streamflow", "level": "intro", @@ -354,7 +354,7 @@ "downloadCount": 0, "githubReactions": 0, "discussionUrl": "", - "updatedAt": "2026-11-17", + "updatedAt": "2026-11-24", "certification": { "metadata_complete": true, "checks_passed": [ @@ -534,7 +534,7 @@ "moduleId": "watershed-runoff", "title": "The Watershed: Where Rain Becomes Runoff", "description": "Define a catchment, trace D8 flow paths across a SYNTHETIC 3-D terrain (depression-filled, drop/distance routing, stream network from flow accumulation), orbit a real basin (the Fish River, Maine, from the Copernicus GLO-30 DEM) and drop rain on it, then turn rainfall into runoff with an executable rational-method cell and an SCS curve-number cell.", - "version": "0.4.0", + "version": "0.5.0", "license": "CC-BY-4.0", "topic": "watershed-hydrology", "level": "intro", @@ -571,7 +571,7 @@ "downloadCount": 0, "githubReactions": 0, "discussionUrl": "", - "updatedAt": "2026-11-17", + "updatedAt": "2026-11-24", "certification": { "metadata_complete": true, "checks_passed": [ diff --git a/courses/intro-to-hydrology/course.json b/courses/intro-to-hydrology/course.json index c72d60e..03d734a 100644 --- a/courses/intro-to-hydrology/course.json +++ b/courses/intro-to-hydrology/course.json @@ -15,7 +15,7 @@ "citation": "Galib, M. (2026). Introduction to Hydrology — an interactive AI-Hydro course. AI-Hydro Learning Hub.", "citationUrl": "https://github.com/AI-Hydro/Modules/tree/main/courses/intro-to-hydrology", "topic": "Hydrology Fundamentals", - "version": "0.4.1", + "version": "0.4.2", "license": "CC-BY-4.0", "abstract": "A hands-on, animated tour through the whole hydrologic cycle — from the first flash of water vapour rising off the ocean, through precipitation, evapotranspiration and runoff generation, to a full basin characterisation at your fingertips. Ten learning modules, each showcasing a different interactive capability of the AI-Hydro learning hub, followed by a personalised certificate of completion.", "kernel": "isolated", diff --git a/modules/evapotranspiration-budyko/manifest.json b/modules/evapotranspiration-budyko/manifest.json index c7e80b3..669aa4d 100644 --- a/modules/evapotranspiration-budyko/manifest.json +++ b/modules/evapotranspiration-budyko/manifest.json @@ -2,7 +2,7 @@ "moduleId": "evapotranspiration-budyko", "title": "The Return Flow: Evapotranspiration and the Budyko Curve", "description": "Compute potential evapotranspiration two ways (Hargreaves–Samani and Priestley–Taylor) from real Daymet weather, reproduce the tabulated CAMELS pet_mean as a check, derive long-term actual evapotranspiration from P − Q, and place 670 CAMELS basins in Budyko space with a Fu curve whose ω you fit yourself.", - "version": "0.1.0", + "version": "0.1.1", "license": "CC-BY-4.0", "topic": "evapotranspiration", "level": "intro", diff --git a/modules/evapotranspiration-budyko/module.html b/modules/evapotranspiration-budyko/module.html index 441cc1d..ba10e57 100644 --- a/modules/evapotranspiration-budyko/module.html +++ b/modules/evapotranspiration-budyko/module.html @@ -12,7 +12,7 @@ { "id": "evapotranspiration-budyko", "title": "The Return Flow: Evapotranspiration and the Budyko Curve", - "version": "0.1.0", + "version": "0.1.1", "authors": [ { "name": "Mohammad Galib", @@ -322,7 +322,7 @@
data/PROVENANCE.json. Table values are rounded to four decimals (recorded there).Probe by dragging, or focus the number and use the arrow keys: @@ -513,9 +697,9 @@
data/PROVENANCE.json.Focus the map and use the arrow keys to move the cursor.
Focus the map and use the arrow keys to move the cursor.
SYNTHETIC rational-method example A = 92.16 ha (921,600 m²), C = 0.35, i = 40.0 mm/h Q = 3.584 m³/s (= C·i·A/360 = 3.584) Valid for: steady uniform rain at least as long as the time of concentration, - constant C, small catchment. Not a measured flood.
CN = 75: S = 84.7 mm, Ia = 16.9 mm storm P = 40.0 mm -> runoff Q = 4.94 mm (Q/P = 0.123), volume = 4,552 m³ - storm P = 80.0 mm -> runoff Q = 26.92 mm (Q/P = 0.337), volume = 24,812 m³
watershed-runoff · v0.4.0watershed-runoff · v0.5.0intro-hydro-2026