Skip to main content

rainfall-thresholds

Rainfall intensity-duration thresholds for shallow landslides: the Caine power law, the reconstruction of rainfall events from an hourly series, and the frequentist fit of a threshold to the events that triggered landslides. Pure Python, no dependencies.

ci PyPI

What it does

A shallow landslide is triggered when rain is intense enough for long enough. The usual empirical model (Caine 1980) is a line in log-log space:

I(D) = alpha * D^(-beta)      I: mean intensity (mm/h), D: duration (h)

An event above the line is in the conditions that triggered landslides before. The package covers the three steps around that line:

Step Function
Hourly rain → events reconstruct_events, latest_event
Event → threshold → how far above PowerLawThreshold.intensity / .cumulated / .exceedance
Catalogue of triggering events → threshold fit_threshold

It also ships T5 thresholds for Italy refitted on the e-ITALICA catalogue, with a test that refits them from the data.

Install

pip install rainfall-thresholds

Use

from datetime import UTC, datetime, timedelta

from rainfall_thresholds import ITALICA_T5, latest_event, reconstruct_events

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)]

event = latest_event(reconstruct_events(series, no_rain_break_hours=6, min_event_mm=2.0))
assert event is not None
threshold = ITALICA_T5["southern"]

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

exceedance is log10(I / I(D)): 0 on the line, +1 at ten times the threshold intensity, negative below.

Fitting your own threshold

from rainfall_thresholds import fit_threshold

# (duration_h, intensity_mm_h) of rainfall events that triggered landslides
fit = fit_threshold(triggering_events, percentile=5)
fit.threshold  # PowerLawThreshold: 5 % of the events sit below it
fit.central  # the least-squares line before it is lowered

The method is the frequentist one of Brunetti et al. (2010) and Peruccacci et al. (2012): least squares on log I against log D, then the line is lowered by the chosen percentile of the residuals. One difference: they take the percentile from a Gaussian fitted to a kernel density of the residuals; this package takes it from the residuals themselves. The two agree when the residuals are close to normal.

Thresholds for Italy

Fitted with fit_threshold(percentile=5) on the 5,974 events of e-ITALICA v4 with a positive duration and cumulated rainfall:

Macroregion alpha (mm/h) beta Events E at 24 h E at 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

MACROREGIONS lists the regions in each group. Abruzzo and Molise are in the centre, unlike the ISTAT "Sud": use macroregion_of(region) rather than an ISTAT table, or the threshold will not be the one fitted on that region's events.

These 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, and tests/test_italy.py checks that they still do.

Event reconstruction

An event runs from its first to its last wet hour; no_rain_break_hours dry hours in a row end it, and an event below min_event_mm is dropped. This is a simplified form of 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 a threshold fitted on them and applied to events from reconstruct_events mixes the two: fine for monitoring, worth knowing for a study.

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.

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).

Extracted from Limen, which uses it for the rainfall component of its landslide score.

Development

uv sync
make check

License

Code: Apache-2.0.

Metadata

Release files for rainfall-thresholds 0.1.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.1.0
File Size Uploaded Provenance Actions
rainfall_thresholds-0.1.0.tar.gz 12.5 kB With provenance Details for rainfall_thresholds-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 26.6 kB

Release files / rainfall_thresholds-0.1.0.tar.gz

Download URL rainfall_thresholds-0.1.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
43fc31a257b9e3c79b46dd45a589849667cad20166cccf1ad4a2095448ae51aa
BLAKE2b-256 checksum
How to use checksums
ad04e5fadcef2b4dd047f7ae2b266c7fd0e60d7651106a70324a6312b9a16acf
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 2, 2026.

Transparency log

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

Download URL rainfall_thresholds-0.1.0-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06bb77384dc19d85d11e0774971de1a011129c5afe61af9f2d430b2d2340a992
BLAKE2b-256 checksum
How to use checksums
0829c348d8a4c5700d3aa23598e2cc145d83ecb7476a4b5697b9504c2383a647
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 2, 2026.

Transparency log

Security for rainfall-thresholds 0.1.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rainfall_thresholds-0.1.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 2, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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