Examples: notebooks and the demo¶
Notebooks¶
Four notebooks tell what the library does, each saved with its results:
read it like an article, or run it. They are in
notebooks/.
| Notebook | What it shows | Data | |
|---|---|---|---|
| 1 | The river of a town | The Lamone at Faenza: its river cell, five years of history, the forecast with its 51 members. | live: Open-Meteo, no key |
| 2 | The floods we know | 41 Italian floods: which ones the model holds, and the flash floods it does not. | offline: benchmarks/floods.json |
| 3 | What stands behind a forecast peak | Members and runs behind a peak, as facts; "not known" is not zero. | live for today; a replay for May 2023 |
| 4 | Facts, not guesses | The facts, check_text, and what the check cannot see. |
offline: benchmarks/faithful.json |
uv sync --group examples
uv run --group examples jupyter lab notebooks
make notebooks # run them all again and save the results
docker compose --profile notebooks up notebooks # the same in Docker, on http://localhost:8886
The demo¶
A page for a municipality: the river of a place, its history, the forecast and its return period, from data already on disk.
docker compose up # http://localhost:3008
make demo # the same without Docker (uv and Node)
It opens on GLOFAS_EWDS_PLACE (default faenza), or on ?place= in the
address; ?lang=en is English. Its API is demo/api.py: three URLs over
Facts, reading the store and never the network.
Facts for an assistant¶
glofas-ewds init --place "Faenza,11.88,44.29" # once
from glofas_ewds import ANSWER_RULES, Facts, Store
from glofas_ewds.local import data_folder
facts = Facts(Store(data_folder()))
facts.summary("faenza") # the facts, with their source and their age
facts.check_text("faenza", "The peak is 180 m³/s.") # the numbers not in the facts
The package serves no protocol: an assistant, or a tool server, built on it
exposes each method of Facts as a tool and gives the model ANSWER_RULES as
its instructions. See Facts.