Skip to content

Landslides: rain and a threshold

limen_core.landslide

Rain, a threshold and an earthquake, for one place and one instant.

The landslide join. Three libraries each give one piece and none imports the others: the hourly rain comes from any :class:rainfall_thresholds.RainSource (dpc_radar.archive.MergingArchive, dpc_radar.history.SriHistory, a gauge, a model); the threshold and the event against it from rainfall-thresholds; how much an earthquake lowers the threshold from :mod:limen_core.seismic, on the shaking ingv-shakemap reads. Here they meet, for a point and an instant:

  • :func:rain_before: the hours of rain that ended at or before the instant;
  • :func:assess: the rainfall event of those hours against the threshold of the place, lowered by a recent earthquake and scaled when the rain is radar measured against a threshold calibrated on gauges.

The instant. Of a dated landslide it is ispra_idrogeo.dated.instant_utc: its time read as Europe/Rome, or, with no time, the next local midnight after its day. An hour of rain is the interval that ends at its time stamp, so the last hour read is the one that ends at the instant, or the last whole hour before it: an hour that ends after the landslide is never read.

Not measured is not dry. An hour the source did not measure is None, and the assessment says when the event borders on one. Pure functions: the source is the only thing that reads, and it is the caller's.

last_hour

last_hour(instant: datetime) -> datetime

The end of the last whole hour of rain at instant: the instant itself on the hour.

rain_before

rain_before(source: RainSource, point: tuple[float, float], instant: datetime, *, hours: int) -> dict[datetime, float | None]

The rain of the hours hours that ended by instant at point (lon, lat), in mm.

Keys are the ends of the hours, the oldest first. An hour the source does not give is None: not measured.

lowered

lowered(threshold: PowerLawThreshold, *, reduction: float) -> PowerLawThreshold

The threshold lowered by reduction (0 to below 1), as after an earthquake.

reduction is :func:limen_core.seismic.rain_threshold_reduction; 0 leaves the threshold as it is.

assess

assess(source: RainSource, point: tuple[float, float], instant: datetime, threshold: PowerLawThreshold, *, hours: int, no_rain_break_hours: int, min_event_mm: float, seismic_reduction: float = 0.0, radar_gauge_factor: float = 1.0, choice: str = 'latest', label: str | None = None) -> EventAssessment | None

The rainfall event before instant at point against the threshold of the place.

The threshold is first lowered by seismic_reduction; then rainfall-thresholds scales it by radar_gauge_factor (rain from a radar against a threshold calibrated on gauges) and finds the event of the last hours hours. choice is "latest" (the event that ended last) or "strongest". None when those hours hold no event. Calibration (hours, no_rain_break_hours, min_event_mm, the factors) is the caller's.