limen-core
limen-core holds the joins of Limen, an open early-warning system for landslides, floods and wildfires in Italy.
Each open-data library of the project reads one source and stops there:
dpc-radar the rain radar, ispra-idrogeo the landslide inventory,
firms-client the fires seen from satellite, and so on. None of them imports
another. What two sources say together is a join, and it lives here: a burn
seen by satellite inside a mapped perimeter, an earthquake and the rain that
follows it, an index we compute next to the official one.
flowchart LR
L1["dpc-radar · rainfall-thresholds<br/>ispra-idrogeo · egms-client"] --> C
L2["firms-client · effis-client<br/>fwi-chain"] --> C
L3["glofas-ewds · copernicus-ems<br/>ingv-shakemap"] --> C
C["limen-core<br/>the joins, pure functions"] --> A["Limen<br/>database · jobs · API · map"]
It is alpha. Two things are in it: the scoring engines of Limen, moved as they are with the tests they had, and three joins rewritten as plain functions and checked number by number against the code they come from.
What is in it
| Module | What it answers | It joins |
|---|---|---|
limen_core.seismic |
how long a slope stays shaken, and how much less rain it takes after an earthquake | the shaking of ingv-shakemap with the thresholds of rainfall-thresholds |
limen_core.post_fire |
for how long, and how much, a burnt slope is more ready to fail | the fire power of firms-client with the perimeters of effis-client |
limen_core.landslide |
the rain before an instant at a place, against the threshold of the place, lowered after an earthquake | a RainSource (dpc-radar), the thresholds of rainfall-thresholds, seismic |
limen_core.wildfire |
what the satellite saw inside a burnt perimeter around its day: power, and power per hectare; when each cell last burnt and how hard (latest_fire) |
the detections of firms-client with the perimeters of effis-client; the density feeds post_fire |
limen_core.flood |
a forecast river peak with how far to trust it, when the fluvial branch should not speak alone, and whether a place was seen flooded, dry or not seen | the credibility and trust of glofas-ewds, the water over a place of copernicus-ems |
limen_core.agreement |
how far two measures of the same thing are from each other | the index of fwi-chain with the official ones of effis-client and glofas-ewds |
limen_core.evidence |
what the open-data libraries say about the cells ranked first: radar rain, landslides nearby, earthquakes, fire danger, fires seen from space, river discharge, flood activations, ground motion; and, asked one by one, the ground motion of a cell before a day, what one Copernicus EMS activation observed and the water it saw over a place; read through their Python functions, with a timeout per reading and a budget per call (extra evidence) |
any agent that explains a score |
limen_core.iffi |
how far to trust the IFFI inventory in a municipality or a region, with the sentence that says it in Italian and English; the field names are Limen's JSON contract and stay in Italian (extra idrogeo) |
the reliability table of ispra-idrogeo |
limen_core.idrogeo_grounding |
the source of an IdroGEO answer, and the numbers of a text that its facts do not support or that are said of the wrong figure (extra idrogeo) |
the grounding of ispra-idrogeo, with Limen's rules for iffi |
limen_core.rain_grounding |
the rain numbers of a text that are invented, in the wrong unit or rounded the wrong way | the check of rainfall-thresholds |
limen_core.verification |
how good a warning was: AUC, hit rate and false alarms, TSS, CSI, Brier, the cutoff at an alert budget, lead time, and whether an event was warned ahead of the background of its place | any score against any set of events |
from datetime import UTC, datetime
from limen_core.post_fire import PostFireParams, frp_density, frp_severity, post_fire_factor
from limen_core.seismic import SeismicParams, Shaking, ThresholdMemory, rain_threshold_reduction
# An earthquake a month ago: the ground is still, the slope is not as it was.
params = SeismicParams(
tau_days=2,
min_magnitude=4,
lookback_days=7,
pga_threshold_g=0.1,
pga_scale_g=0.03,
pga_min_g=0.02,
)
memory = ThresholdMemory(max_reduction=0.3, memory_days=90, lookback_days=365)
quake = Shaking(datetime(2026, 10, 29, 12, tzinfo=UTC), magnitude=5.5, pga_g=0.2)
lower = rain_threshold_reduction(
[quake], as_of=datetime(2026, 11, 28, 12, tzinfo=UTC), params=params, memory=memory
)
# 0.21: the rain threshold of this place is 21 % lower today.
# A burn of 100 hectares where the satellite read 150 MW, six months ago.
fire = PostFireParams(
peak_months=6,
curve_denominator=72,
window_months_max=24,
severity_floor=0.4,
frp_floor_mw_per_ha=0.2,
frp_saturation_mw_per_ha=2.2,
)
severity = frp_severity(frp_density(150.0, 100.0), params=fire) # 0.65
post_fire_factor(6.0, params=fire, severity=severity) # 0.79
The numbers in the examples are made up to show the calls: they are not a calibration.
The rules
- Pure functions. No database, no network, no clock: the time is always an argument. Whatever needs I/O stays in Limen. The one file read is the calibration, from the folder the application names.
- Calibration is not shipped. No threshold, weight or time constant has a default here unless it switches something off. The values belong to whoever measured them, and Limen keeps them in its configuration.
- Not measured is not zero.
NonestaysNone: a burnt perimeter with no detection inside is not a weak fire. - One direction. limen-core may use the libraries; no library imports limen-core, and limen-core never imports Limen. A test checks the last one.
- Checked against the code it replaces. Every function that comes from
Limen has a test that compares it, on hundreds of seeded inputs, with Limen's
own code frozen in
tests/limen_reference.py. - Nothing here is an alert. These are factors and measures. The official warning is the criticality bulletin of the Civil Protection Department.
Conventions shared with the libraries
- The instant of a dated landslide. With a time: that time, read as
Europe/Rome. With no time: the next local midnight in Europe/Rome after its
day; an interval gives the end of its last day.
ispra-idrogeocomputes it (dated.instant_utc). - Records. Landslides and assessments travel between packages as
opendata-record/v2, the schemaegms-clientpublishes.
The scoring engines
Limen's engines live here since 0.2.0, as they were in Limen: the same code and the same tests, so the same numbers.
| Package | What it holds |
|---|---|
limen_core.models |
what an engine reads and gives back: the features of a cell, the score with its breakdown, the hazards |
limen_core.scoring |
the landslide, flood and wildfire engines, their factors, and the schema of their calibration |
limen_core.cascades |
what one hazard does to another: a fire and the flood after it, three hazards on one municipality |
The calibration stays with the application. The engines read thresholds, weights and class cut-offs from YAML files, and this package ships none: the numbers belong to whoever measured them. Name the folder once:
from limen_core import calibration
from limen_core.scoring import score
calibration.use(
"/path/to/config"
) # hazards/landslide.yaml, flood.yaml, wildfire.yaml, cascades.yaml
result = score(bundle) # a CellFeatureBundle in, a RiskScore out
or set LIMEN_CALIBRATION_DIR. A loader given an explicit path looks nowhere
else.
What did not come: the choice of the engine from Limen's settings, and the machine-learning engine with its model registry. They are wiring, and they stay in Limen.
The moved code keeps Limen's names, some of them Italian, and uses pydantic.
It will be cleaned up a piece at a time; until then the two styles sit side
by side, and where a moved module and a rewritten one say the same thing
(scoring.seismic_decay and seismic, scoring.wildfire.confronto and
agreement) a test checks that they give the same numbers.
Where it stands
Done: the engines (models, scoring, cascades), the joins landslide,
wildfire, flood, seismic, post_fire, agreement, cases with
the measure of ground motion before a landslide, verification, and,
moved from Limen's briefing, iffi, idrogeo_grounding and rain_grounding.
Next:
- Limen calls the joins instead of its own code: the FRP of the burnt
perimeters (its SQL), the instant and the rain of a landslide, the fluvial
decision with
hold_back, the flood truth set withobserved; - the scoring engines take the joins as inputs where they now read Limen's own numbers, and their Italian names are cleaned up a piece at a time.
It depends on pydantic, PyYAML, rainfall-thresholds 0.5 and fwi-chain 1.3.
The other libraries are not imported: the joins take anything shaped like
their types (a rain source, a hotspot, a perimeter, a credibility, the water
over a place), so a library can be released without a release here.
Develop
make help # the targets
make check # ruff, mypy --strict, pytest: the gate CI runs
Licence
Code: Apache-2.0.
Metadata
Release files for limen-core 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| limen_core-0.11.0.tar.gz | 114.7 kB | With provenance | Details for limen_core-0.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| limen_core-0.11.0-py3-none-any.whl | Python 3 | none | any | Details for limen_core-0.11.0-py3-none-any.whl |
Total release size: 243.0 kB
Release files / limen_core-0.11.0.tar.gz
| Download URL | limen_core-0.11.0.tar.gz |
|---|---|
| Size | 114.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1db98877b35beda8e07fa26089bbb16dea9050b96d41ba23e5b57dcdd8fecd3
|
|
BLAKE2b-256 checksum How to use checksums |
0aaf67f5c5c0d6f77dc746a81577279b99595d42276b53c6f06cf371e8880191
|
| 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 30, 2026.
Transparency logRelease files / limen_core-0.11.0-py3-none-any.whl
| Download URL | limen_core-0.11.0-py3-none-any.whl |
|---|---|
| Size | 128.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2718c2cde5aca26be0385a7f383023264327ebd758cc868002defa0859eba24b
|
|
BLAKE2b-256 checksum How to use checksums |
ab64b3de1b0ad877a0fd59205725a8e633410e8ff53521bd33b9bddde470dbee
|
| 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 30, 2026.
Transparency logSecurity for limen-core 0.11.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.
Attestation for limen_core-0.11.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 30, 2026.
Transparency logA 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.