Skip to content

Stations

Qseek needs the location and the code of every station. Load them from StationXML or Pyrocko station YAML files:

Stations from StationXML
"stations": {
  "station_xmls": ["meta/stations.xml", "meta/temporary-network/"],
  "blacklist": ["GE.RUE.", "6A.STA*"]
}

station_xmls takes files and directories; Qseek loads all .xml files of a directory. Pyrocko station YAML files go into pyrocko_station_yamls. When the search starts, Qseek removes stations without waveform data.

  • Exclude stations with the blacklist, as station codes. Partial codes and wildcards exclude whole networks or groups of stations.
  • Limit the network with max_distance in meters from the center of the stations, e.g. to ignore distant stations of a regional network.

Instrument responses

Magnitudes and ground motions are measured on restituted waveforms. They need the instrument responses from StationXML.

StationInventory
{
  "pyrocko_station_yamls": [],
  "station_xmls": [],
  "blacklist": [],
  "stations": [],
  "max_distance": null
}

StationInventory pydantic-model

Bases: Model

The seismic stations used in the search.

Stations are loaded from StationXML or Pyrocko station YAML files. When the search starts, stations without waveform data are removed.

Fields:

pyrocko_station_yamls pydantic-field

pyrocko_station_yamls: list[FilePath]

List of Pyrocko station YAML files.

station_xmls pydantic-field

station_xmls: list[FilePath | DirectoryPath]

List of StationXML files or directories containing StationXML (.xml) files.

blacklist pydantic-field

blacklist: Blacklist

Stations to exclude from the search, as NSL codes, e.g. ["GE.RUE."].

stations pydantic-field

stations: list[Station]

List of stations in the inventory.

max_distance pydantic-field

max_distance: PositiveFloat | None = None

Maximum distance in meters from the centroid location to include stations for detection. If None, all stations are included.

n_stations property

n_stations: int

Number of stations.

n_networks property

n_networks: int

Number of stations.

sanitize_stations

sanitize_stations() -> None

Remove stations with bad coordinates or duplicates.

filter_stations

filter_stations(nsls: Iterable[NSL]) -> None

Filter stations by NSL codes.

All stations not in the provided NSL codes are removed from the inventory.

Parameters:

Name Type Description Default
nsls list[NSL]

List of NSL codes to keep.

required

prepare

prepare(location: Location) -> None

Prepare the station inventory.

Parameters:

Name Type Description Default
location Location

Location to calculate distances from.

required

Raises:

Type Description
ValueError

If no stations are available after preparation.

mean_interstation_distance

mean_interstation_distance() -> float

Calculate the mean interstation distance.

Returns:

Name Type Description
float float

Mean interstation distance in meters.

get_nsls

get_nsls() -> tuple[NSL, ...]

Get all NSL codes from all stations.

select_from_traces

select_from_traces(
    traces: Sequence[Trace],
) -> list[Station]

Select stations by NSL code.

Stations are not unique and are ordered by the input traces.

Parameters:

Name Type Description Default
traces Iterable[Trace]

Iterable of Pyrocko Traces

required

Returns:

Name Type Description
Stations list[Station]

Containing only selected stations.

get_centroid

get_centroid() -> Location

Get centroid location from all stations.

Returns:

Name Type Description
Location Location

Centroid Location.

as_pyrocko_stations

as_pyrocko_stations() -> list[Station]

Convert the stations to PyrockoStation objects.

Returns:

Type Description
list[Station]

A list of PyrockoStation objects.

export_pyrocko_stations

export_pyrocko_stations(filename: Path) -> None

Dump stations to pyrocko station yaml file.

Parameters:

Name Type Description Default
filename Path

Path to yaml file.

required

export_csv

export_csv(filename: Path) -> None

Dump stations to CSV file.

Parameters:

Name Type Description Default
filename Path

Path to CSV file.

required

get_responses async

get_responses(
    start_time: datetime,
    end_time: datetime,
    traces: list[Trace],
) -> Any

Get station responses from the Squirrel.

Parameters:

Name Type Description Default
start_time datetime

Start time of the responses.

required
end_time datetime

End time of the responses.

required
traces list[Trace]

List of Pyrocko Traces to get responses for.

required

Returns:

Name Type Description
Any Any

Station responses.