Skip to content

Station Inventory

qseek.models.station.Station pydantic-model

Bases: Location

Fields:

depth pydantic-field

depth: float = 0.0

Depth in meters, positive is down.

east_shift pydantic-field

east_shift: float = 0.0

East shift towards geographical reference in meters.

effective_lat_lon property

effective_lat_lon: tuple[float, float]

Shift-corrected lat/lon pair of the location.

elevation pydantic-field

elevation: float = 0.0

Elevation in meters.

lat pydantic-field

lat: float

Latitude in degrees.

location pydantic-field

location: str = ''

Location code

lon pydantic-field

lon: float

Longitude in degrees.

network pydantic-field

network: str

Seismic network code

north_shift pydantic-field

north_shift: float = 0.0

North shift towards geographical reference in meters.

nsl property

nsl: _NSL

Network Station Location code as tuple.

Returns:

Type Description
_NSL

tuple[str, str, str]: Network, Station, Location

station pydantic-field

station: str

Station code

as_wkt

as_wkt() -> str

Return the location as WKT string.

azimuth_to

azimuth_to(other: Location) -> float

Compute azimuth [°] to other location object.

Parameters:

Name Type Description Default
other Location

The other location.

required

Returns:

Name Type Description
float float

The azimuth in [°].

distance_to

distance_to(other: Location) -> float

Compute 3-dimensional distance [m] to other location object.

Parameters:

Name Type Description Default
other Location

The other location.

required

Returns:

Name Type Description
float float

The distance in [m].

offset_from

offset_from(other: Location) -> tuple[float, float, float]

Return offset vector (east, north, depth) from other location in [m].

Parameters:

Name Type Description Default
other Location

The other location.

required

Returns:

Type Description
tuple[float, float, float]

tuple[float, float, float]: The offset vector.

origin

origin() -> Location

Get the origin location.

Returns:

Name Type Description
Location Location

The origin location.

shift

shift(east: float, north: float, elevation: float) -> Self

Shift the location by the given offsets.

Parameters:

Name Type Description Default
east float

East offset in [m].

required
north float

North offset in [m].

required
elevation float

Elevation offset in [m].

required

Returns:

Name Type Description
Self Self

The shifted location.

shifted_origin

shifted_origin() -> Self

Shift the origin of the location to the effective lat/lon.

Returns:

Name Type Description
Self Self

The shifted location.

surface_distance_to

surface_distance_to(other: Location) -> float

Compute surface distance [m] to other location object.

Parameters:

Name Type Description Default
other Location

The other location.

required

Returns:

Name Type Description
float float

The surface distance in [m].

qseek.models.station.StationInventory pydantic-model

Bases: BaseModel

Fields:

blacklist pydantic-field

blacklist: Blacklist = Blacklist()

Blacklist stations and exclude from detecion. Format is ['NET.STA.LOC', ...].

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_networks property

n_networks: int

Number of stations.

n_stations property

n_stations: int

Number of stations.

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.

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_csv

export_csv(filename: Path) -> None

Dump stations to CSV file.

Parameters:

Name Type Description Default
filename Path

Path to CSV file.

required

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

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

get_centroid

get_centroid() -> Location

Get centroid location from all stations.

Returns:

Name Type Description
Location Location

Centroid Location.

get_nsls

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

Get all NSL codes from all stations.

mean_interstation_distance

mean_interstation_distance() -> float

Calculate the mean interstation distance.

Returns:

Name Type Description
float float

Mean interstation distance in meters.

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.

sanitize_stations

sanitize_stations() -> None

Remove stations with bad coordinates or duplicates.

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.

qseek.models.station.StationList

Bases: Sequence[Station]

A frozen station list.

Methods:

Name Description
get_index

Get the index of a station by its NSL code.

get_indices

Get the indices of stations by their NSL codes.

get_indices_by_nsl

Get the indices of stations by their NSL codes.

get_index

get_index(nsl: NSL) -> int

Get the index of a station by its NSL code.

Parameters:

Name Type Description Default
nsl NSL

NSL code of the station.

required

Returns:

Name Type Description
int int

Index of the station.

get_indices

get_indices(stations: Sequence[Station]) -> ndarray

Get the indices of stations by their NSL codes.

Parameters:

Name Type Description Default
stations Iterable[Station]

Iterable of stations.

required

Returns:

Type Description
ndarray

np.ndarray: Indices of the stations.

get_indices_by_nsl

get_indices_by_nsl(nsls: Sequence[NSL]) -> ndarray

Get the indices of stations by their NSL codes.

Parameters:

Name Type Description Default
nsls Iterable[NSL]

Iterable of NSL codes of the stations.

required

Returns:

Type Description
ndarray

np.ndarray: Indices of the stations.