Skip to main content

rainfall-thresholds

How much rain does it take to set off a landslide? A small, dependency-free Python library that answers that question with the rainfall thresholds used in landslide science: turn an hourly rain-gauge series into rainfall events, compare them with a threshold, and fit your own threshold from past landslides. It ships ready-to-use thresholds for Italy, fitted on 5,974 real landslides.

A threshold exceeded is not an alert. It says the rain is like the rain that triggered landslides before. The official alert in Italy is the criticality bulletin of the Dipartimento della Protezione Civile.

What it does not do. It does not fetch rain: you bring the series, from a gauge, a radar or a model. It does not say where a landslide will happen, and it does not issue warnings. It does not know whether your radar can see: mark the hours it could not measure as None.

ci PyPI docs Python Dependencies: none License: Apache-2.0

Log-log chart of rainfall duration against mean intensity. Thousands of grey dots, each a rainfall event that triggered a landslide in Italy, sit above a blue line, the T5 threshold. A red star marks an example storm of 82 mm in 10 hours, well above the line.

Every grey dot is a storm that triggered a landslide in Italy (e-ITALICA catalogue). The blue line is the threshold this library fits: only 5 % of those storms fall below it. The red star is the storm from the quick start.

Read the story: Basta questa pioggia per far franare? (English), the last episode of the Open Data series, after dpc-radar and ispra-idrogeo. Try it in the browser: the intensity-duration plane.


Contents

The idea in 30 seconds

Shallow landslides start when the soil gets too wet. What makes it too wet is a mix of how hard it rains and for how long:

  • a short, violent downpour can do it: 30 mm in 2 hours;
  • so can a long, gentle rain: 60 mm over three days.

In 1980 Nels Caine noticed that, on a log-log chart of duration against mean intensity, the storms that triggered landslides sit above a straight line. That line is the rainfall threshold:

I = α · D^(-β)

I  mean rainfall intensity (mm/h)
D  rainfall duration (hours)
α  how high the line sits     β  how fast it drops with duration

Above the line: rain like the rain that triggered landslides in the past. Below it: rain that very rarely did. That is all a threshold says, and it is why thresholds are at the heart of many landslide early-warning systems.

This library gives you the three pieces around that line, in plain Python with no dependencies.

How it works

flowchart LR
    A["🌧️ Hourly rain<br/>(timestamp, mm)"] -->|reconstruct_events| B["Rainfall events<br/>duration · total · intensity"]
    B -->|strongest_event| C["Event that matters"]
    C -->|"threshold.exceedance()"| D{"Above the<br/>threshold?"}
    D -->|"> 0"| E["⚠️ Conditions like<br/>past landslides"]
    D -->|"< 0"| F["✅ Below the line"]

    G["📚 Past landslides<br/>(duration, intensity)"] -->|fit_threshold| H["PowerLawThreshold<br/>α, β"]
    I["🇮🇹 ITALICA_T5<br/>ready-made for Italy"] --> H
    H --> D
Step What you have What you call What you get
1 an hourly rain series reconstruct_events, strongest_event rainfall events, each with duration, total and intensity
2 an event and a threshold PowerLawThreshold.intensity / .cumulated / .exceedance how much rain the threshold needs, and how far above or below it you are
3 a catalogue of landslide-triggering events fit_threshold your own threshold

Install

pip install rainfall-thresholds

Python 3.12 or newer. No dependencies: not even NumPy.

Quick start

A storm over Calabria, southern Italy: 82 mm in about ten hours. Is it landslide weather?

from datetime import UTC, datetime, timedelta

from rainfall_thresholds import ITALICA_T5, macroregion_of, reconstruct_events, strongest_event

# Hourly rain from a gauge, in mm
start = datetime(2026, 10, 10, tzinfo=UTC)
hourly_mm = [0, 2, 8, 15, 22, 18, 9, 4, 0, 1, 3, 0, 0]
series = [(start + timedelta(hours=h), mm) for h, mm in enumerate(hourly_mm)]

# 1. Pick the threshold for the region
threshold = ITALICA_T5[macroregion_of("Calabria") or "italy"]  # "southern"

# 2. Cut the series into rainfall events and take the one that matters
events = reconstruct_events(series, no_rain_break_hours=6, min_event_mm=2.0)
event = strongest_event(events, threshold)
assert event is not None

# 3. Compare
print(f"{event.total_mm:.0f} mm in {event.duration_hours:.0f} h = {event.intensity_mm_h:.1f} mm/h")
print(f"T5 at that duration: {threshold.intensity(event.duration_hours):.1f} mm/h")
print(f"{threshold.exceedance(event.intensity_mm_h, event.duration_hours):+.2f} decades")
82 mm in 10 h = 8.2 mm/h
T5 at that duration: 2.0 mm/h
+0.62 decades

The storm is about four times as intense as the threshold (10^0.62 ≈ 4.2): it is the red star in the chart at the top.

Step by step

1. From hourly rain to rainfall events

A rain gauge gives you one number per hour. A threshold needs events: a start, an end, a total. reconstruct_events cuts the series with two simple rules:

  • no_rain_break_hours: this many dry hours in a row end an event;
  • min_event_mm: events with less rain than this are dropped as noise.

An event runs from its first to its last wet hour, so short dry spells inside a storm stay in the same event.

Bar chart of 36 hours of rain. Hours 1 to 9 form event 1, 30 mm in 9 hours, despite a 2-hour dry gap. Eight dry hours close it. A 1 mm drizzle at hours 18 and 19 is dropped. Hours 28 to 33 form event 2, 33 mm in 6 hours.
threshold = ITALICA_T5["southern"]
events = reconstruct_events(series, no_rain_break_hours=6, min_event_mm=2.0)
for e in events:
    print(e.start, e.end, e.duration_hours, e.total_mm, e.intensity_mm_h)

current = strongest_event(events, threshold)  # the event furthest above the threshold

Which event? A storm, six dry hours and then a little drizzle are two events. latest_event gives the drizzle; strongest_event gives the storm. For monitoring, pass the events of the window you watch (for example the last 48 hours) to strongest_event, so an old storm does not stay forever.

Each event is a frozen RainfallEvent with start, end, duration_hours, total_mm, unmeasured_hours, source and the intensity_mm_h and fully_measured properties.

Not measured is not dry. The series should be hourly and without gaps: a dry hour is 0, an hour that was not measured (a missing frame, a gauge that did not report, a place the radar cannot see) is None. A None hour adds no rain and does not count towards the dry break, so a gap never splits an event. The event counts it in unmeasured_hours, and its total is then a lower bound. If your gauge skips dry hours, fill them in with 0.

Give the events a source (reconstruct_events(..., source="DPC SRT1")): the Italian thresholds are fitted on rain gauges, and radar rain is not gauge rain. The label is carried, never interpreted.

2. Comparing an event with a threshold

A PowerLawThreshold answers three questions for an event of a given duration:

Method Question Unit
intensity(D) How intense must rain be, on average, to reach the line? mm/h
cumulated(D) How much rain in total must fall to reach the line? mm
exceedance(I, D) How far above (+) or below (−) the line is this event? decades

cumulated is usually the easiest to talk about. With the threshold for northern Italy:

from rainfall_thresholds import ITALICA_T5

t = ITALICA_T5["northern"]
for d in (1, 6, 24, 72):
    print(f"{d:>3} h  {t.cumulated(d):5.1f} mm  {t.intensity(d):5.2f} mm/h")
  1 h    6.4 mm   6.40 mm/h
  6 h   15.3 mm   2.55 mm/h
 24 h   30.0 mm   1.25 mm/h
 72 h   51.3 mm   0.71 mm/h

Longer rain needs more water in total, but less per hour.

Reading exceedance. It is log10(I / I(D)), so it is scale-free and easy to put on a dashboard. Four 24-hour events against the national threshold (28 mm in 24 h):

Rain in 24 h Mean intensity exceedance In words
12 mm 0.5 mm/h −0.37 well below the line
24 mm 1.0 mm/h −0.07 just below
58 mm 2.4 mm/h +0.31 twice the threshold intensity
288 mm 12 mm/h +1.01 ten times: an extreme event

A dry event (zero intensity) gives -inf.

3. Fitting your own threshold

Have a list of landslides and the rain that triggered them? Fit a threshold for your own area:

from rainfall_thresholds import fit_threshold

# (duration in hours, mean intensity in mm/h) of rain that triggered landslides
triggering_events = [
    (3, 9.0),
    (5, 4.0),
    (6, 6.5),
    (10, 5.5),
    (12, 3.1),
    (24, 2.4),
    (30, 1.4),
    (48, 1.1),
    (72, 1.0),
    (96, 0.6),
]

fit = fit_threshold(triggering_events, percentile=5)
t = fit.threshold
print(f"T5: I = {t.alpha:.2f} · D^-{t.beta:.3f}   ({fit.n_events} events)")
print(f"at 24 h: {t.intensity(24):.2f} mm/h, i.e. {t.cumulated(24):.0f} mm")
T5: I = 14.78 · D^-0.737   (10 events)
at 24 h: 1.42 mm/h, i.e. 34 mm

(Ten events are enough for an example, not for a real threshold: published thresholds use hundreds.)

What fit_threshold does, in two steps:

  1. Best-fit line. Least squares on log I against log D through all the events: the orange line below, returned as fit.central.
  2. Lower it. Slide the line down, keeping its slope, until only percentile % of the events sit beneath it: the blue line, returned as fit.threshold. With percentile=5 this is the T5 threshold.
Left: the e-ITALICA events on a log-log chart with an orange best-fit line and a parallel blue line lower down, the T5 threshold. Right: a histogram of the distance of each event from the best-fit line; the lowest 5 percent, left of -0.45, are highlighted in blue.

This is the frequentist method of Brunetti et al. (2010) and Peruccacci et al. (2012), with one difference: they take the percentile from a Gaussian fitted to a kernel density of the residuals; this package takes it straight from the residuals. The two agree when the residuals are close to normal, and the empirical one makes no assumption about their shape.

4. Measuring what it costs

T5 catches 95 % of past landslides by construction. What it does not say is how often it is exceeded when nothing happens. The measure functions answer both on the same scale, for any score that grows with danger (an exceedance, a 24-hour total, a probability):

from rainfall_thresholds import auc, skill, skill_at_budget

# For each landslide, the highest score in the hours before it.
landslides = [0.62, 0.31, 0.05, -0.08, 0.44]
# For each unit you could alert on (cell-hours, municipality-days...).
ordinary = [-0.9, -0.4, -0.2, 0.1, -0.6, -0.3, 0.2, -1.1, -0.5, -0.7]

s = skill(landslides, ordinary, cutoff=0.0)  # above the threshold = alert
print(f"caught {s.caught} of {s.landslides}, {s.alert_share:.0%} of units on alert")
print(f"discrimination {s.discrimination:.1f}, {s.alerts_per_caught:.1f} alerts per landslide")

fair = skill_at_budget(landslides, ordinary, budget=0.10)  # 10 % of units on alert
print(f"at a 10 % budget: caught {fair.caught} of {fair.landslides}")
print(f"AUC {auc(landslides, ordinary):.2f}")
caught 4 of 5, 20% of units on alert
discrimination 4.0, 0.5 alerts per landslide
at a 10 % budget: caught 3 of 5
AUC 0.92

To compare two scores, compare them at the same budget: counting at a fixed level rewards the score that alerts more. None is a score that was not measured: it is left out and counted in unmeasured, never read as zero. The definitions are those of Limen's backtests, and on the same inputs the results are identical.

What this gives on real data was measured in Limen (limen#243), with the national curve on model rain (ERA5): 40.7 % of the e-ITALICA landslides above the threshold against 3.0 % of ordinary moments, and 0 of 286 landslides caught in the regions held out. A threshold fitted on rain gauges and applied to other rain is not the same threshold.

Thresholds for Italy

ITALICA_T5 holds four T5 thresholds fitted with fit_threshold(percentile=5) on the 5,974 events of e-ITALICA v4 with a positive duration and cumulated rainfall:

Key α (mm/h) β Events Rain needed in 24 h in 72 h
"italy" 7.193 0.5685 5,974 28.3 mm 45.5 mm
"northern" 6.400 0.5134 2,659 30.0 mm 51.3 mm
"central" 7.953 0.6085 1,890 27.6 mm 42.4 mm
"southern" 8.754 0.6449 1,425 27.1 mm 40.0 mm
Line chart of the rain needed to reach T5 against duration, up to 168 hours, for Italy and its three macroregions. The lines overlap up to about 12 hours; after that the northern threshold needs the most rain, about 78 mm in a week, and the southern the least, about 54 mm.

For short bursts the regions behave alike; over days, the north needs noticeably more rain than the south before landslides start.

Pick the threshold from the region name with macroregion_of:

from rainfall_thresholds import ITALICA_T5, macroregion_of

macroregion_of("Liguria")  # "northern"
macroregion_of("Abruzzo")  # "central"
macroregion_of("Bavaria")  # None: not an Italian region

threshold = ITALICA_T5[macroregion_of("Sicilia") or "italy"]

Abruzzo and Molise are in the centre, unlike the ISTAT "Sud". Use macroregion_of (or MACROREGIONS) rather than an ISTAT table, or the threshold will not be the one fitted on that region's landslides.

These numbers are reproducible, not copied: the catalogue ships with the tests and tests/test_italy.py refits all four thresholds from it on every run. They are not the thresholds published by the e-ITALICA authors, who use their own method and partitions; they are what this package's method gives on their data.

Recipe: check a rain gauge

Read an hourly CSV, find the current rainfall event and see where it stands:

import csv
from datetime import datetime

from rainfall_thresholds import ITALICA_T5, macroregion_of, reconstruct_events, strongest_event

with open("gauge.csv", encoding="utf-8") as f:  # columns: time, rain_mm (empty: not measured)
    series = [
        (datetime.fromisoformat(r["time"]), float(r["rain_mm"]) if r["rain_mm"] else None)
        for r in csv.DictReader(f)
    ]

threshold = ITALICA_T5[macroregion_of("Liguria") or "italy"]
events = reconstruct_events(series, no_rain_break_hours=6, min_event_mm=2.0, source="rain gauge")
event = strongest_event(events, threshold)

if event is None:
    print("No rain event in the window")
else:
    e = threshold.exceedance(event.intensity_mm_h, event.duration_hours)
    needed = threshold.cumulated(event.duration_hours)
    print(
        f"{event.start:%d %b %H:%M} → {event.end:%H:%M}: {event.total_mm:.0f} mm "
        f"(T5 needs {needed:.0f} mm in {event.duration_hours:.0f} h) → {e:+.2f}"
    )
10 Oct 01:00 → 07:00: 78 mm (T5 needs 16 mm in 7 h) → +0.67

Run it every hour on the last two or three days of data and you have the rainfall part of a simple monitoring loop: a number to watch, not an alert.

API at a glance

Name Kind What it is
PowerLawThreshold(alpha, beta) frozen dataclass I = α·D^(-β), with .intensity(D), .cumulated(D), .exceedance(I, D), .scaled(factor)
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
strongest_event(events, threshold) function the event furthest above the threshold, or None
latest_event(events) function the event that ended last, or None
RainfallEvent frozen dataclass start, end, duration_hours, total_mm, unmeasured_hours, source, .intensity_mm_h, .fully_measured
fit_threshold(events, *, percentile=5.0) function (D, I) pairs → ThresholdFit
ThresholdFit frozen dataclass threshold, central, percentile, n_events
percentile_of(values, percentile) function linear-interpolation percentile, same as NumPy's default
skill(landslides, ordinary, cutoff) function landslides caught and units on alert at a cutoff → Skill
skill_at_budget(landslides, ordinary, budget, *, floor=None) function the same at the cutoff that puts budget of the units on alert
cutoff_at_budget(ordinary, budget, *, floor=None) function that cutoff
Skill frozen dataclass caught, landslides, alerts, ordinary, unmeasured; .hit_rate, .alert_share, .discrimination, .alerts_per_caught
auc(landslides, ordinary) function Mann-Whitney AUC, ties count half
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
check.check_text(text, facts, *, question="") function numbers of a text that are invented, rounded or in the wrong unit → list[Misquote]
mcp_server.create_server(), rainfall-thresholds-mcp MCP (extra mcp) tools threshold, assess, fit, trust, margin, published, check; stdio or HTTP
ITALICA_T5 read-only mapping "italy", "northern", "central", "southern" → PowerLawThreshold
MACROREGIONS read-only mapping macroregion → set of region names (e-ITALICA spelling)
macroregion_of(region) function region name or ISTAT region code (8, "08") → macroregion, or None
ISTAT_REGIONS read-only mapping ISTAT region code → region name
threshold_for(macroregion, thresholds=ITALICA_T5, *, default="italy") function the threshold of a macroregion, or the default one
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
EventAssessment frozen dataclass event, threshold, borders_unmeasured; .threshold_mm_h, .threshold_mm, .ratio, .excess_decades, .at_least
cumulate(hours, end, *, windows_hours) function the totals of the last N hours → {N: WindowTotal}; no total when an hour is not measured
caine_excess(event, threshold, *, radar_gauge_factor=1.0) function decades above the line, zero on or below it
api_kohler_linsley(daily_precip_mm, *, decay_k, initial=0.0) function the Antecedent Precipitation Index, mm
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
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
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
EventAssessment.as_record(*, where, licence) method the assessment as a fact of opendata-record/v2, a plain dict
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
load_regional_catalogue() function published regional thresholds with their sources → RegionalCatalogue of RegionalThreshold and Source
RainSource typing.Protocol hourly(points, start, end) -> dict[datetime, list[float or None]]: what can feed the package
point_series(rain, index) function the series of one point out of RainSource.hourly

Everything is fully typed (py.typed) and checked with mypy --strict.

Benchmark

A fixed set of known cases runs in CI: the storm of Melito di Porto Salvo on 10 October 2026 on the DPC radar, six e-ITALICA landslides, and two cases built to test one rule each. 0.1.0 passed 9 of 16 checks: it forgot a storm when a little drizzle followed it, and could not take an hour that was not measured. With strongest_event and None the library passes 13 of 16. The three it misses are landslides under T5, as T5 allows by construction. The details, and what is not there yet, are in benchmarks/.

uv run python -m benchmarks.run

Notebooks and Docker

Five example notebooks: the Italian thresholds over the e-ITALICA landslides, the storm of Melito on the DPC radar, fitting your own threshold, and how much to trust the line in each region with the rain still missing during a storm, with no network; and the join with the sister libraries, landslides dated by ispra-idrogeo against radar rain from dpc-radar. Open them with uv, or with Docker alone:

uv run --group examples jupyter lab notebooks/
make docker                    # the bench (3001), the MCP server (8775), the notebooks (8881)
docker compose up notebooks    # the notebooks alone: http://localhost:8881
make docker-bench              # the benchmark, in a container
make down                      # stop and remove the containers

make help lists every command. The containers are named after the library (rainfall-thresholds-ui, -mcp, -notebooks) and the ports clash with no sister library, so all of them run on one machine; for a second copy of this one, change the prefix and the ports (make docker NAME=rt-dev TARATURA_PORT=3101 ...).

A calibration bench for public bodies

app/ is a page in Italian, with Bootstrap Italia, for a public body: it opens on the e-ITALICA landslides of its region, fits a threshold on the ones that matter, compares it with the national one, measures its cost in false alarms on the body's own rain gauge, and exports it. It is not a warning system and reads no live rain. docker compose up taratura, then http://localhost:3001. Riuso nella PA says, in Italian, what it does and what stays with the body.

To explain what a threshold is, the docs site has Try it: an interactive intensity-duration plane that runs in the browser.

For assistants and agents

A language model may word the numbers; it should never compute them. The library gives them as data, and checks the words.

  • Facts. rainfall_thresholds.facts: threshold_facts, assess_facts, fit_facts, trust_facts (how the line sits on the landslides of a region), margin_facts (the rain still needed if the rain goes on) and published_facts (the thresholds of the literature for a region, with their sources) return plain dicts, with the unit in every key (_mm, _mm_h, _h, _decades), what the threshold was fitted on, and the rule that a threshold exceeded is not an alert.
  • MCP server. pip install "rainfall-thresholds[mcp]", then rainfall-thresholds-mcp on standard input and output, or over HTTP (--transport streamable-http, port 8775, /mcp; docker compose up mcp). Seven tools: threshold, assess, fit, trust, margin, published, check. They compute only from what the call gives them: no network, no live rain.
  • A check of the text. check_text(text, facts) finds numbers invented, rounded the wrong way, or in the wrong unit: 30.9 mm written as 30.9 mm/h, the trap of every rainfall threshold. It knows that a number is a fact of its unit, not that it is said of the right thing.
  • A faithfulness set. benchmarks/faithful.py: questions, facts, and answers written by hand, one faithful and one with known faults; in CI the check must find exactly those faults (10 of 10 today). Answers of a model are not in it yet.
  • For coding agents. llms.txt, llms-full.txt and an agent skill with the traps a model falls into when it writes this code from memory.

The base package still has no dependencies: the MCP SDK comes only with the mcp extra.

Roadmap: what is measured, what is open

The plan is in #4, and the roadmap page says what each phase measured.

  • Done: the benchmark (#5), the strongest event and hours not measured (#6), the functions to measure a threshold (#7), the AI layer (#9), the calibration bench, Try it and publiccode.yml (#10), notebooks and Docker (#14), the rule that the package depends on no sister library (#21).
  • A pilot on 2026 (benchmarks/measures/): on 9 dated landslides and Limen's archive of DPC frames, the «Merging» caught 7 of 9 with 9.4 alerts per landslide caught; the radar alone 8 of 9 with 12.25. Nine landslides: a first look, not a validation.
  • The measure from 2018 to 2025 (benchmarks/measures/): on the radar history and 4,200 dated landslides, the rain is above T5 at the gauge for 95.6 % of the same landslides and on the radar for 66.0 %. The threshold still separates on radar rain (AUC 0.85 and 0.73), and a threshold fitted on radar rain does not hold: none goes in.
  • Open, and measured in Limen, not here: the numbers of limen#243 recomputed with measure (#7); strongest_event against the last event on the twelve backtest windows of Limen, before it is switched on there.

Good to know

  • A threshold is not a forecast. Rain above T5 means "conditions like those that triggered landslides before", not "a landslide will happen here". Slope, soil, vegetation and antecedent wetness all matter. Use it as one input to a warning system, alongside expert judgement.
  • The line is not equally good everywhere. A T5 line leaves 5 % of the landslides of its macroregion below it; region by region the share goes from 1.3 % in Calabria (4 of 298) to 16.2 % in Valle d'Aosta (11 of 68). calibration_of(region) says where it sits high, where low, and where the landslides are too few to tell (Molise has 17).
  • A landslide with a day and no hour takes the end of its day. When you pair a dated landslide with hourly rain, the convention of this family of libraries is the next local midnight in Europe/Rome after its day, as UTC: 1 January 2010 is 2010-01-01T23:00Z, 1 July 2010 is 2010-07-01T22:00Z. An hour is labelled by its end, so the last hour before the landslide is the one ending at that midnight. ispra-idrogeo gives the instant; notebook 04 shows it.
  • T5 is deliberately low. By construction, 95 % of past triggering events sit above it: it favours catching events over avoiding false alarms.
  • Event reconstruction is simplified. It follows Melillo et al. (2018), whose CTRL-T tool also varies the dry gap with the season. The e-ITALICA durations come from that fuller procedure, so applying the Italian thresholds to events from reconstruct_events mixes the two: fine for monitoring, worth knowing for a study.
  • Units are fixed: hours, millimetres, millimetres per hour.
  • No sister library inside. The package imports neither dpc-radar nor ispra-idrogeo, and a test keeps it so: Limen pins all three, and a library that imported another would tie their releases together. The join lives in Limen, in notebook 04 and in app/.

Where it's used

  • Limen, an open early-warning system for landslides, floods and wildfires in Italy, from which the library was extracted. It pins rainfall-thresholds~=0.3.0 for the rainfall trigger of its landslide score; the choice of the strongest event is in its landslide.yaml, off until its backtest measures it.
  • The Open Data series of Agent Engineering Studio, with its sister libraries dpc-radar and ispra-idrogeo.
  • The calibration bench in app/, for public bodies.

Using it somewhere else? Open an issue and tell us: we'd love to list it here.

References

  • Caine N. (1980). The rainfall intensity-duration control of shallow landslides and debris flows. Geografiska Annaler A 62, 23-27.
  • Brunetti M.T. et al. (2010). Rainfall thresholds for the possible occurrence of landslides in Italy. NHESS 10, 447-458.
  • Peruccacci S. et al. (2012). Lithological and seasonal control on rainfall thresholds for the possible initiation of landslides in central Italy. Geomorphology 139-140, 79-90.
  • Melillo M. et al. (2018). A tool for the automatic calculation of rainfall thresholds for landslide occurrence. Environmental Modelling & Software 105, 230-243.
  • Peruccacci S. et al. (2023). ITALICA: an ITAlian rainfall-induced LandslIdes CAtalogue. ESSD 15, 2863-2877.
  • Brunetti M.T. et al. (2024). e-ITALICA (enhanced ITAlian rainfall-induced LandslIdes CAtalogue), v4. Zenodo, doi:10.5281/zenodo.14204473.

Citing

If this library helps your work, please cite the method and data papers above, and link to this repository:

Zileni G. rainfall-thresholds: rainfall intensity-duration thresholds for
shallow landslides (Python). https://github.com/agent-engineering-studio/rainfall-thresholds

Contributing

Issues and pull requests are welcome: new regional thresholds, better event reconstruction, examples from other countries. See CONTRIBUTING.md. To set up and run the checks:

uv sync
make check     # ruff, mypy --strict, pytest with 100 % coverage
make figures   # redraw the README charts (docs/make_figures.py)

⭐ If you find it useful, a star helps others find it.

Data licence

The test fixture tests/fixtures/italica_v4_dur_rain.csv is e-ITALICA v4 (Brunetti et al. 2024), CC BY 4.0, reduced to four columns (id, region, duration, cumulated rainfall). The charts in docs/img/ are drawn from it.

License

Code: Apache-2.0.

Metadata

Release files for rainfall-thresholds 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rainfall-thresholds 0.5.0
File Size Uploaded Provenance Actions
rainfall_thresholds-0.5.0.tar.gz 58.0 kB With provenance Details for rainfall_thresholds-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rainfall-thresholds 0.5.0
File Interpreter ABI Platform Actions
rainfall_thresholds-0.5.0-py3-none-any.whl Python 3 none any Details for rainfall_thresholds-0.5.0-py3-none-any.whl

Total release size: 110.9 kB

Release files / rainfall_thresholds-0.5.0.tar.gz

Download URL rainfall_thresholds-0.5.0.tar.gz
Size 58.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c05ddaba42eb9179d558fa545a72cd59ff2449e6683a4004947a340dfce4c3f9
BLAKE2b-256 checksum
How to use checksums
6e2cc65a2c5df7ec7ce3eb223064b93dd9293a212cafe6deacd1e6e9103d4732
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / rainfall_thresholds-0.5.0-py3-none-any.whl

Download URL rainfall_thresholds-0.5.0-py3-none-any.whl
Size 52.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
839022a8e7a8e0ff433764b791fc6fd8cb18b666db3c83523d77ed593d716966
BLAKE2b-256 checksum
How to use checksums
b0927d14c0a0d6a496cd70bfe13bd136721f78d602efe980312f2df2f9127b65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for rainfall-thresholds 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rainfall_thresholds-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page