rainfall-thresholds 0.3.0__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/PKG-INFO +123 -21
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/README.md +122 -20
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/pyproject.toml +6 -1
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/pyproject.toml.orig +8 -1
- rainfall_thresholds-0.5.0/src/rainfall_thresholds/__init__.py +81 -0
- rainfall_thresholds-0.5.0/src/rainfall_thresholds/antecedent.py +79 -0
- rainfall_thresholds-0.5.0/src/rainfall_thresholds/assess.py +330 -0
- rainfall_thresholds-0.5.0/src/rainfall_thresholds/facts.py +332 -0
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/src/rainfall_thresholds/italy.py +63 -3
- rainfall_thresholds-0.5.0/src/rainfall_thresholds/mcp_server.py +254 -0
- rainfall_thresholds-0.5.0/src/rainfall_thresholds/regional.py +115 -0
- rainfall_thresholds-0.5.0/src/rainfall_thresholds/regional_thresholds.toml +443 -0
- rainfall_thresholds-0.5.0/src/rainfall_thresholds/sources.py +41 -0
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/src/rainfall_thresholds/threshold.py +10 -0
- rainfall_thresholds-0.5.0/src/rainfall_thresholds/trust.py +119 -0
- rainfall_thresholds-0.3.0/src/rainfall_thresholds/__init__.py +0 -36
- rainfall_thresholds-0.3.0/src/rainfall_thresholds/facts.py +0 -150
- rainfall_thresholds-0.3.0/src/rainfall_thresholds/mcp_server.py +0 -126
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/LICENSE +0 -0
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/src/rainfall_thresholds/check.py +0 -0
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/src/rainfall_thresholds/events.py +0 -0
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/src/rainfall_thresholds/fit.py +0 -0
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/src/rainfall_thresholds/measure.py +0 -0
- {rainfall_thresholds-0.3.0 → rainfall_thresholds-0.5.0}/src/rainfall_thresholds/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rainfall-thresholds
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Rainfall intensity-duration thresholds for shallow landslides (Caine power law, frequentist fitting)
|
|
5
5
|
Keywords: landslide,rainfall threshold,intensity-duration,caine,hydrology,natural hazards,italy,italica
|
|
6
6
|
Author: Giuseppe Zileni
|
|
@@ -45,6 +45,7 @@ mark the hours it could not measure as `None`.
|
|
|
45
45
|
|
|
46
46
|
[](https://github.com/agent-engineering-studio/rainfall-thresholds/actions/workflows/ci.yml)
|
|
47
47
|
[](https://pypi.org/project/rainfall-thresholds/)
|
|
48
|
+
[](https://agentengineering.it/rainfall-thresholds/)
|
|
48
49
|
[](https://pypi.org/project/rainfall-thresholds/)
|
|
49
50
|
[](https://github.com/agent-engineering-studio/rainfall-thresholds/blob/main/pyproject.toml)
|
|
50
51
|
[](https://github.com/agent-engineering-studio/rainfall-thresholds/blob/main/LICENSE)
|
|
@@ -59,6 +60,13 @@ catalogue). The blue line is the threshold this library fits: only 5 % of
|
|
|
59
60
|
those storms fall below it. The red star is the storm from the
|
|
60
61
|
[quick start](#quick-start).</sub>
|
|
61
62
|
|
|
63
|
+
**Read the story:** [Basta questa pioggia per far franare?](https://agentengineering.it/blog/soglie-pioggia-frane-rainfall-thresholds/)
|
|
64
|
+
([English](https://agentengineering.it/en/blog/soglie-pioggia-frane-rainfall-thresholds/)),
|
|
65
|
+
the last episode of the Open Data series, after
|
|
66
|
+
[dpc-radar](https://agentengineering.it/blog/pioggia-radar-protezione-civile-dpc-radar/)
|
|
67
|
+
and [ispra-idrogeo](https://agentengineering.it/blog/frane-pericolo-idrogeologico-ispra-idrogeo/).
|
|
68
|
+
**Try it** in the browser: [the intensity-duration plane](https://agentengineering.it/rainfall-thresholds/explainer/).
|
|
69
|
+
|
|
62
70
|
---
|
|
63
71
|
|
|
64
72
|
## Contents
|
|
@@ -77,7 +85,9 @@ those storms fall below it. The red star is the storm from the
|
|
|
77
85
|
- [API at a glance](#api-at-a-glance)
|
|
78
86
|
- [Benchmark](#benchmark)
|
|
79
87
|
- [Notebooks and Docker](#notebooks-and-docker)
|
|
88
|
+
- [A calibration bench for public bodies](#a-calibration-bench-for-public-bodies)
|
|
80
89
|
- [For assistants and agents](#for-assistants-and-agents)
|
|
90
|
+
- [Roadmap: what is measured, what is open](#roadmap-what-is-measured-what-is-open)
|
|
81
91
|
- [Good to know](#good-to-know)
|
|
82
92
|
- [References](#references) · [Citing](#citing) · [Contributing](#contributing)
|
|
83
93
|
|
|
@@ -451,7 +461,7 @@ rainfall part of a simple monitoring loop: a number to watch, not an alert.
|
|
|
451
461
|
|
|
452
462
|
| Name | Kind | What it is |
|
|
453
463
|
|---|---|---|
|
|
454
|
-
| `PowerLawThreshold(alpha, beta)` | frozen dataclass | `I = α·D^(-β)`, with `.intensity(D)`, `.cumulated(D)`, `.exceedance(I, D)` |
|
|
464
|
+
| `PowerLawThreshold(alpha, beta)` | frozen dataclass | `I = α·D^(-β)`, with `.intensity(D)`, `.cumulated(D)`, `.exceedance(I, D)`, `.scaled(factor)` |
|
|
455
465
|
| `reconstruct_events(series, *, no_rain_break_hours, min_event_mm, source=None)` | function | hourly `(datetime, mm or None)` pairs → `list[RainfallEvent]`; `None` is not measured |
|
|
456
466
|
| `strongest_event(events, threshold)` | function | the event furthest above the threshold, or `None` |
|
|
457
467
|
| `latest_event(events)` | function | the event that ended last, or `None` |
|
|
@@ -464,12 +474,27 @@ rainfall part of a simple monitoring loop: a number to watch, not an alert.
|
|
|
464
474
|
| `cutoff_at_budget(ordinary, budget, *, floor=None)` | function | that cutoff |
|
|
465
475
|
| `Skill` | frozen dataclass | `caught`, `landslides`, `alerts`, `ordinary`, `unmeasured`; `.hit_rate`, `.alert_share`, `.discrimination`, `.alerts_per_caught` |
|
|
466
476
|
| `auc(landslides, ordinary)` | function | Mann-Whitney AUC, ties count half |
|
|
467
|
-
| `facts.threshold_facts`, `assess_facts`, `fit_facts` | functions | the same answers as JSON-ready dicts, with units and the alert rule |
|
|
477
|
+
| `facts.threshold_facts`, `assess_facts`, `fit_facts`, `trust_facts`, `margin_facts`, `published_facts` | functions | the same answers as JSON-ready dicts, with units and the alert rule |
|
|
468
478
|
| `check.check_text(text, facts, *, question="")` | function | numbers of a text that are invented, rounded or in the wrong unit → `list[Misquote]` |
|
|
469
|
-
| `mcp_server.create_server()`, `rainfall-thresholds-mcp` | MCP (extra `mcp`) | tools `threshold`, `assess`, `fit`, `
|
|
479
|
+
| `mcp_server.create_server()`, `rainfall-thresholds-mcp` | MCP (extra `mcp`) | tools `threshold`, `assess`, `fit`, `trust`, `margin`, `published`, `check`; stdio or HTTP |
|
|
470
480
|
| `ITALICA_T5` | read-only mapping | `"italy"`, `"northern"`, `"central"`, `"southern"` → `PowerLawThreshold` |
|
|
471
481
|
| `MACROREGIONS` | read-only mapping | macroregion → set of region names (e-ITALICA spelling) |
|
|
472
|
-
| `macroregion_of(region)` | function | region name → macroregion, or `None` |
|
|
482
|
+
| `macroregion_of(region)` | function | region name or ISTAT region code (`8`, `"08"`) → macroregion, or `None` |
|
|
483
|
+
| `ISTAT_REGIONS` | read-only mapping | ISTAT region code → region name |
|
|
484
|
+
| `threshold_for(macroregion, thresholds=ITALICA_T5, *, default="italy")` | function | the threshold of a macroregion, or the default one |
|
|
485
|
+
| `event_against_threshold(hours, threshold, *, no_rain_break_hours, min_event_mm, choice="latest", source=None, radar_gauge_factor=1.0)` | function | `{datetime: mm or None}` → `EventAssessment` or `None` |
|
|
486
|
+
| `EventAssessment` | frozen dataclass | `event`, `threshold`, `borders_unmeasured`; `.threshold_mm_h`, `.threshold_mm`, `.ratio`, `.excess_decades`, `.at_least` |
|
|
487
|
+
| `cumulate(hours, end, *, windows_hours)` | function | the totals of the last N hours → `{N: WindowTotal}`; no total when an hour is not measured |
|
|
488
|
+
| `caine_excess(event, threshold, *, radar_gauge_factor=1.0)` | function | decades above the line, zero on or below it |
|
|
489
|
+
| `api_kohler_linsley(daily_precip_mm, *, decay_k, initial=0.0)` | function | the Antecedent Precipitation Index, mm |
|
|
490
|
+
| `api_factor(api_mm, *, fallback_baseline_mm, fallback_sigma_mm, sigma_min_mm, baseline_mm=None, sigma_mm=None)` | function | an API as a wetness factor in 0..1; 0.5 when not known |
|
|
491
|
+
| `rain_to_threshold(event, threshold, *, more_hours, radar_gauge_factor=1.0)` | function | the rain still needed to reach the line if the event goes on → `{hours: mm}`; not a forecast |
|
|
492
|
+
| `relative_total(hours, end, *, window_hours, reference_mm, saturation, reduction=0.0, longer_references_mm=None)` | function | the last hours against the place's own climatological reference, 0..1; `None` when no hour was read |
|
|
493
|
+
| `EventAssessment.as_record(*, where, licence)` | method | the assessment as a fact of `opendata-record/v2`, a plain dict |
|
|
494
|
+
| `CALIBRATION`, `calibration_of(region)` | mapping, function | how the line sits on the landslides of each region → `Calibration`: `events`, `below`, `.below_share`, `.interval()`, `.position` (`"high"`, `"low"`, `"as fitted"`), `duration_hours` |
|
|
495
|
+
| `load_regional_catalogue()` | function | published regional thresholds with their sources → `RegionalCatalogue` of `RegionalThreshold` and `Source` |
|
|
496
|
+
| `RainSource` | `typing.Protocol` | `hourly(points, start, end) -> dict[datetime, list[float or None]]`: what can feed the package |
|
|
497
|
+
| `point_series(rain, index)` | function | the series of one point out of `RainSource.hourly` |
|
|
473
498
|
|
|
474
499
|
Everything is fully typed (`py.typed`) and checked with `mypy --strict`.
|
|
475
500
|
|
|
@@ -490,40 +515,68 @@ uv run python -m benchmarks.run
|
|
|
490
515
|
|
|
491
516
|
## Notebooks and Docker
|
|
492
517
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
with
|
|
518
|
+
Five [example notebooks](https://github.com/agent-engineering-studio/rainfall-thresholds/tree/main/notebooks):
|
|
519
|
+
the Italian thresholds over the e-ITALICA landslides, the storm of Melito on
|
|
520
|
+
the DPC radar, fitting your own threshold, and how much to trust the line in
|
|
521
|
+
each region with the rain still missing during a storm, with no network; and
|
|
522
|
+
the join with the sister libraries, landslides dated by
|
|
523
|
+
[ispra-idrogeo](https://agentengineering.it/ispra-idrogeo/) against radar rain
|
|
524
|
+
from [dpc-radar](https://agentengineering.it/dpc-radar/). Open them with uv, or
|
|
525
|
+
with Docker alone:
|
|
497
526
|
|
|
498
527
|
```bash
|
|
499
528
|
uv run --group examples jupyter lab notebooks/
|
|
500
|
-
docker
|
|
529
|
+
make docker # the bench (3001), the MCP server (8775), the notebooks (8881)
|
|
530
|
+
docker compose up notebooks # the notebooks alone: http://localhost:8881
|
|
501
531
|
make docker-bench # the benchmark, in a container
|
|
532
|
+
make down # stop and remove the containers
|
|
502
533
|
```
|
|
503
534
|
|
|
504
|
-
|
|
505
|
-
|
|
535
|
+
`make help` lists every command. The containers are named after the library
|
|
536
|
+
(`rainfall-thresholds-ui`, `-mcp`, `-notebooks`) and the ports clash with no
|
|
537
|
+
sister library, so all of them run on one machine; for a second copy of this
|
|
538
|
+
one, change the prefix and the ports (`make docker NAME=rt-dev TARATURA_PORT=3101 ...`).
|
|
539
|
+
|
|
540
|
+
## A calibration bench for public bodies
|
|
541
|
+
|
|
542
|
+
[`app/`](https://github.com/agent-engineering-studio/rainfall-thresholds/tree/main/app)
|
|
543
|
+
is a page in Italian, with Bootstrap Italia, for a public body: it opens on
|
|
544
|
+
the e-ITALICA landslides of its region, fits a threshold on the ones that
|
|
545
|
+
matter, compares it with the national one, measures its cost in false alarms
|
|
546
|
+
on the body's own rain gauge, and exports it. It is not a warning system and
|
|
547
|
+
reads no live rain. `docker compose up taratura`, then http://localhost:3001.
|
|
548
|
+
[Riuso nella PA](https://agentengineering.it/rainfall-thresholds/riuso/)
|
|
549
|
+
says, in Italian, what it does and what stays with the body.
|
|
550
|
+
|
|
551
|
+
To explain what a threshold is, the docs site has
|
|
552
|
+
[Try it](https://agentengineering.it/rainfall-thresholds/explainer/): an
|
|
553
|
+
interactive intensity-duration plane that runs in the browser.
|
|
506
554
|
|
|
507
555
|
## For assistants and agents
|
|
508
556
|
|
|
509
557
|
A language model may word the numbers; it should never compute them. The
|
|
510
558
|
library gives them as data, and checks the words.
|
|
511
559
|
|
|
512
|
-
- **Facts.** `rainfall_thresholds.facts`: `threshold_facts`, `assess_facts
|
|
513
|
-
|
|
560
|
+
- **Facts.** `rainfall_thresholds.facts`: `threshold_facts`, `assess_facts`,
|
|
561
|
+
`fit_facts`, `trust_facts` (how the line sits on the landslides of a
|
|
562
|
+
region), `margin_facts` (the rain still needed if the rain goes on) and
|
|
563
|
+
`published_facts` (the thresholds of the literature for a region, with
|
|
564
|
+
their sources) return plain dicts, with the unit in every key (`_mm`,
|
|
514
565
|
`_mm_h`, `_h`, `_decades`), what the threshold was fitted on, and the rule
|
|
515
566
|
that a threshold exceeded is not an alert.
|
|
516
567
|
- **MCP server.** `pip install "rainfall-thresholds[mcp]"`, then
|
|
517
|
-
`rainfall-thresholds-mcp` on standard input and output
|
|
518
|
-
|
|
519
|
-
|
|
568
|
+
`rainfall-thresholds-mcp` on standard input and output, or over HTTP
|
|
569
|
+
(`--transport streamable-http`, port 8775, `/mcp`; `docker compose up mcp`).
|
|
570
|
+
Seven tools: `threshold`, `assess`, `fit`, `trust`, `margin`, `published`,
|
|
571
|
+
`check`. They compute only from what the call gives them: no network, no
|
|
572
|
+
live rain.
|
|
520
573
|
- **A check of the text.** `check_text(text, facts)` finds numbers invented,
|
|
521
574
|
rounded the wrong way, or in the wrong unit: 30.9 mm written as 30.9 mm/h,
|
|
522
575
|
the trap of every rainfall threshold. It knows that a number is a fact of
|
|
523
576
|
its unit, not that it is said of the right thing.
|
|
524
577
|
- **A faithfulness set.** `benchmarks/faithful.py`: questions, facts, and
|
|
525
578
|
answers written by hand, one faithful and one with known faults; in CI the
|
|
526
|
-
check must find exactly those faults (
|
|
579
|
+
check must find exactly those faults (10 of 10 today). Answers of a model are
|
|
527
580
|
not in it yet.
|
|
528
581
|
- **For coding agents.** [`llms.txt`](https://agentengineering.it/rainfall-thresholds/llms.txt),
|
|
529
582
|
[`llms-full.txt`](https://agentengineering.it/rainfall-thresholds/llms-full.txt)
|
|
@@ -533,12 +586,49 @@ library gives them as data, and checks the words.
|
|
|
533
586
|
The base package still has no dependencies: the MCP SDK comes only with the
|
|
534
587
|
`mcp` extra.
|
|
535
588
|
|
|
589
|
+
## Roadmap: what is measured, what is open
|
|
590
|
+
|
|
591
|
+
The plan is in [#4](https://github.com/agent-engineering-studio/rainfall-thresholds/issues/4),
|
|
592
|
+
and the [roadmap page](https://agentengineering.it/rainfall-thresholds/roadmap/)
|
|
593
|
+
says what each phase measured.
|
|
594
|
+
|
|
595
|
+
- **Done:** the benchmark (#5), the strongest event and hours not measured
|
|
596
|
+
(#6), the functions to measure a threshold (#7), the AI layer (#9), the
|
|
597
|
+
calibration bench, Try it and `publiccode.yml` (#10), notebooks and Docker
|
|
598
|
+
(#14), the rule that the package depends on no sister library (#21).
|
|
599
|
+
- **A pilot on 2026** ([`benchmarks/measures/`](https://github.com/agent-engineering-studio/rainfall-thresholds/tree/main/benchmarks/measures)):
|
|
600
|
+
on 9 dated landslides and Limen's archive of DPC frames, the «Merging»
|
|
601
|
+
caught 7 of 9 with 9.4 alerts per landslide caught; the radar alone 8 of 9
|
|
602
|
+
with 12.25. Nine landslides: a first look, not a validation.
|
|
603
|
+
- **The measure from 2018 to 2025** ([`benchmarks/measures/`](https://github.com/agent-engineering-studio/rainfall-thresholds/tree/main/benchmarks/measures)):
|
|
604
|
+
on the radar history and 4,200 dated landslides, the rain is above T5 at
|
|
605
|
+
the gauge for 95.6 % of the same landslides and on the radar for 66.0 %.
|
|
606
|
+
The threshold still separates on radar rain (AUC 0.85 and 0.73), and a
|
|
607
|
+
threshold fitted on radar rain does not hold: none goes in.
|
|
608
|
+
- **Open, and measured in Limen, not here:** the numbers of
|
|
609
|
+
[limen#243](https://github.com/agent-engineering-studio/limen/issues/243)
|
|
610
|
+
recomputed with `measure` (#7); `strongest_event` against the
|
|
611
|
+
last event on the twelve backtest windows of Limen, before it is switched
|
|
612
|
+
on there.
|
|
613
|
+
|
|
536
614
|
## Good to know
|
|
537
615
|
|
|
538
616
|
- **A threshold is not a forecast.** Rain above T5 means "conditions like
|
|
539
617
|
those that triggered landslides before", not "a landslide will happen
|
|
540
618
|
here". Slope, soil, vegetation and antecedent wetness all matter. Use it
|
|
541
619
|
as one input to a warning system, alongside expert judgement.
|
|
620
|
+
- **The line is not equally good everywhere.** A T5 line leaves 5 % of the
|
|
621
|
+
landslides of its macroregion below it; region by region the share goes
|
|
622
|
+
from 1.3 % in Calabria (4 of 298) to 16.2 % in Valle d'Aosta (11 of 68).
|
|
623
|
+
`calibration_of(region)` says where it sits high, where low, and where the
|
|
624
|
+
landslides are too few to tell (Molise has 17).
|
|
625
|
+
- **A landslide with a day and no hour takes the end of its day.** When you
|
|
626
|
+
pair a dated landslide with hourly rain, the convention of this family of
|
|
627
|
+
libraries is the next local midnight in Europe/Rome after its day, as UTC:
|
|
628
|
+
1 January 2010 is 2010-01-01T23:00Z, 1 July 2010 is 2010-07-01T22:00Z. An
|
|
629
|
+
hour is labelled by its end, so the last hour before the landslide is the
|
|
630
|
+
one ending at that midnight. ispra-idrogeo gives the instant; notebook 04
|
|
631
|
+
shows it.
|
|
542
632
|
- **T5 is deliberately low.** By construction, 95 % of past triggering
|
|
543
633
|
events sit above it: it favours catching events over avoiding false
|
|
544
634
|
alarms.
|
|
@@ -548,12 +638,24 @@ The base package still has no dependencies: the MCP SDK comes only with the
|
|
|
548
638
|
thresholds to events from `reconstruct_events` mixes the two: fine for
|
|
549
639
|
monitoring, worth knowing for a study.
|
|
550
640
|
- **Units are fixed:** hours, millimetres, millimetres per hour.
|
|
641
|
+
- **No sister library inside.** The package imports neither dpc-radar nor
|
|
642
|
+
ispra-idrogeo, and a test keeps it so: [Limen](https://github.com/agent-engineering-studio/limen)
|
|
643
|
+
pins all three, and a library that imported another would tie their
|
|
644
|
+
releases together. The join lives in Limen, in notebook 04 and in `app/`.
|
|
551
645
|
|
|
552
646
|
## Where it's used
|
|
553
647
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
648
|
+
- **[Limen](https://github.com/agent-engineering-studio/limen)**, an open
|
|
649
|
+
early-warning system for landslides, floods and wildfires in Italy, from
|
|
650
|
+
which the library was extracted. It pins `rainfall-thresholds~=0.3.0` for
|
|
651
|
+
the rainfall trigger of its landslide score; the choice of the strongest
|
|
652
|
+
event is in its `landslide.yaml`, off until its backtest measures it.
|
|
653
|
+
- **The Open Data series** of Agent Engineering Studio, with its sister
|
|
654
|
+
libraries [dpc-radar](https://agentengineering.it/dpc-radar/) and
|
|
655
|
+
[ispra-idrogeo](https://agentengineering.it/ispra-idrogeo/).
|
|
656
|
+
- **The calibration bench** in `app/`, for public bodies.
|
|
657
|
+
|
|
658
|
+
Using it somewhere else? [Open an issue](https://github.com/agent-engineering-studio/rainfall-thresholds/issues)
|
|
557
659
|
and tell us: we'd love to list it here.
|
|
558
660
|
|
|
559
661
|
## References
|
|
@@ -19,6 +19,7 @@ mark the hours it could not measure as `None`.
|
|
|
19
19
|
|
|
20
20
|
[](https://github.com/agent-engineering-studio/rainfall-thresholds/actions/workflows/ci.yml)
|
|
21
21
|
[](https://pypi.org/project/rainfall-thresholds/)
|
|
22
|
+
[](https://agentengineering.it/rainfall-thresholds/)
|
|
22
23
|
[](https://pypi.org/project/rainfall-thresholds/)
|
|
23
24
|
[](https://github.com/agent-engineering-studio/rainfall-thresholds/blob/main/pyproject.toml)
|
|
24
25
|
[](https://github.com/agent-engineering-studio/rainfall-thresholds/blob/main/LICENSE)
|
|
@@ -33,6 +34,13 @@ catalogue). The blue line is the threshold this library fits: only 5 % of
|
|
|
33
34
|
those storms fall below it. The red star is the storm from the
|
|
34
35
|
[quick start](#quick-start).</sub>
|
|
35
36
|
|
|
37
|
+
**Read the story:** [Basta questa pioggia per far franare?](https://agentengineering.it/blog/soglie-pioggia-frane-rainfall-thresholds/)
|
|
38
|
+
([English](https://agentengineering.it/en/blog/soglie-pioggia-frane-rainfall-thresholds/)),
|
|
39
|
+
the last episode of the Open Data series, after
|
|
40
|
+
[dpc-radar](https://agentengineering.it/blog/pioggia-radar-protezione-civile-dpc-radar/)
|
|
41
|
+
and [ispra-idrogeo](https://agentengineering.it/blog/frane-pericolo-idrogeologico-ispra-idrogeo/).
|
|
42
|
+
**Try it** in the browser: [the intensity-duration plane](https://agentengineering.it/rainfall-thresholds/explainer/).
|
|
43
|
+
|
|
36
44
|
---
|
|
37
45
|
|
|
38
46
|
## Contents
|
|
@@ -51,7 +59,9 @@ those storms fall below it. The red star is the storm from the
|
|
|
51
59
|
- [API at a glance](#api-at-a-glance)
|
|
52
60
|
- [Benchmark](#benchmark)
|
|
53
61
|
- [Notebooks and Docker](#notebooks-and-docker)
|
|
62
|
+
- [A calibration bench for public bodies](#a-calibration-bench-for-public-bodies)
|
|
54
63
|
- [For assistants and agents](#for-assistants-and-agents)
|
|
64
|
+
- [Roadmap: what is measured, what is open](#roadmap-what-is-measured-what-is-open)
|
|
55
65
|
- [Good to know](#good-to-know)
|
|
56
66
|
- [References](#references) · [Citing](#citing) · [Contributing](#contributing)
|
|
57
67
|
|
|
@@ -425,7 +435,7 @@ rainfall part of a simple monitoring loop: a number to watch, not an alert.
|
|
|
425
435
|
|
|
426
436
|
| Name | Kind | What it is |
|
|
427
437
|
|---|---|---|
|
|
428
|
-
| `PowerLawThreshold(alpha, beta)` | frozen dataclass | `I = α·D^(-β)`, with `.intensity(D)`, `.cumulated(D)`, `.exceedance(I, D)` |
|
|
438
|
+
| `PowerLawThreshold(alpha, beta)` | frozen dataclass | `I = α·D^(-β)`, with `.intensity(D)`, `.cumulated(D)`, `.exceedance(I, D)`, `.scaled(factor)` |
|
|
429
439
|
| `reconstruct_events(series, *, no_rain_break_hours, min_event_mm, source=None)` | function | hourly `(datetime, mm or None)` pairs → `list[RainfallEvent]`; `None` is not measured |
|
|
430
440
|
| `strongest_event(events, threshold)` | function | the event furthest above the threshold, or `None` |
|
|
431
441
|
| `latest_event(events)` | function | the event that ended last, or `None` |
|
|
@@ -438,12 +448,27 @@ rainfall part of a simple monitoring loop: a number to watch, not an alert.
|
|
|
438
448
|
| `cutoff_at_budget(ordinary, budget, *, floor=None)` | function | that cutoff |
|
|
439
449
|
| `Skill` | frozen dataclass | `caught`, `landslides`, `alerts`, `ordinary`, `unmeasured`; `.hit_rate`, `.alert_share`, `.discrimination`, `.alerts_per_caught` |
|
|
440
450
|
| `auc(landslides, ordinary)` | function | Mann-Whitney AUC, ties count half |
|
|
441
|
-
| `facts.threshold_facts`, `assess_facts`, `fit_facts` | functions | the same answers as JSON-ready dicts, with units and the alert rule |
|
|
451
|
+
| `facts.threshold_facts`, `assess_facts`, `fit_facts`, `trust_facts`, `margin_facts`, `published_facts` | functions | the same answers as JSON-ready dicts, with units and the alert rule |
|
|
442
452
|
| `check.check_text(text, facts, *, question="")` | function | numbers of a text that are invented, rounded or in the wrong unit → `list[Misquote]` |
|
|
443
|
-
| `mcp_server.create_server()`, `rainfall-thresholds-mcp` | MCP (extra `mcp`) | tools `threshold`, `assess`, `fit`, `
|
|
453
|
+
| `mcp_server.create_server()`, `rainfall-thresholds-mcp` | MCP (extra `mcp`) | tools `threshold`, `assess`, `fit`, `trust`, `margin`, `published`, `check`; stdio or HTTP |
|
|
444
454
|
| `ITALICA_T5` | read-only mapping | `"italy"`, `"northern"`, `"central"`, `"southern"` → `PowerLawThreshold` |
|
|
445
455
|
| `MACROREGIONS` | read-only mapping | macroregion → set of region names (e-ITALICA spelling) |
|
|
446
|
-
| `macroregion_of(region)` | function | region name → macroregion, or `None` |
|
|
456
|
+
| `macroregion_of(region)` | function | region name or ISTAT region code (`8`, `"08"`) → macroregion, or `None` |
|
|
457
|
+
| `ISTAT_REGIONS` | read-only mapping | ISTAT region code → region name |
|
|
458
|
+
| `threshold_for(macroregion, thresholds=ITALICA_T5, *, default="italy")` | function | the threshold of a macroregion, or the default one |
|
|
459
|
+
| `event_against_threshold(hours, threshold, *, no_rain_break_hours, min_event_mm, choice="latest", source=None, radar_gauge_factor=1.0)` | function | `{datetime: mm or None}` → `EventAssessment` or `None` |
|
|
460
|
+
| `EventAssessment` | frozen dataclass | `event`, `threshold`, `borders_unmeasured`; `.threshold_mm_h`, `.threshold_mm`, `.ratio`, `.excess_decades`, `.at_least` |
|
|
461
|
+
| `cumulate(hours, end, *, windows_hours)` | function | the totals of the last N hours → `{N: WindowTotal}`; no total when an hour is not measured |
|
|
462
|
+
| `caine_excess(event, threshold, *, radar_gauge_factor=1.0)` | function | decades above the line, zero on or below it |
|
|
463
|
+
| `api_kohler_linsley(daily_precip_mm, *, decay_k, initial=0.0)` | function | the Antecedent Precipitation Index, mm |
|
|
464
|
+
| `api_factor(api_mm, *, fallback_baseline_mm, fallback_sigma_mm, sigma_min_mm, baseline_mm=None, sigma_mm=None)` | function | an API as a wetness factor in 0..1; 0.5 when not known |
|
|
465
|
+
| `rain_to_threshold(event, threshold, *, more_hours, radar_gauge_factor=1.0)` | function | the rain still needed to reach the line if the event goes on → `{hours: mm}`; not a forecast |
|
|
466
|
+
| `relative_total(hours, end, *, window_hours, reference_mm, saturation, reduction=0.0, longer_references_mm=None)` | function | the last hours against the place's own climatological reference, 0..1; `None` when no hour was read |
|
|
467
|
+
| `EventAssessment.as_record(*, where, licence)` | method | the assessment as a fact of `opendata-record/v2`, a plain dict |
|
|
468
|
+
| `CALIBRATION`, `calibration_of(region)` | mapping, function | how the line sits on the landslides of each region → `Calibration`: `events`, `below`, `.below_share`, `.interval()`, `.position` (`"high"`, `"low"`, `"as fitted"`), `duration_hours` |
|
|
469
|
+
| `load_regional_catalogue()` | function | published regional thresholds with their sources → `RegionalCatalogue` of `RegionalThreshold` and `Source` |
|
|
470
|
+
| `RainSource` | `typing.Protocol` | `hourly(points, start, end) -> dict[datetime, list[float or None]]`: what can feed the package |
|
|
471
|
+
| `point_series(rain, index)` | function | the series of one point out of `RainSource.hourly` |
|
|
447
472
|
|
|
448
473
|
Everything is fully typed (`py.typed`) and checked with `mypy --strict`.
|
|
449
474
|
|
|
@@ -464,40 +489,68 @@ uv run python -m benchmarks.run
|
|
|
464
489
|
|
|
465
490
|
## Notebooks and Docker
|
|
466
491
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
with
|
|
492
|
+
Five [example notebooks](https://github.com/agent-engineering-studio/rainfall-thresholds/tree/main/notebooks):
|
|
493
|
+
the Italian thresholds over the e-ITALICA landslides, the storm of Melito on
|
|
494
|
+
the DPC radar, fitting your own threshold, and how much to trust the line in
|
|
495
|
+
each region with the rain still missing during a storm, with no network; and
|
|
496
|
+
the join with the sister libraries, landslides dated by
|
|
497
|
+
[ispra-idrogeo](https://agentengineering.it/ispra-idrogeo/) against radar rain
|
|
498
|
+
from [dpc-radar](https://agentengineering.it/dpc-radar/). Open them with uv, or
|
|
499
|
+
with Docker alone:
|
|
471
500
|
|
|
472
501
|
```bash
|
|
473
502
|
uv run --group examples jupyter lab notebooks/
|
|
474
|
-
docker
|
|
503
|
+
make docker # the bench (3001), the MCP server (8775), the notebooks (8881)
|
|
504
|
+
docker compose up notebooks # the notebooks alone: http://localhost:8881
|
|
475
505
|
make docker-bench # the benchmark, in a container
|
|
506
|
+
make down # stop and remove the containers
|
|
476
507
|
```
|
|
477
508
|
|
|
478
|
-
|
|
479
|
-
|
|
509
|
+
`make help` lists every command. The containers are named after the library
|
|
510
|
+
(`rainfall-thresholds-ui`, `-mcp`, `-notebooks`) and the ports clash with no
|
|
511
|
+
sister library, so all of them run on one machine; for a second copy of this
|
|
512
|
+
one, change the prefix and the ports (`make docker NAME=rt-dev TARATURA_PORT=3101 ...`).
|
|
513
|
+
|
|
514
|
+
## A calibration bench for public bodies
|
|
515
|
+
|
|
516
|
+
[`app/`](https://github.com/agent-engineering-studio/rainfall-thresholds/tree/main/app)
|
|
517
|
+
is a page in Italian, with Bootstrap Italia, for a public body: it opens on
|
|
518
|
+
the e-ITALICA landslides of its region, fits a threshold on the ones that
|
|
519
|
+
matter, compares it with the national one, measures its cost in false alarms
|
|
520
|
+
on the body's own rain gauge, and exports it. It is not a warning system and
|
|
521
|
+
reads no live rain. `docker compose up taratura`, then http://localhost:3001.
|
|
522
|
+
[Riuso nella PA](https://agentengineering.it/rainfall-thresholds/riuso/)
|
|
523
|
+
says, in Italian, what it does and what stays with the body.
|
|
524
|
+
|
|
525
|
+
To explain what a threshold is, the docs site has
|
|
526
|
+
[Try it](https://agentengineering.it/rainfall-thresholds/explainer/): an
|
|
527
|
+
interactive intensity-duration plane that runs in the browser.
|
|
480
528
|
|
|
481
529
|
## For assistants and agents
|
|
482
530
|
|
|
483
531
|
A language model may word the numbers; it should never compute them. The
|
|
484
532
|
library gives them as data, and checks the words.
|
|
485
533
|
|
|
486
|
-
- **Facts.** `rainfall_thresholds.facts`: `threshold_facts`, `assess_facts
|
|
487
|
-
|
|
534
|
+
- **Facts.** `rainfall_thresholds.facts`: `threshold_facts`, `assess_facts`,
|
|
535
|
+
`fit_facts`, `trust_facts` (how the line sits on the landslides of a
|
|
536
|
+
region), `margin_facts` (the rain still needed if the rain goes on) and
|
|
537
|
+
`published_facts` (the thresholds of the literature for a region, with
|
|
538
|
+
their sources) return plain dicts, with the unit in every key (`_mm`,
|
|
488
539
|
`_mm_h`, `_h`, `_decades`), what the threshold was fitted on, and the rule
|
|
489
540
|
that a threshold exceeded is not an alert.
|
|
490
541
|
- **MCP server.** `pip install "rainfall-thresholds[mcp]"`, then
|
|
491
|
-
`rainfall-thresholds-mcp` on standard input and output
|
|
492
|
-
|
|
493
|
-
|
|
542
|
+
`rainfall-thresholds-mcp` on standard input and output, or over HTTP
|
|
543
|
+
(`--transport streamable-http`, port 8775, `/mcp`; `docker compose up mcp`).
|
|
544
|
+
Seven tools: `threshold`, `assess`, `fit`, `trust`, `margin`, `published`,
|
|
545
|
+
`check`. They compute only from what the call gives them: no network, no
|
|
546
|
+
live rain.
|
|
494
547
|
- **A check of the text.** `check_text(text, facts)` finds numbers invented,
|
|
495
548
|
rounded the wrong way, or in the wrong unit: 30.9 mm written as 30.9 mm/h,
|
|
496
549
|
the trap of every rainfall threshold. It knows that a number is a fact of
|
|
497
550
|
its unit, not that it is said of the right thing.
|
|
498
551
|
- **A faithfulness set.** `benchmarks/faithful.py`: questions, facts, and
|
|
499
552
|
answers written by hand, one faithful and one with known faults; in CI the
|
|
500
|
-
check must find exactly those faults (
|
|
553
|
+
check must find exactly those faults (10 of 10 today). Answers of a model are
|
|
501
554
|
not in it yet.
|
|
502
555
|
- **For coding agents.** [`llms.txt`](https://agentengineering.it/rainfall-thresholds/llms.txt),
|
|
503
556
|
[`llms-full.txt`](https://agentengineering.it/rainfall-thresholds/llms-full.txt)
|
|
@@ -507,12 +560,49 @@ library gives them as data, and checks the words.
|
|
|
507
560
|
The base package still has no dependencies: the MCP SDK comes only with the
|
|
508
561
|
`mcp` extra.
|
|
509
562
|
|
|
563
|
+
## Roadmap: what is measured, what is open
|
|
564
|
+
|
|
565
|
+
The plan is in [#4](https://github.com/agent-engineering-studio/rainfall-thresholds/issues/4),
|
|
566
|
+
and the [roadmap page](https://agentengineering.it/rainfall-thresholds/roadmap/)
|
|
567
|
+
says what each phase measured.
|
|
568
|
+
|
|
569
|
+
- **Done:** the benchmark (#5), the strongest event and hours not measured
|
|
570
|
+
(#6), the functions to measure a threshold (#7), the AI layer (#9), the
|
|
571
|
+
calibration bench, Try it and `publiccode.yml` (#10), notebooks and Docker
|
|
572
|
+
(#14), the rule that the package depends on no sister library (#21).
|
|
573
|
+
- **A pilot on 2026** ([`benchmarks/measures/`](https://github.com/agent-engineering-studio/rainfall-thresholds/tree/main/benchmarks/measures)):
|
|
574
|
+
on 9 dated landslides and Limen's archive of DPC frames, the «Merging»
|
|
575
|
+
caught 7 of 9 with 9.4 alerts per landslide caught; the radar alone 8 of 9
|
|
576
|
+
with 12.25. Nine landslides: a first look, not a validation.
|
|
577
|
+
- **The measure from 2018 to 2025** ([`benchmarks/measures/`](https://github.com/agent-engineering-studio/rainfall-thresholds/tree/main/benchmarks/measures)):
|
|
578
|
+
on the radar history and 4,200 dated landslides, the rain is above T5 at
|
|
579
|
+
the gauge for 95.6 % of the same landslides and on the radar for 66.0 %.
|
|
580
|
+
The threshold still separates on radar rain (AUC 0.85 and 0.73), and a
|
|
581
|
+
threshold fitted on radar rain does not hold: none goes in.
|
|
582
|
+
- **Open, and measured in Limen, not here:** the numbers of
|
|
583
|
+
[limen#243](https://github.com/agent-engineering-studio/limen/issues/243)
|
|
584
|
+
recomputed with `measure` (#7); `strongest_event` against the
|
|
585
|
+
last event on the twelve backtest windows of Limen, before it is switched
|
|
586
|
+
on there.
|
|
587
|
+
|
|
510
588
|
## Good to know
|
|
511
589
|
|
|
512
590
|
- **A threshold is not a forecast.** Rain above T5 means "conditions like
|
|
513
591
|
those that triggered landslides before", not "a landslide will happen
|
|
514
592
|
here". Slope, soil, vegetation and antecedent wetness all matter. Use it
|
|
515
593
|
as one input to a warning system, alongside expert judgement.
|
|
594
|
+
- **The line is not equally good everywhere.** A T5 line leaves 5 % of the
|
|
595
|
+
landslides of its macroregion below it; region by region the share goes
|
|
596
|
+
from 1.3 % in Calabria (4 of 298) to 16.2 % in Valle d'Aosta (11 of 68).
|
|
597
|
+
`calibration_of(region)` says where it sits high, where low, and where the
|
|
598
|
+
landslides are too few to tell (Molise has 17).
|
|
599
|
+
- **A landslide with a day and no hour takes the end of its day.** When you
|
|
600
|
+
pair a dated landslide with hourly rain, the convention of this family of
|
|
601
|
+
libraries is the next local midnight in Europe/Rome after its day, as UTC:
|
|
602
|
+
1 January 2010 is 2010-01-01T23:00Z, 1 July 2010 is 2010-07-01T22:00Z. An
|
|
603
|
+
hour is labelled by its end, so the last hour before the landslide is the
|
|
604
|
+
one ending at that midnight. ispra-idrogeo gives the instant; notebook 04
|
|
605
|
+
shows it.
|
|
516
606
|
- **T5 is deliberately low.** By construction, 95 % of past triggering
|
|
517
607
|
events sit above it: it favours catching events over avoiding false
|
|
518
608
|
alarms.
|
|
@@ -522,12 +612,24 @@ The base package still has no dependencies: the MCP SDK comes only with the
|
|
|
522
612
|
thresholds to events from `reconstruct_events` mixes the two: fine for
|
|
523
613
|
monitoring, worth knowing for a study.
|
|
524
614
|
- **Units are fixed:** hours, millimetres, millimetres per hour.
|
|
615
|
+
- **No sister library inside.** The package imports neither dpc-radar nor
|
|
616
|
+
ispra-idrogeo, and a test keeps it so: [Limen](https://github.com/agent-engineering-studio/limen)
|
|
617
|
+
pins all three, and a library that imported another would tie their
|
|
618
|
+
releases together. The join lives in Limen, in notebook 04 and in `app/`.
|
|
525
619
|
|
|
526
620
|
## Where it's used
|
|
527
621
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
622
|
+
- **[Limen](https://github.com/agent-engineering-studio/limen)**, an open
|
|
623
|
+
early-warning system for landslides, floods and wildfires in Italy, from
|
|
624
|
+
which the library was extracted. It pins `rainfall-thresholds~=0.3.0` for
|
|
625
|
+
the rainfall trigger of its landslide score; the choice of the strongest
|
|
626
|
+
event is in its `landslide.yaml`, off until its backtest measures it.
|
|
627
|
+
- **The Open Data series** of Agent Engineering Studio, with its sister
|
|
628
|
+
libraries [dpc-radar](https://agentengineering.it/dpc-radar/) and
|
|
629
|
+
[ispra-idrogeo](https://agentengineering.it/ispra-idrogeo/).
|
|
630
|
+
- **The calibration bench** in `app/`, for public bodies.
|
|
631
|
+
|
|
632
|
+
Using it somewhere else? [Open an issue](https://github.com/agent-engineering-studio/rainfall-thresholds/issues)
|
|
531
633
|
and tell us: we'd love to list it here.
|
|
532
634
|
|
|
533
635
|
## References
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "rainfall-thresholds"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.5.0"
|
|
4
4
|
description = "Rainfall intensity-duration thresholds for shallow landslides (Caine power law, frequentist fitting)"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
keywords = [
|
|
@@ -50,17 +50,21 @@ build-backend = "uv_build"
|
|
|
50
50
|
|
|
51
51
|
[dependency-groups]
|
|
52
52
|
dev = [
|
|
53
|
+
"jsonschema>=4.26.0",
|
|
53
54
|
"mcp>=2.3",
|
|
54
55
|
"mypy>=1.13",
|
|
55
56
|
"pytest>=8.3",
|
|
56
57
|
"pytest-asyncio>=0.24",
|
|
57
58
|
"pytest-cov>=6.0",
|
|
58
59
|
"ruff>=0.8",
|
|
60
|
+
"types-jsonschema>=4.26.0.20261006",
|
|
59
61
|
]
|
|
60
62
|
examples = [
|
|
61
63
|
"jupyterlab>=4.2",
|
|
62
64
|
"nbconvert>=7.16",
|
|
63
65
|
"matplotlib>=3.9",
|
|
66
|
+
"dpc-radar~=0.6.0",
|
|
67
|
+
"ispra-idrogeo~=0.14.0",
|
|
64
68
|
]
|
|
65
69
|
docs = [
|
|
66
70
|
"zensical>=0.1.0",
|
|
@@ -92,6 +96,7 @@ select = [
|
|
|
92
96
|
"ARG",
|
|
93
97
|
"B018",
|
|
94
98
|
]
|
|
99
|
+
"docs/make_blog_figures.py" = ["E501"]
|
|
95
100
|
|
|
96
101
|
[tool.mypy]
|
|
97
102
|
strict = true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "rainfall-thresholds"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.5.0"
|
|
4
4
|
description = "Rainfall intensity-duration thresholds for shallow landslides (Caine power law, frequentist fitting)"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
keywords = ["landslide", "rainfall threshold", "intensity-duration", "caine", "hydrology", "natural hazards", "italy", "italica"]
|
|
@@ -41,18 +41,24 @@ build-backend = "uv_build"
|
|
|
41
41
|
|
|
42
42
|
[dependency-groups]
|
|
43
43
|
dev = [
|
|
44
|
+
"jsonschema>=4.26.0",
|
|
44
45
|
"mcp>=2.3",
|
|
45
46
|
"mypy>=1.13",
|
|
46
47
|
"pytest>=8.3",
|
|
47
48
|
"pytest-asyncio>=0.24",
|
|
48
49
|
"pytest-cov>=6.0",
|
|
49
50
|
"ruff>=0.8",
|
|
51
|
+
"types-jsonschema>=4.26.0.20261006",
|
|
50
52
|
]
|
|
51
53
|
|
|
52
54
|
examples = [
|
|
53
55
|
"jupyterlab>=4.2",
|
|
54
56
|
"nbconvert>=7.16",
|
|
55
57
|
"matplotlib>=3.9",
|
|
58
|
+
# Only for notebooks/04: the sister libraries, joined in a notebook as Limen
|
|
59
|
+
# joins them. The package itself never imports them (tests/test_package.py).
|
|
60
|
+
"dpc-radar~=0.6.0",
|
|
61
|
+
"ispra-idrogeo~=0.14.0",
|
|
56
62
|
]
|
|
57
63
|
|
|
58
64
|
docs = [
|
|
@@ -69,6 +75,7 @@ select = ["E", "F", "W", "I", "N", "UP", "B", "C4", "SIM", "ARG", "PTH", "RUF"]
|
|
|
69
75
|
|
|
70
76
|
[tool.ruff.lint.per-file-ignores]
|
|
71
77
|
"tests/**" = ["ARG", "B018"]
|
|
78
|
+
"docs/make_blog_figures.py" = ["E501"] # labels in two languages
|
|
72
79
|
|
|
73
80
|
[tool.mypy]
|
|
74
81
|
strict = true
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""Rainfall intensity-duration thresholds for shallow landslides."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import version
|
|
4
|
+
|
|
5
|
+
from rainfall_thresholds.antecedent import api_factor, api_kohler_linsley
|
|
6
|
+
from rainfall_thresholds.assess import (
|
|
7
|
+
EventAssessment,
|
|
8
|
+
WindowTotal,
|
|
9
|
+
caine_excess,
|
|
10
|
+
cumulate,
|
|
11
|
+
event_against_threshold,
|
|
12
|
+
rain_to_threshold,
|
|
13
|
+
relative_total,
|
|
14
|
+
)
|
|
15
|
+
from rainfall_thresholds.events import (
|
|
16
|
+
RainfallEvent,
|
|
17
|
+
latest_event,
|
|
18
|
+
reconstruct_events,
|
|
19
|
+
strongest_event,
|
|
20
|
+
)
|
|
21
|
+
from rainfall_thresholds.fit import ThresholdFit, fit_threshold, percentile_of
|
|
22
|
+
from rainfall_thresholds.italy import (
|
|
23
|
+
ISTAT_REGIONS,
|
|
24
|
+
ITALICA_T5,
|
|
25
|
+
MACROREGIONS,
|
|
26
|
+
macroregion_of,
|
|
27
|
+
threshold_for,
|
|
28
|
+
)
|
|
29
|
+
from rainfall_thresholds.measure import Skill, auc, cutoff_at_budget, skill, skill_at_budget
|
|
30
|
+
from rainfall_thresholds.regional import (
|
|
31
|
+
RegionalCatalogue,
|
|
32
|
+
RegionalThreshold,
|
|
33
|
+
Source,
|
|
34
|
+
load_regional_catalogue,
|
|
35
|
+
)
|
|
36
|
+
from rainfall_thresholds.sources import RainSource, point_series
|
|
37
|
+
from rainfall_thresholds.threshold import PowerLawThreshold
|
|
38
|
+
from rainfall_thresholds.trust import CALIBRATION, EXPECTED_BELOW, Calibration, calibration_of
|
|
39
|
+
|
|
40
|
+
__version__ = version("rainfall-thresholds")
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
"CALIBRATION",
|
|
44
|
+
"EXPECTED_BELOW",
|
|
45
|
+
"ISTAT_REGIONS",
|
|
46
|
+
"ITALICA_T5",
|
|
47
|
+
"MACROREGIONS",
|
|
48
|
+
"Calibration",
|
|
49
|
+
"EventAssessment",
|
|
50
|
+
"PowerLawThreshold",
|
|
51
|
+
"RainSource",
|
|
52
|
+
"RainfallEvent",
|
|
53
|
+
"RegionalCatalogue",
|
|
54
|
+
"RegionalThreshold",
|
|
55
|
+
"Skill",
|
|
56
|
+
"Source",
|
|
57
|
+
"ThresholdFit",
|
|
58
|
+
"WindowTotal",
|
|
59
|
+
"__version__",
|
|
60
|
+
"api_factor",
|
|
61
|
+
"api_kohler_linsley",
|
|
62
|
+
"auc",
|
|
63
|
+
"caine_excess",
|
|
64
|
+
"calibration_of",
|
|
65
|
+
"cumulate",
|
|
66
|
+
"cutoff_at_budget",
|
|
67
|
+
"event_against_threshold",
|
|
68
|
+
"fit_threshold",
|
|
69
|
+
"latest_event",
|
|
70
|
+
"load_regional_catalogue",
|
|
71
|
+
"macroregion_of",
|
|
72
|
+
"percentile_of",
|
|
73
|
+
"point_series",
|
|
74
|
+
"rain_to_threshold",
|
|
75
|
+
"reconstruct_events",
|
|
76
|
+
"relative_total",
|
|
77
|
+
"skill",
|
|
78
|
+
"skill_at_budget",
|
|
79
|
+
"strongest_event",
|
|
80
|
+
"threshold_for",
|
|
81
|
+
]
|