Demonstrator (si)

si.demonstrator

class MagnitudeGroup(**kwargs)[source]

Definition of inversion parameters specific to a certain magnitude range.

The core of a magnitude group is the magnitude range (magmin, magmax). It limits the application of the magnitue group to earthquakes with the initial magnitude in the given range. Detailed inversion settings can be set:

  • the waveform time window,

  • which waveform channels are used for inversion.

  • the bandpass filter frequencies and fading time,

  • distance ranges for stations to be considered,

  • inversion parameter search space ranges, and

  • for which source models the magnitude group is applied for.

- !siria.si.demonstrator.MagnitudeGroup
# Range of the initally given magnitude to use this Magnitude Group.
magmin: 6.0
magmax: 9.0

# Waveform time window settings.
tmin: '{stored:begin}'
tmax: '{vel_surface:2.0}'
tfade:

# Waveform bandpass filter settings.
fmin: 0.01
fmax: 0.03

# Specfic upper frequency limit for finite fault inversions (optional).
fmax_extended: 0.05

# Initial epicentral distance range for strong motion or HR-GNSS
# stations to be considered.
distance_nearfield:
- 0.0
- 100000

# Initial epicentral distance range for broad band stations to be
# considered.
distance_farfield:
- 50000
- 100000

# Specific Grond parameter ranges to be sampled within the estimate.
ranges:
    depth: !pf.Range
    start: 1000.0
    stop: 35000.0
    time: !pf.Range
    start: -20.0
    stop: 20.0
    relative: 'add'
    duration: !pf.Range
    start: 5.
    stop: 40.
    step: 1.
    lateral: !pf.Range
    start: -25e3
    stop: 25e3
    width: !pf.Range
    start: 5000.
    stop: 15000.

# Give source estimation method, the magnitude group is applied for.
# More options are the 'pdr' - pseudo dynamic rupture model, or the
# 'ids' - IDS source model.

apply_for:
- 'mt'  # Moment Tensor point source
- 'rs'  # Rectangular source model

# Seismic waveform channels, the magnitude group shall be applied for.
channels:
- 'Z'  # Vertical
- 'R'  # Radial
magmin

float, default: 6.0

Minimum moment magnitude Mw. Event Mw must be >= magmin.

magmax

float, default: 7.0

Maxmimum moment magnitude Mw. Event Mw must be < magmax.

tmin

pyrocko.gf.meta.Timing, default: '{stored:P}'

Minimum time to be considered.

tmax

pyrocko.gf.meta.Timing, default: '{vel_surface:2.0}'

Maximum time to be considered.

tfade

float, optional

Filter padding time. If not given, it is determined from the fmin.

fmin

float, default: 0.01

Minimum frequency in [Hz].

fmax

float, default: 0.03

Maximum frequency in [Hz]. If fmax_extended is given, fmax is applied to the point source inversion only.

fmax_extended

float, optional, default: 0.05

Maximum frequency in [Hz] for extended rupture estimation. If fmax_extended is not given, fmax is applied .

distance_nearfield

tuple of 2 float objects, default: (0.0, 100000.0)

Distance range in [m] for nearfield accelerometric and gnss stations to be considered in the extended rupture inversions.

distance_farfield

tuple of 2 float objects, default: (100000.0, 1000000.0)

Distance range in [m] for farfield broadband stations to be considered in the inversions (both point and extended).

use_nearfield_stations_for_mt

bool, default: True

Use strong motion and HRGNSS stations for MT inversions, if set to True.

ranges

dict of pyrocko.gf.seismosizer.Range objects, default: {'lateral': <pyrocko.gf.seismosizer.Range object at 0x7f8fe314de50>, 'depth': <pyrocko.gf.seismosizer.Range object at 0x7f8fe314de80>, 'duration': <pyrocko.gf.seismosizer.Range object at 0x7f8fe314dee0>, 'time': <pyrocko.gf.seismosizer.Range object at 0x7f8fe314deb0>}

Search space for the uniform and directed sampling. Depth and lateral ranges are defined in [m], duration and time range in [s].

apply_for

list of str (pyrocko.guts.StringChoice) objects, default: ['mt', 'rs', 'pdr', 'ids']

Give source estimation methods, the magnitude group is applied for (mt - point source, rs - rectangular source, pdr - pseudo dynamic rupture, ids - IDS source.

channels

list of str (pyrocko.guts.StringChoice) objects, default: ['Z', 'R']

Channels, inversion shall be done on. Choose between Z - vertical, R - radial, T - transversal, N - north or E - east.

class SamplingPhase(**kwargs)[source]

Sampling phases base class.

iterations

int, optional

class UniformSamplingPhase(**kwargs)[source]

Phase with uniform sampling of the model space.

It wraps grond.optimisers.highscore.optimiser.UniformSamplerPhase.

class PDFSamplingPhase(**kwargs)[source]

Phase sampling the PDF of an earlier Grond run.

It wraps grond.optimisers.highscore.optimiser.PDFSamplerPhase. This phase is currently only implemented in the EWRICA specific version of Grond provided at https://git.gfz-potsdam.de/ewrica/grond.

run_dir

str (grond.meta.Path), optional

Path to Grond run, PDFs are extracted from for each parameter.

subset

str, optional, default: 'harvest'

Grond subset of models to be used. None loads all models.

bins

int, optional, default: 360

Number of bins within parameter statistics. More bins lead to a better resolution.

class DirectedSamplingPhase(**kwargs)[source]

Phase with directed sampling of the model space.

It wraps grond.optimisers.highscore.optimiser.DirectedSamplerPhase.

scatter_scale_begin

float, default: 2.0

Scaling factor at beginning of the phase.

scatter_scale_end

float, default: 0.45

Scaling factor at the end of the directed phase.

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

It generates models based on TSUMAPS or fault database priors.

config

siria.si.invert.SourceInjectionConfig, default: <siria.si.invert.SourceInjectionConfig object at 0x7f8fe314e060>

class PriorSamplingPhase(**kwargs)[source]

It allows for changing sampling phases in consecuitive runs.

In fast near-real-time earthquake parameter estimations inversion settings may change with first reliable inversion results available. This behaviour is accomplished with the PriorSamplingPhase. In the first, initial stage, e.g., model samples are drawn from prior information as provided with the InjectionSamplingPhase. When finished, the secondary stage can use results from the initial stage, e.g., in the PDFSamplingPhase.

initial_stage

SamplingPhase, default: <siria.si.demonstrator.InjectionSamplingPhase object at 0x7f8fe314e120>

Settings for the initial run (all runs, until any previous runis finished.

secondary_stage

SamplingPhase, optional, default: <siria.si.demonstrator.PDFSamplingPhase object at 0x7f8fe314e150>

Settings for the all runs started when a previous run is finished.

class SamplingGroupLabel(SamplingGroupLabel) dummy for str[source]

Any str out of ['fast', 'regular'].

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

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

class SamplingGroup(**kwargs)[source]

Grouping for sampler phases

sampling_phases

list of SamplingPhase objects, default: [<siria.si.demonstrator.InjectionSamplingPhase object at 0x7f8fe314e420>, <siria.si.demonstrator.UniformSamplingPhase object at 0x7f8fe314e450>, <siria.si.demonstrator.DirectedSamplingPhase object at 0x7f8fe314e4b0>]

apply_for

list of str (pyrocko.guts.StringChoice) objects, default: ['mt', 'rs', 'pdr']

Give source estimation methods, the sampling group is valid for (mt - point source, rs - rectangular source, pdr - pseudo dynamic rupture

label

str (SamplingGroupLabel), default: 'regular'

class EngineConfig(**kwargs)[source]

Controlls for the used ground models, and processing settings.

store_dirs

list of str objects, default: ['.']

store_id_grond

str, default: 'ak135_2000km_1Hz'

store_id_ids_waveform

str, default: 'waveform_store_ids'

store_id_ids_geodetic

str, default: 'geodetic_store_ids'

nparallel

int, default: 1

Number of parallel processes.

nthreads

int, default: 1

Number of threads.

pphase

str, default: '{stored:any_P}'

Pyrocko P-wave arrival time definition for IDS.

class DemonstratorConfig(**kwargs)[source]

Configuration of the source inversion demonstrator.

nstations_min

int, optional, default: 0

Minimum number of available stations to issue a run.

nstations_max

int, optional, default: 30

Maximum number of available stations included within one run.

blocklist

list of pyrocko.guts.Any objects, default: []

Blocked stations given as STA, NET.STA or NET.STA.LOC code.

magnitude_groups

list of MagnitudeGroup objects, default: [<siria.si.demonstrator.MagnitudeGroup object at 0x7f8fe314eb70>]

Set of magnitude specific settings.

sampling_groups

list of SamplingGroup objects, default: [<siria.si.demonstrator.SamplingGroup object at 0x7f8fe314eab0>]

engine_config

EngineConfig, default: <siria.si.demonstrator.EngineConfig object at 0x7f8fe314eb70>

create_report

bool, default: False

If True, IDS and Grond reports are generated.

hrgnss_snr_min

float, optional, default: 2.0

Minimium absolute Signal-To-Noise amplitude ratio for HRGNSS station records.

class SourceInversionDemonstrator(squirrel=None, responses_xml=None, *args, **kwargs)[source]

Core inversion wrapper executing Grond and IDS inversion codes.

config

DemonstratorConfig, default: <siria.si.demonstrator.DemonstratorConfig object at 0x7f8fe314ef30>

event

pyrocko.model.event.Event, default: <pyrocko.model.event.Event object at 0x7f8fe314ef60>

origin

pyrocko.model.event.Event, optional

property engine
Returns

The Pyrocko engine.

Return type

pyrocko.gf.LocalEngine

property store
Returns

The Pyrocko Green’s Function store.

Return type

pyrocko.gf.store.Store

get_grond_config(magnitude_group, sampling_group, apply_for, base_path, old_runs)[source]

Generate a Grond configuration file from the configurations.

weed_stations(codes)[source]

Select stations with a good azimuthal and distance coverage.

validate_pipeline_and_data(config)[source]

Quality controll for data before inversions.

The function removes doubled, or blocked records.

run_grond_inversion(label, apply_for, config, base_path, *args, **kwargs)[source]

Grond inversion wrapper

run_grond_report(env)[source]

Generate Grond report.

get_ids_config(magnitude_group, base_path)[source]

Prepare the configuration for IDS.

run_ids_inversion(config, base_path, force)[source]

IDS inversion wrapper.

get_valid_magnitude_group()[source]

Extract magnitude groups valid for the given event.

get_inversion_pipeline(base_path_grond, base_path_ids, old_runs)[source]

Prepare the pipeline of inversions required for the current event.

run_source_inversion_stream(config, event_stream, responses_xml_stream=None, responses_xml=None, sq=None, waveforms_stream=None, obspy_streams=[], obspy_traces=[], origin_stream=None, *args, **kwargs)[source]

Start inversion with streamed waveforms and meta data

Further inversion settings are derived from the configuration file.

Parameters
  • config (siria.si.demonstrator.DemonstratorConfig) – Demonstrator configuration.

  • event_stream (bytes) – Event information as QuakeML.

  • responses_xml_stream (optional, bytes) – Station meta data in StationXML format.

  • sq (optional, pyrocko.squirrel.Squirrel) – Squirrel instance containing meta data and/or waveform data.

  • waveforms_stream (optional, bytes) – Waveforms as miniSEED.

  • obspy_streams (optional, iterable of obspy.core.stream.Stream) – Waveforms in obspy stream format.

  • obspy_traces (optional, iterable of obspy.core.trace.Trace) – Waveforms in obspy format.

  • origin_stream (optional, bytes) – If given, event location, time and duration are updated with the origin.

Returns

Sourve inversion results as source list and dict

Return type

iterator of tuple(list(siria.sources.SiriaMTSource or siria.sources.SiriaPseudoDynamicRupture or siria.sources.SiriaRectangularSource or siria.sources.SiriaIDSSource)), dict

run_source_inversion(config, event, sq, responses_xml, origin=None, arrivals={}, old_runs=[], force=False, nstations_min=0, enable_profiling=False)[source]

Start source inversion with Pyrocko understandable data formats.

Parameters
  • config (siria.si.demonstrator.DemonstratorConfig) – Demonstrator configuration.

  • event – Event information.

  • sq (pyrocko.squirrel.Squirrel) – Waveforms stored in Squirrel.

  • responses_xml – Station meta data.

  • origin (optional, obspy.core.utcdatetime.UTCDateTime) – If given, event location, time and duration are updated with the origin.

  • old_runs (optional, list of str) – List of previous runs performed. PDFs can be extracted from them and used for refined sampling, if runs are finished. If several runs are available the last finished is used.

  • arrivals – Absolut P wave arrival times at the stations. So far not used.

  • force (optional, bool) – If True, old runs within the same runing directory are overwritten. Default is False.

  • nstations_min (optional, int) – If larger than 0, runs are only issued for nstations_min or or more available stations.

  • enable_profiling (optional, bool) – If True, cprofile is called. Results are stored in cprofile.prof

Returns

Sourve inversion results as source list and dict

Return type

iterator of tuples of list of siria.sources.SiriaMTSource or siria.sources.SiriaPseudoDynamicRupture or siria.sources.SiriaRectangularSource or siria.sources.SiriaIDSSource, dict