Skip to content

Search volume

The search volume is the region where Qseek looks for earthquakes; you configure it in the octree of the search. You place it with a center location and its bounds in east, north and depth direction, relative to the center. Qseek divides the volume into root nodes and refines the nodes around detected events, see octree refinement.

Octree refinement

The octree refines around a seismic source, from level 0 with 5977 nodes to level 2 with 6812 nodes. Map view (top) and depth section (bottom) of the semblance; the cross marks the maximum.

Set up the volume

  • Center: set location to the center of your network or of the expected seismicity. The location must not be 0, 0.
  • Bounds: east_bounds, north_bounds and depth_bounds are in meters, relative to the center. Depth is positive down. Leave a margin around the seismicity: detections at the border of the volume are ignored, see ignore_boundary.
  • Root nodes: every extent must be a multiple of root_node_size. The number of root nodes sets the cost of the coarse search: the default 20 km × 20 km × 20 km volume with 1 km root nodes has 8000 root nodes.
  • Resolution: the smallest node size is root_node_size / 2**(n_levels - 1). The defaults, 1 km root nodes and 5 levels, refine down to 62.5 m.

Tip

Qseek stacks every root node in every window, but refines only the nodes around detections. For a finer resolution, add levels rather than shrinking the root nodes.

Octree
{
  "location": {
    "lat": 52.38,
    "lon": 13.06,
    "east_shift": 0.0,
    "north_shift": 0.0,
    "elevation": 0.0,
    "depth": 0.0
  },
  "root_node_size": 1000.0,
  "n_levels": 5,
  "east_bounds": [
    -10000.0,
    10000.0
  ],
  "north_bounds": [
    -10000.0,
    10000.0
  ],
  "depth_bounds": [
    0.0,
    20000.0
  ]
}

Octree pydantic-model

Bases: BaseModel, Iterator[Node], Sequence[Node]

The search volume, divided into an octree of nodes.

The volume is set by its center location and its bounds in east, north and depth direction, and divided into root nodes of root_node_size. Around detected events, Qseek splits nodes into eight smaller nodes to refine the localization.

Config:

  • ignored_types: (cached_property,)

Fields:

Validators:

location pydantic-field

location: Location = Location(lat=0.0, lon=0.0)

The geographical center of the octree.

root_node_size pydantic-field

root_node_size: PositiveFloat = 1 * KM

Size of the root node at the initial level (level 0) in meters.

n_levels pydantic-field

n_levels: int = 5

Number of levels of the octree, including the root level. The smallest node size, and the resolution of the localization, is root_node_size / 2**(n_levels - 1).

east_bounds pydantic-field

east_bounds: Range = Range(-10 * KM, 10 * KM)

East bounds of the octree in meters.

north_bounds pydantic-field

north_bounds: Range = Range(-10 * KM, 10 * KM)

North bounds of the octree in meters.

depth_bounds pydantic-field

depth_bounds: Range = Range(0 * KM, 20 * KM)

Depth bounds of the octree in meters.

n_nodes cached property

n_nodes: int

Number of nodes in the octree.

n_leaf_nodes cached property

n_leaf_nodes: int

Number of nodes in the octree.

nodes property

nodes: list[Node]

List of nodes in the octree.

volume property

volume: float

Volume of the octree in cubic meters.

effective_depth_bounds property

effective_depth_bounds: Range

Effective depth bounds of the octree in meters.

leaf_nodes cached property

leaf_nodes: list[Node]

Get all leaf nodes of the octree.

Returns:

Type Description
list[Node]

list[Node]: List of leaf nodes.

semblance property

semblance: ndarray

Returns the semblance values of all nodes.

check_limits pydantic-validator

check_limits() -> Octree

Check that the size limits are valid.

extent

extent() -> tuple[float, float, float]

Returns the extent of the octree.

Returns:

Type Description
tuple[float, float, float]

tuple[float, float, float]: EW, NS and depth extent of the octree in meters.

reset

reset() -> Self

Reset the octree to its initial state and return it.

clear

clear() -> None

Clear the octree's cached data.

set_level

set_level(level: int) -> None

Set the octree to a specific level.

Parameters:

Name Type Description Default
level int

Level to set the octree to.

required

reduce_axis

reduce_axis(
    surface: Literal["NE", "ED", "ND"] = "NE",
    max_level: int = -1,
    accumulator: Callable[ndarray] = max,
) -> ndarray

Reduce the octree's nodes to the surface.

Parameters:

Name Type Description Default
surface Literal['NE', 'ED', 'ND']

Surface to reduce to. Defaults to "NE".

'NE'
max_level int

Maximum level to reduce to. Defaults to -1.

-1
accumulator Callable

Accumulator function. Defaults to np.max.

max

Returns:

Type Description
ndarray

np.ndarray: Of shape (n-nodes, 4) with columns (east, north, depth, value).

map_semblance

map_semblance(
    semblance: ndarray, leaf_only: bool = True
) -> None

Maps semblance values to nodes.

Parameters:

Name Type Description Default
semblance ndarray

Of shape (n-nodes,).

required
leaf_only bool

If True, only leaf nodes are mapped. Defaults to True.

True

distances_stations

distances_stations(stations: StationInventory) -> ndarray

Returns the 3D distances from all nodes to all stations.

Parameters:

Name Type Description Default
stations Stations

Stations to calculate distance to.

required

Returns:

Type Description
ndarray

np.ndarray: Of shape (n-nodes, n-stations).

distances_stations_surface

distances_stations_surface(
    stations: StationInventory,
) -> ndarray

Returns the surface distance from all nodes to all stations.

Parameters:

Name Type Description Default
stations Stations

Stations to calculate distance to.

required

Returns:

Type Description
ndarray

np.ndarray: Distances in shape (n-nodes, n-stations).

get_nodes

get_nodes(indices: Iterable[int]) -> list[Node]

Retrieves a list of nodes from the octree based on the given indices.

Parameters:

Name Type Description Default
indices Iterable[int]

The indices of the nodes to retrieve.

required

Returns:

Type Description
list[Node]

list[Node]: A list of nodes corresponding to the given indices.

get_nodes_by_threshold

get_nodes_by_threshold(
    semblance_threshold: float = 0.0,
) -> list[Node]

Get all nodes with a semblance above a threshold.

Parameters:

Name Type Description Default
semblance_threshold float

Semblance threshold. Default is 0.0.

0.0

Returns:

Type Description
list[Node]

list[Node]: List of nodes.

get_nodes_level

get_nodes_level(level: int = 0) -> list[Node]

Get all nodes at a specific level.

Parameters:

Name Type Description Default
level int

Level to get nodes from.

0

Returns:

Type Description
list[Node]

list[Node]: List of nodes.

get_node_size

get_node_size(level: int = 0) -> float

Get the size of a node at a specific level.

Parameters:

Name Type Description Default
level int

Level to get node size from.

0

Returns:

Name Type Description
float float

Size of the node.

smallest_node_size

smallest_node_size() -> float

Returns the smallest possible node size.

Returns:

Name Type Description
float float

Smallest possible node size.

total_number_nodes

total_number_nodes() -> int

Returns the total number of nodes of all levels.

Returns:

Name Type Description
int int

Total number of nodes.

interpolate_max_semblance async

interpolate_max_semblance(peak_node: Node) -> Location

Interpolate the location of the maximum semblance value.

This method calculates the location of the maximum semblance value by performing interpolation using surrounding nodes. It uses the scipy Rbf (Radial basis function) interpolation method to fit a smooth function to the given data points. The function is then minimized to find the location of the maximum value.

Returns:

Name Type Description
Location Location

Location of the maximum semblance value.

Raises:

Type Description
AttributeError

If no semblance values are set.

cached_bottom

cached_bottom() -> Self

Returns a copy of the octree refined to the cached bottom nodes.

Raises:

Type Description
EnvironmentError

If the octree has never been split.

Returns:

Name Type Description
Self Self

Copy of the octree with cached bottom nodes.

save_pickle

save_pickle(filename: Path) -> None

Save the octree to a pickle file.

Parameters:

Name Type Description Default
filename Path

Filename to save to.

required

get_corners

get_corners() -> list[Location]

Get the corners of the octree.

Returns:

Type Description
list[Location]

list[Location]: List of locations.