pyrocko.dataset.slab2

Slab2 subduction zone geometry model from the USGS (Slab2).

The model provides gridded depth, depth uncertainty, strike, dip and thickness of the subducting slabs of 27 subduction zones on a regular 0.05 degree grid.

On first use, the Slab2 distribution archive is downloaded and the gridded text files it contains are converted into a compact binary representation, which is cached in the directory given by the slab2_dir setting of the Pyrocko configuration (default: ~/.pyrocko/slab2).

Example:

from pyrocko.dataset.slab2 import Slab2

slabs = Slab2()
slab = slabs.get_slab('sam')
print(slab.name, slab.depth.shape)
vertices, faces = slab.get_mesh()

Citation

Hayes, G., 2018, Slab2 - A Comprehensive Subduction Zone Geometry Model: U.S. Geological Survey data release, https://doi.org/10.5066/F7PV6JNV.

Functions

get_parameter_names()

Get names of the parameters available for each slab.

get_slab_names()

Get full names of all Slab2 subduction zones.

get_slab_prefixes()

Get the three-letter abbreviations of all Slab2 subduction zones.

Classes

Slab(prefix, lats, lons, **grids)

Gridded geometry of a single subduction zone slab.

Slab2([archive_path, data_dir])

Access to the Slab2 subduction zone geometry model.

get_slab_names()[source]

Get full names of all Slab2 subduction zones.

get_slab_prefixes()[source]

Get the three-letter abbreviations of all Slab2 subduction zones.

get_parameter_names()[source]

Get names of the parameters available for each slab.

class Slab(prefix, lats, lons, **grids)[source]

Bases: object

Gridded geometry of a single subduction zone slab.

Grid nodes outside of the slab are set to NaN.

Variables:
  • prefix – three-letter abbreviation of the slab

  • name – full name of the subduction zone

  • lats – latitudes of the grid nodes [deg], shape (nlat,)

  • lons – longitudes of the grid nodes [deg], shape (nlon,). As in the original dataset, these are in the range [0, 360].

  • depth – depth of the slab surface [m], positive downwards

  • depth_uncertainty – uncertainty of the slab depth [m]

  • strike – strike of the slab surface [deg]

  • dip – dip of the slab surface [deg]

  • thickness – slab thickness [m]

The gridded parameters are 2D arrays of shape (nlat, nlon).

get_values(parameter)[source]

Get gridded values of a parameter.

Parameters:

parameter – name of the parameter, see get_parameter_names()

Returns:

numpy.ndarray of shape (nlat, nlon)

get_latlondepth()[source]

Get coordinates of all grid nodes inside the slab.

Returns:

numpy.ndarray of shape (n, 3), with columns latitude [deg], longitude [deg] and depth [m]

get_mesh(planetradius=None)[source]

Get quadrilateral surface mesh of the slab.

Only cells for which all four corners are inside the slab are included.

Parameters:

planetradius – planet radius [m], defaults to pyrocko.cake.earthradius

Returns:

(vertices, faces), where vertices are Cartesian coordinates of shape (nvertices, 3), normalized to the planet radius, as used in pyrocko.geometry, and faces is an integer array of shape (nfaces, 4) with vertex indices.

get_face_values(parameter)[source]

Get values of a parameter for the faces of the mesh.

The values are averaged over the four corners of each face, matching the faces returned by get_mesh().

Parameters:

parameter – name of the parameter, see get_parameter_names()

Returns:

numpy.ndarray of shape (nfaces,)

get_geometry()[source]

Get slab surface as pyrocko.model.Geometry.

All available parameters are attached as face properties.

Returns:

pyrocko.model.Geometry object

class Slab2(archive_path=None, data_dir=None)[source]

Bases: object

Access to the Slab2 subduction zone geometry model.

Parameters:
  • archive_path – path to a manually downloaded copy of the Slab2 distribution archive (Slab2Distribute_Mar2018.tar.gz). If not given, the archive is expected in (or downloaded to) data_dir.

  • data_dir – directory where the converted data is cached. Defaults to the slab2_dir setting of the Pyrocko configuration.

download()[source]

Download the Slab2 distribution archive.

convert()[source]

Convert gridded text files from the Slab2 archive to binary cache.

All slabs are converted in a single pass through the archive.

get_slab(prefix)[source]

Get geometry of a slab.

Parameters:

prefix – three-letter abbreviation of the slab, see get_slab_prefixes()

Returns:

Slab object

get_slabs(prefixes=None)[source]

Get geometries of several slabs.

Parameters:

prefixes – list of three-letter abbreviations of the slabs to load, defaults to all slabs

Returns:

list of Slab objects