RESTORE is a Python tool tackling the short-term aftershock incompleteness issue (STAI). It is based on a stochastic gap-filling procedure which reconstructs the missing events in the space-time-magnitude domain based on empirical earthquake properties. The subsets of the catalog affected by the STAI issue are automatically detected.
Clone the repository:
git clone https://github.com/INGV/RESTORE.git
cd RESTORECreate and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activateInstall RESTORE:
pip install .Run RESTORE example:
restore --config example/amatrice/input_file.txtPrint the installed RESTORE version
restore --versionTo generate multiple RESTORE realizations, specify the desired values of sizes, steps, and seeds in the input file.
RESTORE will run all combinations of these values.
Input catalogs must follow the ZMAP format, with columns following this order:
- longitude
- latitude
- year
- month
- day
- magnitude
- hypocentral depth in km
- hour
- minute
- second
Magnitudes must already be binned at ΔM = 0.1.
Different seeds return different replenished catalogs.
For a given window size, window step and seed combination, the output files are written in outputs/<example>/realizations/size_<size>_step_<step>/seed_<seed>/.
Replenished_catalog.txt contains the ten input columns plus:
flag = 0: observed eventflag = 1: reconstructed event
The runner writes:
realization_metrics.csv: contains one row for each(size, step, seed)realization and summarizes the representative metrics across all realizationsrepresentative_realization.txt: the realization that is closest to the central behavior of the tested ensemble (see the note below)- for each realization:
settings.txtreports the input parameters for that run - for each realization:
metadata.jsonwith code/environment/file provenance
NOTE: Each successful (size, step, seed) combination represents one RESTORE realization.
RESTORE defines the central ensemble behavior as the median value of each representative metric across all successful realizations.
It then calculates the normalized distance of each realization from the center and selects the realization with the smallest distance.
Distances are normalized by the interquartile range of each representative metric across the ensemble so that metrics with different numerical scales can be compared.
The final distance is a weighted mean: number of reconstructed events, magnitude distribution, spatial distribution, depth distribution, and STAI characteristics are given equal total weight.
The representative metrics are:
- number of reconstructed events
- median reconstructed magnitude
- median reconstructed latitude and longitude
- median reconstructed hypocentral depth
- total STAI duration
- number of STAI gaps
For each realization, RESTORE performs the following steps:
-
Read and validate the input catalog. Note: the catalog must be in ZMAP format and magnitudes must already be discretized at
ΔM = 0.1. -
Identify the largest earthquake. The event with the largest magnitude is identified as responsible for the STAI.
-
Define the STAI region. RESTORE estimates the rupture length of the largest event and constructs a rectangular region around it. The size of this region is controlled by
fault_length_multiplier(provided by the user) and represents the area affected by the STAI. -
Create the spatially filtered catalog. Only earthquakes located inside the STAI region are used to estimate the temporal variation of magnitude completeness, detect STAI gaps, and reconstruct missing events. The file
STAI-Filtered_Catalog.txtcontains this subset. Note: this implies that the provided input catalog can cover an arbitrary area. RESTORE automatically extracts the meaningful subset based onfault_length_multiplier. -
Estimate the reference magnitude of completeness. RESTORE uses earthquakes occurring before
t_end_quiet(i.e., those occurring during the 'seismic quiescent period'), inside the STAI region, to estimate the reference completeness magnitudeMc*, unless the user supplies their own value. -
Estimate
Mcthrough time. The filtered catalog is analyzed with a moving window approach. RESTORE estimatesMcfor each window using the Lilliefors test. Note: starting from v.3.0.0, RESTORE implements the Lilliefors test with truncated-exponential dithering, as proposed by Stallone and Spassiani (2026). -
Detect STAI gaps. A time interval is classified as affected by STAI when the moving-window
Mcexceeds the reference value by the selected confidence threshold. The latter is a (user-defined) multiple of the standard deviation estimated via bootstrap: the lower the multiple, the more RESTORE is sensitive to transient variations inMc. -
Estimate missing magnitudes. For each STAI step, RESTORE estimates the expected number of earthquakes and related magnitudes using the Gutenberg-Richter (GR) relation. If the Gutenberg-Richter b-value is None, RESTORE uses the default value b = 1.0.
-
Simulate missing-event properties. Occurrence times, epicentral coordinates, and hypocentral depths are generated stochastically from the observed properties of the filtered catalog.
-
Build the replenished catalog. The output catalog contains:
- original events with magnitude greater than or equal to the reference
Mc; - reconstructed events generated inside the STAI region.
The final column identifies event origin:
flag = 0: original event;flag = 1: reconstructed event.
- original events with magnitude greater than or equal to the reference
-
Generate the requested ensemble. RESTORE runs for all requested combinations of
size,step, andseed. Each(size, step, seed)combination is treated as one stochastic realization. -
Select a representative realization. By inspecting all successful realizations, RESTORE calculates the median value of each representative metric and defines the central ensemble behavior. Each realization is compared with this center using a normalized distance. The realization with the smallest distance is reported as representative.
RESTORE produces plausible stochastic realizations of missing seismicity, not reconstructions of the events that actually occurred. Users are therefore encouraged to generate an ensemble of realizations that explores both the stochastic variability and the variability associated with the choice of moving window size and step. RESTORE uses the distance from the central ensemble behavior as criterion for identifying a representative realization, but users are free to adopt alternative criteria.
