GRRateGrid#

class seismostats.GRRateGrid(data=None, *args, name=None, starttime: Timestamp | None = None, endtime: Timestamp | None = None, **kwargs)#

Represents seismicity as a grid of cells, each with its own Gutenberg-Richter parameters (a-value, b-value, and mc).

To be a valid RateGrid object, the it must have the following columns: longitude_min, longitude_max, latitude_min, latitude_max, depth_min, depth_max, a, b, and mc.

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 RateGrid class is a subclass of pandas.DataFrame, and inherits all of its methods and attributes.

Examples

Create a GRRateGrid from a dictionary.

>>> import pandas as pd
>>> from seismostats import GRRateGrid
>>> data = {'longitude_min': [9.0, 10.0, 11.0],
...         'longitude_max': [10.0, 11.0, 12.0],
...         'latitude_min': [45.0, 46.0, 47.0],
...         'latitude_max': [46.0, 47.0, 48.0],
...         'depth_min': [10, 20, 30], 'depth_max': [20, 30, 40],
...         'a': [0, 1, 2], 'b': [0, 1, 2], 'mc': [0, 1, 2]}
>>> rategrid = GRRateGrid(data,
...                       starttime=pd.Timestamp("2023-01-01"),
...                       endtime=pd.Timestamp("2023-01-02"))
>>> rategrid

  longitude_min  longitude_max   ...  a   b   mc
1           9.0           10.0   ...  0   0   0
2          10.0           11.0   ...  1   1   1
3          11.0           12.0   ...  2   2   2
[3 rows x 9 columns]
Variables:
  • name – Name of the GRRateGrid.

  • starttime – Start time of the GRRateGrid.

  • endtime – End time of the GRRateGrid.

Attributes

Methods

add_time_index

Create MultiIndex using starttime and endtime, both taken from the object attributes, and a cell number for each spatial block.

concat

Concatenate a list of GRRateGrid objects into a single GRRateGrid with a MultiIndex using starttime, optionally endtime and a unique cell number.

strip

Remove all columns except the required ones for a GRRateGrid.