pyrocko.gf.seismosizer

High level synthetic seismogram synthesis.

Coordinate systems

Coordinate system names commonly used in source models.

Name

Description

'xyz'

northing, easting, depth in [m]

'xy'

northing, easting in [m]

'latlon'

latitude, longitude in [deg]

'lonlat'

longitude, latitude in [deg]

'latlondepth'

latitude, longitude in [deg], depth in [m]

Classes

BoxcarSTF([effective_duration])

Boxcar type source time function.

CLVDSource(**kwargs)

A pure CLVD point source.

Cloneable()

Mix-in class for Guts objects, providing dict-like access and cloning.

CombiSFSource([subsources])

Composite source model.

CombiSource([subsources])

Composite source model.

DCSource(**kwargs)

A double-couple point source.

DoubleDCSource(**kwargs)

Two double-couple point sources separated in space and time.

Engine(**kwargs)

Base class for synthetic seismogram calculators.

ExplosionSource(**kwargs)

An isotropic explosion point source.

GridDef([shorthand])

Undocumented.

GridDefElement([shorthand])

Undocumented.

HalfSinusoidSTF([effective_duration])

Half sinusoid type source time function.

LocalEngine(**kwargs)

Offline synthetic seismogram calculator.

MTSource(**kwargs)

A moment tensor point source.

OutOfBoundsContext(**kwargs)

Undocumented.

PorePressureLineSource(**kwargs)

Excess pore pressure line source.

PorePressurePointSource(**kwargs)

Excess pore pressure point source.

ProcessingStats(**kwargs)

Undocumented.

PseudoDynamicRupture(**kwargs)

Combined Eikonal and Okada quasi-dynamic rupture model.

Range(*args, **kwargs)

Convenient range specification.

RectangularExplosionSource(**kwargs)

Rectangular or line explosion source.

RectangularSource(**kwargs)

Classical Haskell source model modified for bilateral rupture.

RemoteEngine(**kwargs)

Client for remote synthetic seismogram calculator.

Request(*args, **kwargs)

Synthetic seismogram computation request.

ResonatorSTF([effective_duration])

Simple resonator like source time function.

Response(**kwargs)

Resonse object to a synthetic seismogram computation request.

RingfaultSource(**kwargs)

A ring fault with vertical doublecouples.

SFSource(**kwargs)

A single force point source.

STF([effective_duration])

Base class for source time functions.

STFMode(...)

Any str out of ['pre', 'post'].

SimpleLandslideSTF([effective_duration])

Doublepulse land-slide STF which respects conservation of momentum.

SimpleLandslideSource(**kwargs)

A single force landslide source respecting conservation of momentum.

SmoothRampSTF([effective_duration])

Smooth-ramp type source time function for near-field displacement.

Source(**kwargs)

Base class for all source models.

SourceGrid(**kwargs)

Undocumented.

SourceGroup(**kwargs)

Undocumented.

SourceList(**kwargs)

Undocumented.

SourceWithDerivedMagnitude(**kwargs)

Undocumented.

SourceWithMagnitude(**kwargs)

Base class for sources containing a moment magnitude.

TremorSTF([effective_duration])

Oszillating source time function.

TriangularSTF([effective_duration])

Triangular type source time function.

VLVDSource(**kwargs)

Volumetric linear vector dipole source.

Exceptions

DerivedMagnitudeError

Raised when conversion between magnitude, moment, volume change or displacement failed.

NoDefaultStoreSet

Raised, when a default store would be used but none is set.

exception NoDefaultStoreSet[source]

Bases: Exception

Raised, when a default store would be used but none is set.

class Range(*args, **kwargs)[source]

Bases: SObject

Convenient range specification.

Equivalent ways to sepecify the range [ 0., 1000., … 10000. ]:

Range('0 .. 10k : 1k')
Range(start=0., stop=10e3, step=1e3)
Range(0, 10e3, 1e3)
Range('0 .. 10k @ 11')
Range(start=0., stop=10*km, n=11)

Range(0, 10e3, n=11)
Range(values=[x*1e3 for x in range(11)])

Depending on the use context, it can be possible to omit any part of the specification. E.g. in the context of extracting a subset of an already existing range, the existing range’s specification values would be filled in where missing.

The values are distributed with equal spacing, unless the spacing argument is modified. The values can be created offset or relative to an external base value with the relative argument if the use context supports this.

The range specification can be expressed with a short string representation:

'start .. stop @ num | spacing, relative'
'start .. stop : step | spacing, relative'

most parts of the expression can be omitted if not needed. Whitespace is allowed for readability but can also be omitted.

start

float, optional

stop

float, optional

step

float, optional

n

int, optional

values

numpy.ndarray (pyrocko.guts_array.Array), optional

spacing

str (pyrocko.guts.StringChoice), optional, default: 'lin'

relative

str (pyrocko.guts.StringChoice), optional, default: ''

class GridDefElement(shorthand=None, **kwargs)[source]

Bases: Object

Undocumented.

param

str (pyrocko.gf.meta.StringID)

rs

Range

class GridDef(shorthand=None, **kwargs)[source]

Bases: Object

Undocumented.

elements

list of GridDefElement objects, default: []

class Cloneable[source]

Bases: object

Mix-in class for Guts objects, providing dict-like access and cloning.

clone(**kwargs)[source]

Make a copy of the object.

A new object of the same class is created and initialized with the parameters of the object on which this method is called on. If kwargs are given, these are used to override any of the initialization parameters.

classmethod keys()[source]

Get list of the source model’s parameter names.

class STF(effective_duration=None, **kwargs)[source]

Bases: Object, Cloneable

Base class for source time functions.

class BoxcarSTF(effective_duration=None, **kwargs)[source]

Bases: STF

Boxcar type source time function.

boxcar source time function
duration

float, default: 0.0

duration of the boxcar

anchor

float, default: 0.0

anchor point with respect to source.time: (-1.0: left -> source duration [0, T] ~ hypocenter time, 0.0: center -> source duration [-T/2, T/2] ~ centroid time, +1.0: right -> source duration [-T, 0] ~ rupture end time)

class TriangularSTF(effective_duration=None, **kwargs)[source]

Bases: STF

Triangular type source time function.

triangular source time function
duration

float, default: 0.0

baseline of the triangle

peak_ratio

float, default: 0.5

fraction of time compared to duration, when the maximum amplitude is reached

anchor

float, default: 0.0

anchor point with respect to source.time: (-1.0: left -> source duration [0, T] ~ hypocenter time, 0.0: center -> source duration [-T/2, T/2] ~ centroid time, +1.0: right -> source duration [-T, 0] ~ rupture end time)

class HalfSinusoidSTF(effective_duration=None, **kwargs)[source]

Bases: STF

Half sinusoid type source time function.

half-sinusouid source time function
duration

float, default: 0.0

duration of the half-sinusoid (baseline)

anchor

float, default: 0.0

anchor point with respect to source.time: (-1.0: left -> source duration [0, T] ~ hypocenter time, 0.0: center -> source duration [-T/2, T/2] ~ centroid time, +1.0: right -> source duration [-T, 0] ~ rupture end time)

exponent

int, default: 1

set to 2 to use square of the half-period sinusoidal function.

class SmoothRampSTF(effective_duration=None, **kwargs)[source]

Bases: STF

Smooth-ramp type source time function for near-field displacement. Based on moment function of double-couple point source proposed by [1].

smooth ramp source time function
duration

float, default: 0.0

duration of the ramp (baseline)

rise_ratio

float, default: 0.5

fraction of time compared to duration, when the maximum amplitude is reached

anchor

float, default: 0.0

anchor point with respect to source.time: (-1.0: left -> source duration [0, T] ~ hypocenter time, 0.0: center -> source duration [-T/2, T/2] ~ centroid time, +1.0: right -> source duration [-T, 0] ~ rupture end time)

class ResonatorSTF(effective_duration=None, **kwargs)[source]

Bases: STF

Simple resonator like source time function.

f(t) = 0 for t < 0
f(t) = e^{-t/tau} * sin(2 * pi * f * t)

smooth ramp source time function
duration

float, default: 0.0

decay time

frequency

float, default: 1.0

resonance frequency

class TremorSTF(effective_duration=None, **kwargs)[source]

Bases: STF

Oszillating source time function.

f(t) = 0 for t < -tau/2 or t > tau/2
f(t) = cos(pi/tau*t) * sin(2 * pi * f * t)

duration

float, default: 0.0

Tremor duration [s]

frequency

float, default: 1.0

Frequency [Hz]

class SimpleLandslideSTF(effective_duration=None, **kwargs)[source]

Bases: STF

Doublepulse land-slide STF which respects conservation of momentum.

duration_acceleration

float, default: 1.0

Duratian of the acceleration phase [s].

duration_deceleration

float, default: 1.0

Duration of the deceleration phase [s].

mute_acceleration

bool, default: False

set acceleration to zero (for testing)

mute_deceleration

bool, default: False

set acceleration to zero (for testing)

class STFMode(...) str[source]

Bases: StringChoice

Any str out of ['pre', 'post'].

Variables:
  • choices – Allowed choices (list of str).

  • ignore_case – Whether to behave case-insensitive (bool, default: False).

class Source(**kwargs)[source]

Bases: Location, Cloneable

Base class for all source models.

name

str, optional, default: ''

time

pyrocko.util.get_time_float (pyrocko.guts.Timestamp), default: str_to_time('1970-01-01 00:00:00')

source origin time.

stf

STF, optional

source time function.

stf_mode

str (STFMode), default: 'post'

whether to apply source time function in pre or post-processing.

update(**kwargs)[source]

Change some of the source models parameters.

Example:

>>> from pyrocko import gf
>>> s = gf.DCSource()
>>> s.update(strike=66., dip=33.)
>>> print(s)
--- !pf.DCSource
depth: 0.0
time: 1970-01-01 00:00:00
magnitude: 6.0
strike: 66.0
dip: 33.0
rake: 0.0
grid(**variables)[source]

Create grid of source model variations.

Returns:

SourceGrid instance.

Example:

>>> from pyrocko import gf
>>> base = DCSource()
>>> R = gf.Range
>>> for s in base.grid(R('
base_key()[source]

Get key to decide about source discretization / GF stack sharing.

When two source models differ only in amplitude and origin time, the discretization and the GF stacking can be done only once for a unit amplitude and a zero origin time and the amplitude and origin times of the seismograms can be applied during post-processing of the synthetic seismogram.

For any derived parameterized source model, this method is called to decide if discretization and stacking of the source should be shared. When two source models return an equal vector of values discretization is shared.

get_factor()[source]

Get the scaling factor to be applied during post-processing.

Discretization of the base seismogram is usually done for a unit amplitude, because a common factor can be efficiently multiplied to final seismograms. This eliminates to do repeat the stacking when creating seismograms for a series of source models only differing in amplitude.

This method should return the scaling factor to apply in the post-processing (often this is simply the scalar moment of the source).

effective_stf_pre()[source]

Return the STF applied before stacking of the Green’s functions.

This STF is used during discretization of the parameterized source models, i.e. to produce a temporal distribution of point sources.

Handling of the STF before stacking of the GFs is less efficient but allows to use different source time functions for different parts of the source.

effective_stf_post()[source]

Return the STF applied after stacking of the Green’s fuctions.

This STF is used in the post-processing of the synthetic seismograms.

Handling of the STF after stacking of the GFs is usually more efficient but is only possible when a common STF is used for all subsources.

class SourceWithMagnitude(**kwargs)[source]

Bases: Source

Base class for sources containing a moment magnitude.

magnitude

float, default: 6.0

Moment magnitude Mw as in [Hanks and Kanamori, 1979]

exception DerivedMagnitudeError[source]

Bases: ValidationError

Raised when conversion between magnitude, moment, volume change or displacement failed.

class SourceWithDerivedMagnitude(**kwargs)[source]

Bases: Source

Undocumented.

check_conflicts()[source]

Check for parameter conflicts.

To be overloaded in subclasses. Raises DerivedMagnitudeError on conflicts.

class ExplosionSource(**kwargs)[source]

Bases: SourceWithDerivedMagnitude

An isotropic explosion point source.

magnitude

float, optional

moment magnitude Mw as in [Hanks and Kanamori, 1979]

volume_change

float, optional

volume change of the explosion/implosion or the contracting/extending magmatic source. [m^3]

discretized_source_class

alias of DiscretizedExplosionSource

class RectangularExplosionSource(**kwargs)[source]

Bases: ExplosionSource

Rectangular or line explosion source.

strike

float, default: 0.0

strike direction in [deg], measured clockwise from north

dip

float, default: 90.0

dip angle in [deg], measured downward from horizontal

length

float, default: 0.0

length of rectangular source area [m]

width

float, default: 0.0

width of rectangular source area [m]

anchor

str (pyrocko.guts.StringChoice), optional, default: 'center'

Anchor point for positioning the plane, can be: top, center orbottom and also top_left, top_right,bottom_left,bottom_right, center_left and center right

nucleation_x

float, optional

horizontal position of rupture nucleation in normalized fault plane coordinates (-1 = left edge, +1 = right edge)

nucleation_y

float, optional

down-dip position of rupture nucleation in normalized fault plane coordinates (-1 = upper edge, +1 = lower edge)

velocity

float, default: 3500.0

speed of explosion front [m/s]

aggressive_oversampling

bool, default: False

Aggressive oversampling for basesource discretization. When using ‘multilinear’ interpolation oversampling has practically no effect.

discretized_source_class

alias of DiscretizedExplosionSource

class DCSource(**kwargs)[source]

Bases: SourceWithMagnitude

A double-couple point source.

strike

float, default: 0.0

strike direction in [deg], measured clockwise from north

dip

float, default: 90.0

dip angle in [deg], measured downward from horizontal

rake

float, default: 0.0

rake angle in [deg], measured counter-clockwise from right-horizontal in on-plane view

discretized_source_class

alias of DiscretizedMTSource

class CLVDSource(**kwargs)[source]

Bases: SourceWithMagnitude

A pure CLVD point source.

azimuth

float, default: 0.0

azimuth direction of largest dipole, clockwise from north [deg]

dip

float, default: 90.0

dip direction of largest dipole, downward from horizontal [deg]

discretized_source_class

alias of DiscretizedMTSource

class VLVDSource(**kwargs)[source]

Bases: SourceWithDerivedMagnitude

Volumetric linear vector dipole source.

This source is a parameterization for a restricted moment tensor point source, useful to represent dyke or sill like inflation or deflation sources. The restriction is such that the moment tensor is rotational symmetric. It can be represented by a superposition of a linear vector dipole (here we use a CLVD for convenience) and an isotropic component. The restricted moment tensor has 4 degrees of freedom: 2 independent eigenvalues and 2 rotation angles orienting the the symmetry axis.

In this parameterization, the isotropic component is controlled by volume_change. To define the moment tensor, it must be converted to the scalar moment of the the MT’s isotropic component. For the conversion, the shear modulus at the source’s position must be known. This value is extracted from the earth model defined in the GF store in use.

The CLVD part by controlled by its scalar moment M_0: clvd_moment. The sign of clvd_moment is used to switch between a positiv or negativ CLVD (the sign of the largest eigenvalue).

azimuth

float, default: 0.0

azimuth direction of symmetry axis, clockwise from north [deg].

dip

float, default: 90.0

dip direction of symmetry axis, downward from horizontal [deg].

volume_change

float, default: 0.0

volume change of the inflation/deflation [m^3].

clvd_moment

float, default: 0.0

scalar moment M_0 of the CLVD component [Nm]. The sign controls the sign of the CLVD (the sign of its largest eigenvalue).

discretized_source_class

alias of DiscretizedMTSource

class MTSource(**kwargs)[source]

Bases: Source

A moment tensor point source.

mnn

float, default: 1.0

north-north component of moment tensor in [Nm]

mee

float, default: 1.0

east-east component of moment tensor in [Nm]

mdd

float, default: 1.0

down-down component of moment tensor in [Nm]

mne

float, default: 0.0

north-east component of moment tensor in [Nm]

mnd

float, default: 0.0

north-down component of moment tensor in [Nm]

med

float, default: 0.0

east-down component of moment tensor in [Nm]

discretized_source_class

alias of DiscretizedMTSource

class RectangularSource(**kwargs)[source]

Bases: SourceWithDerivedMagnitude

Classical Haskell source model modified for bilateral rupture.

magnitude

float, optional

moment magnitude Mw as in [Hanks and Kanamori, 1979]

strike

float, default: 0.0

strike direction in [deg], measured clockwise from north

dip

float, default: 90.0

dip angle in [deg], measured downward from horizontal

rake

float, default: 0.0

rake angle in [deg], measured counter-clockwise from right-horizontal in on-plane view

length

float, default: 0.0

length of rectangular source area [m]

width

float, default: 0.0

width of rectangular source area [m]

anchor

str (pyrocko.guts.StringChoice), optional, default: 'center'

Anchor point for positioning the plane, can be: top, center bottom, top_left, top_right,bottom_left,bottom_right, center_left, center right.

nucleation_x

float, optional

horizontal position of rupture nucleation in normalized fault plane coordinates (-1. = left edge, +1. = right edge)

nucleation_y

float, optional

down-dip position of rupture nucleation in normalized fault plane coordinates (-1. = upper edge, +1. = lower edge)

velocity

float, default: 3500.0

speed of rupture front [m/s]

slip

float, optional

Slip on the rectangular source area [m]

opening_fraction

float, default: 0.0

Determines fraction of slip related to opening. (-1: pure tensile closing, 0: pure shear, 1: pure tensile opening)

decimation_factor

int, optional, default: 1

Sub-source decimation factor, a larger decimation will make the result inaccurate but shorten the necessary computation time (use for testing puposes only).

aggressive_oversampling

bool, default: False

Aggressive oversampling for basesource discretization. When using ‘multilinear’ interpolation oversampling has practically no effect.

discretized_source_class

alias of DiscretizedMTSource

class PseudoDynamicRupture(**kwargs)[source]

Bases: SourceWithDerivedMagnitude

Combined Eikonal and Okada quasi-dynamic rupture model.

Details are described in Pseudo Dynamic Rupture - A stress-based self-similar finite source model. Note: attribute stf is not used so far, but kept for future applications.

strike

float, default: 0.0

Strike direction in [deg], measured clockwise from north.

dip

float, default: 0.0

Dip angle in [deg], measured downward from horizontal.

length

float, default: 10000.0

Length of rectangular source area in [m].

width

float, default: 5000.0

Width of rectangular source area in [m].

anchor

str (pyrocko.guts.StringChoice), optional, default: 'center'

Anchor point for positioning the plane, can be: top, center, bottom, top_left, top_right, bottom_left, bottom_right, center_left, center_right.

nucleation_x

numpy.ndarray (pyrocko.guts_array.Array), default: array([0.])

Horizontal position of rupture nucleation in normalized fault plane coordinates (-1. = left edge, +1. = right edge).

nucleation_y

numpy.ndarray (pyrocko.guts_array.Array), default: array([0.])

Down-dip position of rupture nucleation in normalized fault plane coordinates (-1. = upper edge, +1. = lower edge).

nucleation_time

numpy.ndarray (pyrocko.guts_array.Array), optional

Time in [s] after origin, when nucleation points defined by nucleation_x and nucleation_y rupture.

gamma

float, default: 0.8

Scaling factor between rupture velocity and S-wave velocity: v_r = \gamma * v_s.

nx

int, default: 2

Number of discrete source patches in x direction (along strike).

ny

int, default: 2

Number of discrete source patches in y direction (down dip).

slip

float, optional

Maximum slip of the rectangular source [m]. Setting the slip the tractions/stress field will be normalized to accomodate the desired maximum slip.

rake

float, optional

Rake angle in [deg], measured counter-clockwise from right-horizontal in on-plane view. Rake is translated into homogenous tractions in strike and up-dip direction. rake is mutually exclusive with tractions parameter.

patches

list of pyrocko.modelling.okada.OkadaSource objects, optional

List of all boundary elements/sub faults/fault patches.

patch_mask

numpy.ndarray (pyrocko.guts_array.Array), optional

Mask for all boundary elements/sub faults/fault patches. True leaves the patch in the calculation, False excludes the patch.

tractions

pyrocko.gf.tractions.TractionField, optional

Traction field the rupture plane is exposed to. See the pyrocko.gf.tractions module for more details. If tractions=None and rake is given DirectedTractions will be used.

coef_mat

numpy.ndarray (pyrocko.guts_array.Array), optional

Coefficient matrix linking traction and dislocation field.

eikonal_decimation

int, optional, default: 1

Sub-source eikonal factor, a smaller eikonal factor will increase the accuracy of rupture front calculation but increases also the computation time.

decimation_factor

int, optional, default: 1

Sub-source decimation factor, a larger decimation will make the result inaccurate but shorten the necessary computation time (use for testing puposes only).

nthreads

int, optional, default: 1

Number of threads for Okada forward modelling, matrix inversion and calculation of point subsources. Note: for small/medium matrices 1 thread is most efficient.

pure_shear

bool, optional, default: False

Calculate only shear tractions and omit tensile tractions.

smooth_rupture

bool, default: True

Smooth the tractions by weighting partially ruptured fault patches.

aggressive_oversampling

bool, default: False

Aggressive oversampling for basesource discretization. When using ‘multilinear’ interpolation oversampling has practically no effect.

discretized_source_class

alias of DiscretizedMTSource

get_tractions()[source]

Get source traction vectors.

If rake is given, unit length directed traction vectors (DirectedTractions) are returned, else the given tractions are used.

Returns:

Traction vectors per patch.

Return type:

ndarray: (n_patches, 3).

get_scaled_tractions(store)[source]

Get traction vectors rescaled to given slip.

Opposing to get_tractions() traction vectors (DirectedTractions) are rescaled to the given slip before returning. If no slip and rake are provided, the given tractions are returned without scaling.

Parameters:

store (Store) – Green’s function database (needs to cover whole region of the source).

Returns:

Traction vectors per patch.

Return type:

ndarray: (n_patches, 3).

get_magnitude(store=None, target=None)[source]

Get total seismic moment magnitude Mw.

Parameters:
  • store (Store) – GF store to guide the discretization and providing the earthmodel which is needed to calculate moment from slip.

  • target (pyrocko.gf.targets.Target) – Target, used to get GF interpolation settings.

Returns:

Moment magnitude

Return type:

float

outline(cs='xyz')[source]

Get source outline corner coordinates.

Parameters:

cs (str) – Output coordinate system.

Returns:

Corner points in desired coordinate system.

Return type:

ndarray: (5, [2, 3]).

points_on_source(cs='xyz', **kwargs)[source]

Convert relative plane coordinates to geographical coordinates.

Given x and y coordinates (relative source coordinates between -1. and 1.) are converted to desired geographical coordinates. Coordinates need to be given as ndarray arguments points_x and points_y.

Parameters:

cs (str) – Output coordinate system.

Returns:

Point coordinates in desired coordinate system.

Return type:

ndarray: (n_points, [2, 3]).

pyrocko_moment_tensor(store=None, target=None)[source]

Get overall moment tensor of the rupture.

Parameters:
  • store (Store) – GF store to guide the discretization and providing the earthmodel which is needed to calculate moment from slip.

  • target (pyrocko.gf.targets.Target) – Target, used to get GF interpolation settings.

Returns:

Moment tensor.

Return type:

MomentTensor

discretize_time(store, interpolation='nearest_neighbor', vr=None, times=None, *args, **kwargs)[source]

Get rupture start time for discrete points on source plane.

Parameters:
  • store (Store) – Green’s function database (needs to cover whole region of the source)

  • interpolation (str) – Interpolation method to use (choose between 'nearest_neighbor' and 'multilinear').

  • vr (ndarray) – Array, containing rupture user defined rupture velocity values.

  • times (ndarray) – Array, containing zeros, where rupture is starting, real positive numbers at later secondary nucleation points and -1, where time will be calculated. If not given, rupture starts at nucleation_x, nucleation_y. Times are given for discrete points with equal horizontal and vertical spacing.

Returns:

Coordinates (latlondepth), coordinates (xy), rupture velocity, rupture propagation time of discrete points.

Return type:

ndarray: (n_points, 3), ndarray: (n_points, 2), ndarray: (n_points_dip, n_points_strike), ndarray: (n_points_dip, n_points_strike).

get_vr_time_interpolators(store, interpolation='nearest_neighbor', force=False, **kwargs)[source]

Get interpolators for rupture velocity and rupture time.

Additional **kwargs are passed to discretize_time().

Parameters:
  • store (Store) – Green’s function database (needs to cover whole region of the source).

  • interpolation (str) – Interpolation method to use (choose between 'nearest_neighbor' and 'multilinear').

  • force (bool) – Force recalculation of the interpolators (e.g. after change of nucleation point locations/times). Default is False.

discretize_patches(store, interpolation='nearest_neighbor', force=False, grid_shape=(), **kwargs)[source]

Get rupture start time and OkadaSource elements for points on rupture.

All source elements and their corresponding center points are calculated and stored in the patches attribute.

Additional **kwargs are passed to discretize_time().

Parameters:
  • store (Store) – Green’s function database (needs to cover whole region of the source).

  • interpolation (str) – Interpolation method to use (choose between 'nearest_neighbor' and 'multilinear').

  • force (bool) – Force recalculation of the vr and time interpolators ( e.g. after change of nucleation point locations/times). Default is False.

  • grid_shape (tuple of int) – Desired sub fault patch grid size (nlength, nwidth). Either factor or grid_shape should be set.

discretize_basesource(store, target=None)[source]

Prepare source for synthetic waveform calculation.

Parameters:
  • store (Store) – Green’s function database (needs to cover whole region of the source).

  • target (Target) – Target information.

Returns:

Source discretized by a set of moment tensors and times.

Return type:

DiscretizedMTSource

calc_coef_mat()[source]

Calculate coefficients connecting tractions and dislocations.

get_patch_attribute(attr)[source]

Get patch attributes.

Parameters:

attr (str) – Name of selected attribute (see :py:class`pyrocko.modelling.okada.OkadaSource`).

Returns:

Array with attribute value for each fault patch.

Return type:

ndarray

get_slip(time=None, scale_slip=True, interpolation='nearest_neighbor', **kwargs)[source]

Get slip per subfault patch for given time after rupture start.

Parameters:
  • time (float) – Time after origin [s], for which slip is computed. If not given, final static slip is returned.

  • scale_slip (bool) – If True and slip given, all slip values are scaled to fit the given maximum slip.

  • interpolation (str) – Interpolation method to use (choose between 'nearest_neighbor' and 'multilinear').

Returns:

Inverted dislocations (u_{strike}, u_{dip}, u_{tensile}) for each source patch.

Return type:

ndarray: (n_sources, 3)

get_delta_slip(store=None, deltat=None, delta=True, interpolation='nearest_neighbor', **kwargs)[source]

Get slip change snapshots.

The time interval, within which the slip changes are computed is determined by the sampling rate of the Green’s function database or deltat. Additional **kwargs are passed to get_slip().

Parameters:
  • store (Store) – Green’s function database (needs to cover whole region of of the source). Its sampling interval is used as time increment for slip difference calculation. Either deltat or store should be given.

  • deltat (float) – Time interval for slip difference calculation [s]. Either deltat or store should be given.

  • delta (bool) – If True, slip differences between two time steps are given. If False, cumulative slip for all time steps.

  • interpolation (str) – Interpolation method to use (choose between 'nearest_neighbor' and 'multilinear').

Returns:

Displacement changes(\Delta u_{strike},
\Delta u_{dip} , \Delta u_{tensile}) for each source patch and time; corner times, for which delta slip is computed. The order of displacement changes array is:

&[[\\
&[\Delta u_{strike, patch1, t1},
    \Delta u_{dip, patch1, t1},
    \Delta u_{tensile, patch1, t1}],\\
&[\Delta u_{strike, patch1, t2},
    \Delta u_{dip, patch1, t2},
    \Delta u_{tensile, patch1, t2}]\\
&], [\\
&[\Delta u_{strike, patch2, t1}, ...],\\
&[\Delta u_{strike, patch2, t2}, ...]]]\\

Return type:

ndarray: (n_sources, n_times, 3), ndarray: (n_times, )

get_slip_rate(*args, **kwargs)[source]

Get slip rate inverted from patches.

The time interval, within which the slip rates are computed is determined by the sampling rate of the Green’s function database or deltat. Additional *args and **kwargs are passed to get_delta_slip().

Returns:

Slip rates (\Delta u_{strike}/\Delta t, \Delta u_{dip}/\Delta t, \Delta u_{tensile}/\Delta t) for each source patch and time; corner times, for which slip rate is computed. The order of sliprate array is:

&[[\\
&[\Delta u_{strike, patch1, t1}/\Delta t,
    \Delta u_{dip, patch1, t1}/\Delta t,
    \Delta u_{tensile, patch1, t1}/\Delta t],\\
&[\Delta u_{strike, patch1, t2}/\Delta t,
    \Delta u_{dip, patch1, t2}/\Delta t,
    \Delta u_{tensile, patch1, t2}/\Delta t]], [\\
&[\Delta u_{strike, patch2, t1}/\Delta t, ...],\\
&[\Delta u_{strike, patch2, t2}/\Delta t, ...]]]\\

Return type:

ndarray: (n_sources, n_times, 3), ndarray: (n_times, )

get_moment_rate_patches(*args, **kwargs)[source]

Get scalar seismic moment rate for each patch individually.

Additional *args and **kwargs are passed to get_slip_rate().

Returns:

Seismic moment rate for each source patch and time; corner times, for which patch moment rate is computed based on slip rate. The order of the moment rate array is:

&[\\
&[(\Delta M / \Delta t)_{patch1, t1},
    (\Delta M / \Delta t)_{patch1, t2}, ...],\\
&[(\Delta M / \Delta t)_{patch2, t1},
    (\Delta M / \Delta t)_{patch, t2}, ...],\\
&[...]]\\

Return type:

ndarray: (n_sources, n_times), ndarray: (n_times, )

get_moment_rate(store, target=None, deltat=None)[source]

Get seismic source moment rate for the total source (STF).

Parameters:
  • store (Store) – Green’s function database (needs to cover whole region of of the source). Its deltat [s] is used as time increment for slip difference calculation. Either deltat or store should be given.

  • target (Target) – Target information, needed for interpolation method.

  • deltat (float) – Time increment for slip difference calculation [s]. If not given store.deltat is used.

Returns:

Seismic moment rate [Nm/s] for each time; corner times, for which moment rate is computed. The order of the moment rate array is:

&[\\
&(\Delta M / \Delta t)_{t1},\\
&(\Delta M / \Delta t)_{t2},\\
&...]\\

Return type:

ndarray: (n_times, ), ndarray: (n_times, )

get_moment(*args, **kwargs)[source]

Get cumulative seismic moment.

Additional *args and **kwargs are passed to get_magnitude().

Returns:

Cumulative seismic moment in [Nm].

Return type:

float

rescale_slip(magnitude=None, moment=None, **kwargs)[source]

Rescale source slip based on given target magnitude or seismic moment.

Rescale the maximum source slip to fit the source moment magnitude or seismic moment to the given target values. Either magnitude or moment need to be given. Additional **kwargs are passed to get_moment().

Parameters:
  • magnitude (float) – Target moment magnitude M_\mathrm{w} as in [Hanks and Kanamori, 1979]

  • moment (float) – Target seismic moment M_0 [Nm].

get_centroid(store, *args, **kwargs)[source]

Centroid of the pseudo dynamic rupture model.

The centroid location and time are derived from the locations and times of the individual patches weighted with their moment contribution. Additional **kwargs are passed to pyrocko_moment_tensor().

Parameters:

store (Store) – Green’s function database (needs to cover whole region of of the source). Its deltat [s] is used as time increment for slip difference calculation. Either deltat or store should be given.

Returns:

The centroid location and associated moment tensor.

Return type:

pyrocko.model.event.Event

get_coulomb_failure_stress(receiver_points, friction, pressure, strike, dip, rake, time=None, *args, **kwargs)[source]

Calculate Coulomb failure stress change CFS.

The function obtains the Coulomb failure stress change \Delta
\sigma_C at arbitrary receiver points with a commonly oriented receiver plane assuming:

\Delta \sigma_C = \sigma_S - \mu (\sigma_N - \Delta p)

with the shear stress \sigma_S, the coefficient of friction \mu, the normal stress \sigma_N, and the pore fluid pressure change \Delta p. Each receiver point is characterized by its geographical coordinates, and depth. The required receiver plane orientation is defined by strike, dip, and rake. The Coulomb failure stress change is calculated for a given time after rupture origin time.

Parameters:
  • receiver_points (ndarray: (n_receiver, 3)) – Location of the receiver points in Northing, Easting, and depth in [m].

  • friction (float) – Coefficient of friction.

  • pressure (float) – Pore pressure change in [Pa].

  • strike (float) – Strike of the receiver plane in [deg].

  • dip (float) – Dip of the receiver plane in [deg].

  • rake (float) – Rake of the receiver plane in [deg].

  • time (float) – Time after origin [s], for which the resulting \Delta
\Sigma_c is computed. If not given, \Delta \Sigma_c is derived based on the final static slip.

Returns:

The Coulomb failure stress change \Delta \Sigma_c at each receiver point in [Pa].

Return type:

ndarray: (n_receiver,)

class DoubleDCSource(**kwargs)[source]

Bases: SourceWithMagnitude

Two double-couple point sources separated in space and time. Moment share between the sub-sources is controlled by the parameter mix. The position of the subsources is dependent on the moment distribution between the two sources. Depth, east and north shift are given for the centroid between the two double-couples. The subsources will positioned according to their moment shares around this centroid position. This is done according to their delta parameters, which are therefore in relation to that centroid. Note that depth of the subsources therefore can be depth+/-delta_depth. For shallow earthquakes therefore the depth has to be chosen deeper to avoid sampling above surface.

strike1

float, default: 0.0

strike direction in [deg], measured clockwise from north

dip1

float, default: 90.0

dip angle in [deg], measured downward from horizontal

azimuth

float, default: 0.0

azimuth to second double-couple [deg], measured at first, clockwise from north

rake1

float, default: 0.0

rake angle in [deg], measured counter-clockwise from right-horizontal in on-plane view

strike2

float, default: 0.0

strike direction in [deg], measured clockwise from north

dip2

float, default: 90.0

dip angle in [deg], measured downward from horizontal

rake2

float, default: 0.0

rake angle in [deg], measured counter-clockwise from right-horizontal in on-plane view

delta_time

float, default: 0.0

separation of double-couples in time (t2-t1) [s]

delta_depth

float, default: 0.0

difference in depth (z2-z1) [m]

distance

float, default: 0.0

distance between the two double-couples [m]

mix

float, default: 0.5

how to distribute the moment to the two doublecouples mix=0 -> m1=1 and m2=0; mix=1 -> m1=0, m2=1

stf1

STF, optional

Source time function of subsource 1 (if given, overrides STF from attribute Source.stf)

stf2

STF, optional

Source time function of subsource 2 (if given, overrides STF from attribute Source.stf)

discretized_source_class

alias of DiscretizedMTSource

class RingfaultSource(**kwargs)[source]

Bases: SourceWithMagnitude

A ring fault with vertical doublecouples.

diameter

float, default: 1.0

diameter of the ring in [m]

sign

float, default: 1.0

inside of the ring moves up (+1) or down (-1)

strike

float, default: 0.0

strike direction of the ring plane, clockwise from north, in [deg]

dip

float, default: 0.0

dip angle of the ring plane from horizontal in [deg]

npointsources

int, default: 360

number of point sources to use

discretized_source_class

alias of DiscretizedMTSource

class CombiSource(subsources=[], **kwargs)[source]

Bases: Source

Composite source model.

subsources

list of Source objects, default: []

discretized_source_class

alias of DiscretizedMTSource

class CombiSFSource(subsources=[], **kwargs)[source]

Bases: Source

Composite source model.

subsources

list of Source objects, default: []

discretized_source_class

alias of DiscretizedSFSource

class SFSource(**kwargs)[source]

Bases: Source

A single force point source.

Supported GF schemes: ‘elastic5’.

fn

float, default: 0.0

northward component of single force [N]

fe

float, default: 0.0

eastward component of single force [N]

fd

float, default: 0.0

downward component of single force [N]

discretized_source_class

alias of DiscretizedSFSource

class SimpleLandslideSource(**kwargs)[source]

Bases: Source

A single force landslide source respecting conservation of momentum.

The landslide is modelled point-like in space but with individual source time functions for each force component. The source time functions SimpleLandslideSTF impose the constraint that everything is at rest before and after the event but are allowed to have different acceleration and deceleration durations. It should thus be suitable as a first order approximation of a rock fall or landslide. For realistic landslides, the horizontal accelerations and decelerations can be delayed with respect to the vertical ones but cannot precede them.

Supported GF schemes: ‘elastic5’.

stf_mode

str (STFMode), default: 'pre'

SimpleLandslideSource only works with stf_mode == “pre”.

impulse_n

float, default: 0.0

northward component of impulse [Ns]

impulse_e

float, default: 0.0

eastward component of impulse [Ns]

impulse_d

float, default: 0.0

downward component of impulse [Ns]

azimuth

float, default: 0.0

azimuth direction of the mass movement [deg]

stf_v

SimpleLandslideSTF, default: SimpleLandslideSTF()

source time function for vertical force component

stf_h

SimpleLandslideSTF, default: SimpleLandslideSTF()

source time function for horizontal force component

discretized_source_class

alias of DiscretizedSFSource

class PorePressurePointSource(**kwargs)[source]

Bases: Source

Excess pore pressure point source.

For poro-elastic initial value problem where an excess pore pressure is brought into a small source volume.

pp

float, default: 1.0

initial excess pore pressure in [Pa]

discretized_source_class

alias of DiscretizedPorePressureSource

class PorePressureLineSource(**kwargs)[source]

Bases: Source

Excess pore pressure line source.

The line source is centered at (north_shift, east_shift, depth).

pp

float, default: 1.0

initial excess pore pressure in [Pa]

length

float, default: 0.0

length of the line source [m]

azimuth

float, default: 0.0

azimuth direction, clockwise from north [deg]

dip

float, default: 90.0

dip direction, downward from horizontal [deg]

discretized_source_class

alias of DiscretizedPorePressureSource

class Request(*args, **kwargs)[source]

Bases: Object

Synthetic seismogram computation request.

Request(**kwargs)
Request(sources, targets, **kwargs)
sources

list of Source objects, default: []

list of sources for which to produce synthetics.

targets

list of pyrocko.gf.targets.Target objects, default: []

list of targets for which to produce synthetics.

class ProcessingStats(**kwargs)[source]

Bases: Object

Undocumented.

t_perc_get_store_and_receiver

float, default: 0.0

t_perc_discretize_source

float, default: 0.0

t_perc_make_base_seismogram

float, default: 0.0

t_perc_make_same_span

float, default: 0.0

t_perc_post_process

float, default: 0.0

t_perc_optimize

float, default: 0.0

t_perc_stack

float, default: 0.0

t_perc_static_get_store

float, default: 0.0

t_perc_static_discretize_basesource

float, default: 0.0

t_perc_static_sum_statics

float, default: 0.0

t_perc_static_post_process

float, default: 0.0

t_wallclock

float, default: 0.0

t_cpu

float, default: 0.0

n_read_blocks

int, default: 0

n_results

int, default: 0

n_subrequests

int, default: 0

n_stores

int, default: 0

n_records_stacked

int, default: 0

class Response(**kwargs)[source]

Bases: Object

Resonse object to a synthetic seismogram computation request.

request

Request

results_list

list of list of pyrocko.gf.meta.SeismosizerResult objects objects, default: []

stats

ProcessingStats

pyrocko_traces()[source]

Return a list of requested Trace instances.

kite_scenes()[source]

Return a list of requested kite.Scene instances.

static_results()[source]

Return a list of requested StaticResult instances.

iter_results(get='pyrocko_traces')[source]

Generator function to iterate over results of request.

Yields associated Source, Target, Trace instances in each iteration.

snuffle(**kwargs)[source]

Open snuffler with requested traces.

class Engine(**kwargs)[source]

Bases: Object

Base class for synthetic seismogram calculators.

get_store_ids()[source]

Get list of available GF store IDs

class OutOfBoundsContext(**kwargs)[source]

Bases: Object

Undocumented.

source

Source

target

pyrocko.gf.targets.Target

distance

float

components

list of str objects, default: []

class LocalEngine(**kwargs)[source]

Bases: Engine

Offline synthetic seismogram calculator.

Parameters:
  • use_env – if True, fill store_superdirs and store_dirs with paths set in environment variables GF_STORE_SUPERDIRS and GF_STORE_DIRS.

  • use_config

    if True, fill store_superdirs and store_dirs with paths set in the user’s config file.

    The config file can be found at ~/.pyrocko/config.pf

    gf_store_dirs: ['/home/pyrocko/gf_stores/ak135/']
    gf_store_superdirs: ['/home/pyrocko/gf_stores/']
    

store_superdirs

list of str objects, default: []

directories which are searched for Green’s function stores

store_dirs

list of str objects, default: []

additional individual Green’s function store directories

default_store_id

str, optional

default store ID to be used when a request does not provide one

get_store_dir(store_id)[source]

Lookup directory given a GF store ID.

get_store_ids()[source]

Get list of available store IDs.

get_store(store_id=None)[source]

Get a store from the engine.

Parameters:

store_id – identifier of the store (optional)

Returns:

Store object

If no store_id is provided the store associated with the default_store_id is returned. Raises NoDefaultStoreSet if default_store_id is undefined.

close_cashed_stores()[source]

Close and remove ids from cashed stores.

process(*args, **kwargs)[source]

Process a request.

process(**kwargs)
process(request, **kwargs)
process(sources, targets, **kwargs)

The request can be given a a Request object, or such an object is created using Request(**kwargs) for convenience.

Returns:

Response object

class RemoteEngine(**kwargs)[source]

Bases: Engine

Client for remote synthetic seismogram calculator.

site

str, optional, default: 'localhost'

url

str, optional, default: '%(site)s/gfws/%(service)s/%(majorversion)i/%(method)s'

class SourceGroup(**kwargs)[source]

Bases: Object

Undocumented.

class SourceList(**kwargs)[source]

Bases: SourceGroup

Undocumented.

sources

list of Source objects, default: []

class SourceGrid(**kwargs)[source]

Bases: SourceGroup

Undocumented.

base

Source

variables

dict of Range objects, default: {}

order

list of str objects, default: []