Catalog#
- class bruces.Catalog(origin_times, latitudes=None, longitudes=None, eastings=None, northings=None, depths=None, magnitudes=None)[source]#
Earthquake catalog.
- Parameters:
origin_times (sequence of scalar or sequence of datetime_like) – Origin times (in years if scalar).
latitudes (array_like or None, optional, default None) – Latitudes (in degree).
longitudes (array_like or None, optional, default None) – Longitudes (in degree).
eastings (array_like or None, optional, default None) – Easting coordinates (in km). Ignored if latitudes and longitudes are set.
northings (array_like or None, optional, default None) – Northing coordinates (in km). Ignored if latitudes and longitudes are set.
depths (array_like or None, optional, default None) – Depths (in km).
magnitudes (array_like or None, optional, default None) – Magnitudes.
- decluster(algorithm='nearest-neighbor', return_indices=False, **kwargs)[source]#
Decluster earthquake catalog.
- Parameters:
algorithm (str, optional, default 'nearest-neighbor') –
Declustering algorithm:
’gardner-knopoff’: Gardner-Knopoff’s method (after Gardner and Knopoff, 1974)
’nearest-neighbor’: nearest-neighbor algorithm (after Zaliapin and Ben-Zion, 2008)
’reasenberg’: Reasenberg’s method (after Reasenberg, 1985)
return_indices (bool, optional, default False) – If True, return indices of background events instead of declustered catalog.
window (str {'default', 'gruenthal', 'uhrhammer'}, optional, default 'default') –
Only if
algorithm = "gardner-knopoff"
. Distance and time windows:’default’: Gardner and Knopoff (1974)
’gruenthal’: personnal communication (see van Stiphout et al., 2012)
’uhrhammer’: Uhrhammer (1986)
method (str, optional, default 'gaussian-mixture') –
Only if
algorithm = "nearest-neighbor"
. Declustering method:’gaussian-mixture’: use a Gaussian Mixture classifier
’thinning’: random thinning (after Zaliapin and Ben-Zion, 2020)
d (scalar, optional, default 1.6) – Only if
algorithm = "nearest-neighbor"
. Fractal dimension of epicenter/hypocenter.w (scalar, optional, default 1.0) – Only if
algorithm = "nearest-neighbor"
. Magnitude weighting factor (usually b-value).use_depth (bool, optional, default False) – Only if
algorithm = "nearest-neighbor"
. If True, consider depth in interevent distance calculation.eta_0 (scalar or None, optional, default None) – Only if
algorithm = "nearest-neighbor"
andmethod = "thinning"
. Initial cutoff threshold. If None, invokebruces.Catalog.fit_cutoff_threshold()
.alpha_0 (scalar, optional, default 1.5) – Only if
algorithm = "nearest-neighbor"
andmethod = "thinning"
. Cluster threshold.M (int, optional, default 16) – Only if
algorithm = "nearest-neighbor"
andmethod = "thinning"
. Number of reshufflings.seed (int or None, optional, default None) – Only if
algorithm = "nearest-neighbor"
. Seed for random number generator.rfact (int, optional, default 10) – Only if
algorithm = "reasenberg"
. Number of crack radii surrounding each earthquake within which to consider linking a new event into a cluster.xmeff (scalar or None, optional, default None) – Only if
algorithm = "reasenberg"
. “Effective” lower magnitude cutoff for catalog. If None, use minimum magnitude in catalog.xk (scalar, optional, default 0.5) – Only if
algorithm = "reasenberg"
. Factor by whichxmeff
is raised during clusters.tau_min (scalar, timedelta_like or None, optional, default None) – Only if
algorithm = "reasenberg"
. Look ahead time for non-clustered events (in days if scalar). Default is 1 day.tau_max (scalar, timedelta_like or None, optional, default None) – Only if
algorithm = "reasenberg"
. Maximum look ahead time for clustered events (in days if scalar). Default is 10 days.p (scalar, optional, default 0.95) – Only if
algorithm = "reasenberg"
. Confidence of observing the next event in the sequence.
- Returns:
Declustered earthquake catalog or indices of background events.
- Return type:
bruces.Catalog
or array_like
- property depths#
Return depths.
- property eastings#
Return easting coordinates.
- fit_cutoff_threshold(d=1.6, w=1.0, use_depth=False)[source]#
Estimate the optimal cutoff threshold for nearest-neighbor.
- Parameters:
use_depth (bool, optional, default False) – If True, consider depth in interevent distance calculation.
d (scalar, optional, default 1.6) – Fractal dimension of epicenter/hypocenter.
w (scalar, optional, default 1.0) – Magnitude weighting factor (usually b-value).
- Returns:
Optimal initial cutoff threshold.
- Return type:
float
Note
This function assumes that the catalog is clustered.
- property latitudes#
Return latitudes.
- property longitudes#
Return longitudes.
- property magnitudes#
Return magnitudes.
- property northings#
Return northing coordinates.
- property origin_times#
Return origin times.
- plot_time_space_distances(d=1.6, w=1.0, use_depth=False, eta_0=None, eta_0_diag=None, kde=True, bins=50, hist_args=None, line_args=None, text_args=None, ax=None)[source]#
Plot rescaled time vs space distances.
- Parameters:
d (scalar, optional, default 1.6) – Fractal dimension of epicenter/hypocenter.
w (scalar, optional, default 1.0) – Magnitude weighting factor (usually b-value).
use_depth (bool, optional, default False) – If True, consider depth in interevent distance calculation.
eta_0 (scalar, 'auto', array_like or None, optional, default None) – Initial cutoff threshold values for which to draw a constant line. If eta_0 = “auto”, invoke
bruces.Catalog.fit_cutoff_threshold()
.eta_0_diag (scalar or None, optional, default None) – If not None, plot will be centered around eta_0_diag. This option is automatically enabled if eta_0 = “auto”.
kde (bool, optional, default True) – If True, use Gaussian Kernel Density Estimator.
bins (int, optional, default 50) – Number of bins for both axes.
hist_args (dict or None, optional, default None) – Plot arguments passed to
matplotlib.pyplot.contourf()
ormatplotlib.pyplot.pcolormesh()
.line_args (dict or None, optional, default None) – Plot arguments passed to
matplotlib.pyplot.plot()
.text_args (dict or None, optional, default None) – Plot arguments passed to
matplotlib.pyplot.text()
.ax (
matplotlib.pyplot.Axes
or None, optional, default None) – Matplotlib axes.
- Returns:
Matplotlib axes.
- Return type:
matplotlib.pyplot.Axes
- seismicity_rate(tbins, return_cumulative=False)[source]#
Get seismicity rate.
- Parameters:
tbins (timedelta_like or sequence of datetime_like) – If tbins is a timedelta_like, it defines the width of each bin. If tbins is a sequence of datetime_like, it defines a monotonically increasing list of bin edges.
return_cumulative (bool, optional, default False) – If True, return cumulative number of events instead of seismicity rate.
- Returns:
array_like – Seismicity rate (in events/year) or cumulative seismicity (number of events).
sequence of datetime_like – Dates.
- time_space_distances(d=1.6, w=1.0, use_depth=False, return_logs=True, prune_nans=False)[source]#
Get rescaled time and space distances for each earthquake in the catalog.
- Parameters:
d (scalar, optional, default 1.6) – Fractal dimension of epicenter/hypocenter.
w (scalar, optional, default 1.0) – Magnitude weighting factor (usually b-value).
use_depth (bool, optional, default False) – If True, consider depth in interevent distance calculation.
return_logs (bool, optional, default True) – If True, return distance as log10.
prune_nans (bool, optional, default False) – If True, remove NaN values from output.
- Returns:
array_like – Rescaled time distances.
array_like – Rescaled space distances.
- write(filename, file_format=None, **kwargs)[source]#
Write catalog to CSV file.
- Parameters:
filename (str, pathlike or buffer) – Output file name or buffer.
file_format (str ('csv') or None, optional, default None) – Output file format.
- property years#
Return origin times in decimal years.