ForecastGRRateGrid#
- class seismostats.ForecastGRRateGrid(data=None, *args, n_grids=None, **kwargs)#
A seismicity forecast on a grid where for each grid cell, the GR parameters (a-value, b-value, mc) are defined. Additionally to the GRRateGrid, this class has a grid_id column to identify each possible realization of the grid.
To be a valid RateGrid object, it must have the following columns: longitude_min, longitude_max, latitude_min, latitude_max, depth_min, depth_max, number_events, a, b, mc, and grid_id.
- Parameters:
data – Data to initialize the catalog with.
name – Name of the catalog.
starttime – Start time of the catalog. If a string, it must be in a format that can be parsed by pandas.to_datetime.
endtime – End time of the catalog. If a string, it must be in a format that can be parsed by pandas.to_datetime.
kwargs – Additional arguments and keyword arguments to pass to pandas DataFrame constructor.
Notes
The ForecastRateGrid class is a subclass of
pandas.DataFrame, and inherits all of its methods and attributes.Examples
Create a ForecastGRRateGrid from a dictionary with two grid cells, each having two realizations (as indicated by grid_id).
>>> import pandas as pd >>> from seismostats import ForecastGRRateGrid >>> data = { ... 'longitude_min': [9, 9, 10, 10], ... 'longitude_max': [10, 10, 11, 11], ... 'latitude_min': [45, 45, 46, 46], ... 'latitude_max': [46, 46, 47, 47], ... 'depth_min': [10, 10, 20, 20], ... 'depth_max': [20, 20, 30, 30], ... 'number_events': [5, 6, 10, 12], ... 'a': [0.8, 0.9, 1.0, 1.1], ... 'b': [0.95, 1.0, 1.05, 1.1], ... 'mc': [1.2, 1.2, 1.3, 1.3], ... 'grid_id': [0, 0, 1, 1] ... } >>> forecast = ForecastGRRateGrid( ... data, ... starttime=pd.Timestamp('2023-01-01'), ... endtime=pd.Timestamp('2023-01-02')) >>> forecast longitude_min longitude_max ... a b mc grid_id 0 9.0 10.0 ... 0.8 0.95 1.2 0 1 9.0 10.0 ... 0.9 1.00 1.2 0 2 10.0 11.0 ... 1.0 1.05 1.3 1 3 10.0 11.0 ... 1.1 1.10 1.3 1
Attributes
Methods
Get statistics for a, b, alpha, mc and number_events, if present, per timestep and grid cell, aggregated over all realizations of the grid (i.e. over all grid_id values).