Version:

salvus.project.components.action.seismology.seismology_action_component

salvus.project.components.action.seismology.seismology_action_component salvus project components action seismology seismology_action_component
Action component for seismology.

Classes

SeismologyActionComponent

Seismology specific actions.
SIGNATURE
class SeismologyActionComponent(builtins.object):
    def __init__(self, project: Project): ...
ARGUMENTS
Required
project
Type:Project
Description:
The project for the component.

Methods

SeismologyActionComponent.add_asdf_file()
Convenience function adding a complete ASDF file to the project.
There are a few prerequisites and assumption about the ASDF file:
  • It must contain exactly one earthquake/event and this event must contain a moment tensor.
  • All waveform data is assumed to be for this one event meaning that the start time of every trace should approximately be the event time and it should be long enough so that the receiver records the phases one it interested in.
  • All waveform data must have an associated StationXML file.
SIGNATURE
def add_asdf_file(
    self,
    filename: pathlib.Path | str,
    data_name: str,
    receiver_fields: list[str],
    event_name: str | None = None,
) -> None: ...
ARGUMENTS
Required
filename
Type:pathlib.Path | str
Description:
Path to the ASDF file.
Required
data_name
Type:str
Description:
Name of the data set within the project.
Required
receiver_fields
Type:list[str]
Description:
Receiver fields for the new to be created receivers.
Optional
event_name
Type:str | None
Default value:None
Description:
Specify a custom event name. If not given it will automatically derive a descriptive event name.
SeismologyActionComponent.add_receiver_weights_to_windows()
Add station weights to existing windows.
This is largely a convenience method to ease weight computation for seismological full waveform inversions as it offers a few already implemented common weight selection schemes as well as an easy interface to add custom weighting schemes in a seismological context.
Everything here could also be done by utilizing the functionality by the WindowAndWeight component in SalvusProject.
Will only modify the weights of receivers that have windows picked so if you repick the windows, best recompute the weights.
It will overwrite any already chosen weight.
SIGNATURE
def add_receiver_weights_to_windows(
    self,
    data_selection_configuration: str,
    events: (
        str
        | collections.abc.Sequence[str]
        | Event
        | collections.abc.Sequence[Event]
        | EventCollection
    ),
    weighting_chain: list[dict],
    normalize: bool,
) -> None: ...
ARGUMENTS
Required
data_selection_configuration
Type:str
Description:
Name of the data selection configuration.
Required
events
Type:str | collections.abc.Sequence[str] | Event | collections.abc.Sequence[Event] | EventCollection
Description:
Events to pick weights for.
Required
weighting_chain
Type:list[dict]
Description:
A list of weighting functions to be applied in order. Weights from different functions will be multiplied together.
Required
normalize
Type:bool
Description:
If True (recommended) normalize the sum of all weights to be equal to the receiver count after the all weighting functions have been applied.
SeismologyActionComponent.download_data_for_event()
Download seismological data for a given project and event.
SIGNATURE
def download_data_for_event(
    self,
    data_name: str,
    event: str | Event,
    add_receivers_to_project_event: bool,
    receiver_fields: list[str] | None = None,
    seconds_before_event: salvus._core.types.float_,
    seconds_after_event: salvus._core.types.float_,
    download_providers: collections.abc.Sequence[str] | None = None,
    channel_priorities: typing.Sequence[str] = (
        "BH[Z,N,E,1,2,3]",
        "LH[Z,N,E,1,2,3]",
        "HH[Z,N,E,1,2,3]",
        "EH[Z,N,E,1,2,3]",
        "MH[Z,N,E,1,2,3]",
    ),
    location_priorities: typing.Sequence[str] = (
        "",
        "00",
        "10",
        "20",
        "01",
        "02",
    ),
    minimum_interstation_distance_in_m: salvus._core.types.float_ = 1000.0,
    network: str | None = None,
    station: str | None = None,
    location: str | None = None,
    channel: str | None = None,
) -> None: ...
ARGUMENTS
Required
data_name
Type:str
Description:
The name the data set will have in the project.
Required
event
Type:str | Event
Description:
The event.
Required
add_receivers_to_project_event
Type:bool
Description:
Add new receivers to the project or not.
Optional
receiver_fields
Type:list[str] | None
Default value:None
Description:
Receiver fields.
Required
seconds_before_event
Type:salvus._core.types.float_
Description:
Use this many seconds before the event.
Required
seconds_after_event
Type:salvus._core.types.float_
Description:
Use this many seconds after the event.
Optional
download_providers
Type:collections.abc.Sequence[str] | None
Default value:None
Description:
Download providers.
Optional
channel_priorities
Type:typing.Sequence[str]
Default value:('BH[Z,N,E,1,2,3]', 'LH[Z,N,E,1,2,3]', 'HH[Z,N,E,1,2,3]', 'EH[Z,N,E,1,2,3]', 'MH[Z,N,E,1,2,3]')
Description:
Channel priority list.
Optional
location_priorities
Type:typing.Sequence[str]
Default value:('', '00', '10', '20', '01', '02')
Description:
Location priority list.
Optional
minimum_interstation_distance_in_m
Type:salvus._core.types.float_
Default value:1000.0
Description:
Minimum interstation distance in meters.
Optional
network
Type:str | None
Default value:None
Description:
Only use these network codes if specified.
Optional
station
Type:str | None
Default value:None
Description:
Only use these station codes if specified.
Optional
location
Type:str | None
Default value:None
Description:
Only use these location codes if specified.
Optional
channel
Type:str | None
Default value:None
Description:
Only use these channel codes if specified.
SeismologyActionComponent.get_events_from_csv_catalog_file()
Get optimally distributed events from a given catalog file that could be added to the project. This method is aware of the currently available events in the project and can be used to add new events to an existing project.
Have a look at the Salvus documentation for information on where to acquire/how to create these catalog files. It does not use any standard seismological event file formats for performance reasons.
It is optimal in the sense that it will always select the one event from the catalog that has the smallest distance to the next closest existing event. It is then removed from the catalog and the procedure repeats until max_count elements have been added or until min_distance_in_meter or some other constraint can no longer be satisfied. The first event will always be random if the project does not yet have any events.
SIGNATURE
def get_events_from_csv_catalog_file(
    self,
    filename: pathlib.Path,
    max_count: salvus._core.types.int_,
    min_moment_magnitude: salvus._core.types.float_,
    max_moment_magnitude: salvus._core.types.float_,
    min_distance_in_meters: salvus._core.types.float_,
    min_year: salvus._core.types.int_,
    max_year: salvus._core.types.int_,
    random_seed: salvus._core.types.int_ | None = None,
) -> EventCollection: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
Path to the CSV file.
Required
max_count
Type:salvus._core.types.int_
Description:
Get at max this many events. Less events might be returned if any of the other constraints can no longer be fulfilled.
Required
min_moment_magnitude
Type:salvus._core.types.float_
Description:
Lower magnitude bound for the chosen events.
Required
max_moment_magnitude
Type:salvus._core.types.float_
Description:
Upper magnitude bound for the chosen events.
Required
min_distance_in_meters
Type:salvus._core.types.float_
Description:
Minimum acceptable great-circle distance in meters between any two events.
Required
min_year
Type:salvus._core.types.int_
Description:
Minimum year from which to choose events.
Required
max_year
Type:salvus._core.types.int_
Description:
Maximum year from which to choose events.
Optional
random_seed
Type:salvus._core.types.int_ | None
Default value:None
Description:
The first event is randomly chosen if the project does not yet contain any events. Specify a seed to make it reproducible. Useful for test and potentially tutorials.
SeismologyActionComponent.get_events_with_windows()
Returns the names of all events that have windows for a chosen data selection configuration.
SIGNATURE
def get_events_with_windows(
    self, data_selection_configuration_name: str
) -> list[str]: ...
ARGUMENTS
Required
data_selection_configuration_name
Type:str
Description:
Name of the data selection configuration.
SeismologyActionComponent.pick_windows()
Pick windows on seismological data sets.
Uses a windows picking function inspired by LASIF.
SIGNATURE
def pick_windows(
    self,
    data_selection_configuration: str,
    observed_data_name: str,
    synthetic_data_name: str,
    events: (
        str
        | collections.abc.Sequence[str]
        | Event
        | collections.abc.Sequence[Event]
        | EventCollection
    ),
    receiver_field: str,
    window_taper_width_in_seconds: salvus._core.types.float_,
    taper_type: str = "hanning",
    window_picking_function: str | collections.abc.Callable,
    window_picking_function_kwargs: dict[str, typing.Any],
    save_results_in_project: bool = True,
    receiver_name_pattern: str | None = None,
    overwrite: bool = False,
) -> list[EventWindowAndWeightSet]: ...
ARGUMENTS
Required
data_selection_configuration
Type:str
Description:
Name of the data selection configuration. If it does not exist yet, it will be created, otherwise a new one will be created.
Required
observed_data_name
Type:str
Description:
Name of the data set to be considered observed data.
Required
synthetic_data_name
Type:str
Description:
Name of the data set to be considered synthetic data.
Required
events
Type:str | collections.abc.Sequence[str] | Event | collections.abc.Sequence[Event] | EventCollection
Description:
List of events to pick windows for.
Required
receiver_field
Type:str
Description:
Receiver field name on which to pick the windows.
Required
window_taper_width_in_seconds
Type:salvus._core.types.float_
Description:
Taper width in seconds when the windows will be applied to the data. The taper width will never be larger than half a window length. This is just passed on to the to be created EventWindowAndWeightSet.
Optional
taper_type
Type:str
Default value:'hanning'
Description:
The type of taper to use. Currently only "hanning" is supported which will use the classical cosine bell Hann/Hanning window. Will default to "hanning" if not given. This is just passed on to the to be created EventWindowAndWeightSet.
Required
window_picking_function
Type:str | collections.abc.Callable
Description:
Either the string "built-in" in which case the built-in window picking function is used or an actual function which will be called for each receiver component.
Required
window_picking_function_kwargs
Type:dict[str, typing.Any]
Description:
Additional keyword arguments to be passed to the window picking function.
Optional
save_results_in_project
Type:bool
Default value:True
Description:
Optionally choose not to save the results in the current project. This is useful when debugging window picking algorithms and trying to find the best settings.
Optional
receiver_name_pattern
Type:str | None
Default value:None
Description:
Optionally specify a wildcarded receiver name pattern so only windows for matching receivers will be picked. Most useful for debugging and when save_results_in_project is False.
Optional
overwrite
Type:bool
Default value:False
Description:
If True potentially already existing window sets for individual will be overwritten with freshly picked windows.
PAGE CONTENTS