Version:

salvus.project.domain.dim3

salvus.project.domain.dim3 salvus project domain dim3
3-D cartesian and spherical domains.

Classes

BoxDomain

A base class to handle all variants of 3-D box-like domains.
A box is a 3-D object defined by its x, y, and z extents. All extents do not need to be the same, i.e. a box is not necessarily a cube.
Construct a simple 3-D box domain.
Any of the coordinate axes can by +/- np.inf to signify that the domain is unbounded in that direction.
SIGNATURE
class BoxDomain(salvus.project.domain.Domain):
    def __init__(
        self,
        x0: salvus._core.types.float_,
        x1: salvus._core.types.float_,
        y0: salvus._core.types.float_,
        y1: salvus._core.types.float_,
        z0: salvus._core.types.float_,
        z1: salvus._core.types.float_,
    ) -> None: ...
ARGUMENTS
Required
x0
Type:salvus._core.types.float_
Description:
Minimum x-coordinate.
Required
x1
Type:salvus._core.types.float_
Description:
Maximum x-coordinate.
Required
y0
Type:salvus._core.types.float_
Description:
Minimum y-coordinate.
Required
y1
Type:salvus._core.types.float_
Description:
Maximum y-coordinate.
Required
z0
Type:salvus._core.types.float_
Description:
Minimum z-coordinate.
Required
z1
Type:salvus._core.types.float_
Description:
Maximum z-coordinate.

Properties

  • bounding_box(np.ndarray)-Domain bounding box.
  • bounds(DomainBounds)-Get the 3-D domain bounds.
  • coordinate_system(CoordinateSystem)-Coordinate system of the domain.
  • dim(int)-Dimensions of the domain.

Class Methods

BoxDomain.from_bounds()
Construct a domain from its bounds.
The bounds can be specified in a number of ways:
  • As a DomainBounds object.
  • As x, y, and z coordinates. If either coordinate is a single value, it will be assumed to be the extent of the domain in that dimension, and the minimum coordinate value will be set to 0.
# Create a box domain with a width of 1.0, a depth of 2.0, and height
# of 3.0.
d = sn.domain.dim3.BoxDomain.from_bounds(1.0, 2.0, 3.0)
# Create a box domain from -1 to 2 in x, 3 to 4 in y, and 5 to 6 in z.
d = sn.domain.dim3.BoxDomain.from_bounds(
    x=(-1.0, 2.0),
    y=(3.0, 4.0),
    z=(5.0, 6.0),
)
SIGNATURE
def from_bounds() -> BoxDomain: ...
BoxDomain.from_json_data()
Load the domain from a file.
SIGNATURE
def from_json_data(d: dict) -> Domain: ...
ARGUMENTS
Required
d
Type:dict
Description:
Dictionary with the JSON data.
BoxDomain.from_material()
Create a new domain from the extents of a material model.
SIGNATURE
def from_material(m: typing.Any) -> Domain: ...
ARGUMENTS
Required
m
Type:typing.Any
Description:
The material model.
BoxDomain.from_salvus_xyz()
Construct a Box domain from a 3-D Salvus model.
The model can either be stored as an xarray.Dataset object, or in a NetCDF file on disk conforming to the Salvus XY file format.
SIGNATURE
def from_salvus_xyz(
    model: Path | str | xr.Dataset,
    shrink_domain: salvus._core.types.float_ = 0.0,
) -> BoxDomain: ...
ARGUMENTS
Required
model
Type:Path | str | xr.Dataset
Description:
Model file, either stored in memory (as an xarray.Dataset) or on disk (as a NetCDF file).
Optional
shrink_domain
Type:salvus._core.types.float_
Default value:0.0
Description:
Reduce the size of the domain w.r.t. the size as defined in the Salvus model.
BoxDomain.from_volume_model()
Create a new domain from the extents of a volumetric model.
SIGNATURE
def from_volume_model(model: volume._VolumeBase) -> Domain: ...
ARGUMENTS
Required
model
Type:volume._VolumeBase
Description:
The volumetric model from which to create the domain.
BoxDomain.from_xarray()
Create a new domain from the extents of an xarray object.
SIGNATURE
def from_xarray(
    d: xr.Dataset | xr.DataArray,
) -> dim2.BoxDomain | dim3.BoxDomain: ...
ARGUMENTS
Required
d
Type:xr.Dataset | xr.DataArray
Description:
The xarray Dataset or DataArray.
BoxDomain.load()
Load the domain from a file.
SIGNATURE
def load(filename: pathlib.Path) -> Domain: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
File from which to load.
BoxDomain.unit()
Construct a 3D unit domain on [0, 1] x [0, 1] x [0, 1].
SIGNATURE
def unit() -> BoxDomain: ...

Methods

BoxDomain.dim_enum()
The dimension as a typed enum.
SIGNATURE
def dim_enum(self) -> Dim: ...
BoxDomain.estimate_max_travel_distance_in_m()
Estimate the maximum distance waves travel to fully cross the domain.
For cartesian domains it will return the distance between two opposing corners. Dimensions that are unbounded are not considered in that computation.
SIGNATURE
def estimate_max_travel_distance_in_m(self) -> float: ...
BoxDomain.is_point_inside_domain()
Determine whether or not p point is within the box.
SIGNATURE
def is_point_inside_domain(
    self,
    x: salvus._core.types.float_,
    y: salvus._core.types.float_,
    z: salvus._core.types.float_ | None = None,
) -> bool: ...
ARGUMENTS
Required
x
Type:salvus._core.types.float_
Description:
x-coordinate to test.
Required
y
Type:salvus._core.types.float_
Description:
y-coordinate to test.
Optional
z
Type:salvus._core.types.float_ | None
Default value:None
Description:
z-coordinate to test. If None test will only be done for the x- and y-coordinates. Defaults to None.
BoxDomain.plot()
Plot the domain.
SIGNATURE
def plot(
    self, events: Event | list[Event] | None = None
) -> go.FigureWidget: ...
ARGUMENTS
Optional
events
Type:Event | list[Event] | None
Default value:None
Description:
Optionally pass events for a domain.
BoxDomain.write()
Write the domain to a file.
SIGNATURE
def write(self, filename: pathlib.Path) -> None: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
Filename to write it to.

SphericalChunkDomain

A Domain representing a part of a sphere, possibly masked by a polygon.
SIGNATURE
class SphericalChunkDomain(salvus.project.domain.dim3.SphericalDomain):
    def __init__(
        self,
        lat_center: salvus._core.types.float_,
        lat_extent: salvus._core.types.float_,
        lon_center: salvus._core.types.float_,
        lon_extent: salvus._core.types.float_,
        radius_in_meter: salvus._core.types.float_,
        polygon: SphericalPolygon | None = None,
        minimum_radius_in_meter: float | None = None,
        chunk_rotation: float | None = None,
    ) -> None: ...
ARGUMENTS
Required
lat_center
Type:salvus._core.types.float_
Description:
Latitude (in geocentric coordinates) of the domain center in degrees.
Required
lat_extent
Type:salvus._core.types.float_
Description:
Latitude extent (in geocentric coordinates) of the domain in degrees.
Required
lon_center
Type:salvus._core.types.float_
Description:
Longitude of the domain center in degrees.
Required
lon_extent
Type:salvus._core.types.float_
Description:
Longitude extent of the domain in degrees.
Required
radius_in_meter
Type:salvus._core.types.float_
Description:
Planet radius.
Optional
polygon
Type:SphericalPolygon | None
Default value:None
Description:
Spherical polygon to further restrict the domain.
Optional
minimum_radius_in_meter
Type:float | None
Default value:None
Description:
Minimum radius of the domain.
Optional
chunk_rotation
Type:float | None
Default value:None
Description:
Rotate the spherical chunk counterclockwise about a vector that points to its center. Specified in degrees.

Properties

  • bounding_box(np.ndarray)-Domain bounding box.
  • bounds(DomainBounds)-Get the 3-D domain bounds.
  • coordinate_system(CoordinateSystem)-Coordinate system of the domain.
  • dim(int)-Dimensions of the domain.
  • polygon(SphericalPolygon | None)-Polygon restricting the domain.

Class Methods

SphericalChunkDomain.from_geojson()
Generate the domain from a polygon specified inside a GeoJSON file.
SIGNATURE
def from_geojson(
    radius_in_meter: salvus._core.types.float_, geojson: Path | str | dict
) -> SphericalDomain: ...
ARGUMENTS
Required
radius_in_meter
Type:salvus._core.types.float_
Description:
Radius of the sphere in meters.
Required
geojson
Type:Path | str | dict
Description:
The GeoJSON document.
SphericalChunkDomain.from_json_data()
Load the domain from a file.
SIGNATURE
def from_json_data(d: dict) -> Domain: ...
ARGUMENTS
Required
d
Type:dict
Description:
Dictionary with the JSON data.
SphericalChunkDomain.from_material()
Create a new domain from the extents of a material model.
SIGNATURE
def from_material(m: typing.Any) -> Domain: ...
ARGUMENTS
Required
m
Type:typing.Any
Description:
The material model.
SphericalChunkDomain.from_spherical_polygon()
Create a domain from a spherical polygon.
SIGNATURE
def from_spherical_polygon(
    radius_in_meter: salvus._core.types.float_, polygon: SphericalPolygon
) -> SphericalChunkDomain | SphericalGlobeDomain: ...
ARGUMENTS
Required
radius_in_meter
Type:salvus._core.types.float_
Description:
Planet radius.
Required
polygon
Type:SphericalPolygon
Description:
The spherical polygon.
SphericalChunkDomain.from_volume_model()
Create a new domain from the extents of a volumetric model.
SIGNATURE
def from_volume_model(model: volume._VolumeBase) -> Domain: ...
ARGUMENTS
Required
model
Type:volume._VolumeBase
Description:
The volumetric model from which to create the domain.
SphericalChunkDomain.from_xarray()
Create a new domain from the extents of an xarray object.
SIGNATURE
def from_xarray(
    d: xr.Dataset | xr.DataArray,
) -> dim2.BoxDomain | dim3.BoxDomain: ...
ARGUMENTS
Required
d
Type:xr.Dataset | xr.DataArray
Description:
The xarray Dataset or DataArray.
SphericalChunkDomain.load()
Load the domain from a file.
SIGNATURE
def load(filename: pathlib.Path) -> Domain: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
File from which to load.

Methods

SphericalChunkDomain.dim_enum()
The dimension as a typed enum.
SIGNATURE
def dim_enum(self) -> Dim: ...
SphericalChunkDomain.estimate_max_travel_distance_in_m()
Estimate the maximum distance waves travel to fully cross the domain.
Returns either the great-circle distance between two opposing corners of the spherical chunk along the surface of the chunk or the maximum distance between any two points of the bounding polygon, if given.
SIGNATURE
def estimate_max_travel_distance_in_m(self) -> float: ...
SphericalChunkDomain.generate_random_points_in_domain()
Generate random points in the domain.
SIGNATURE
def generate_random_points_in_domain(
    self, num_points: salvus._core.types.int_
) -> np.ndarray: ...
ARGUMENTS
Required
num_points
Type:salvus._core.types.int_
Description:
Number of points to generate
SphericalChunkDomain.is_point_inside_domain()
Check if given point is inside the domain.
SIGNATURE
def is_point_inside_domain(
    self,
    latitude: salvus._core.types.float_,
    longitude: salvus._core.types.float_,
) -> bool: ...
ARGUMENTS
Required
latitude
Type:salvus._core.types.float_
Description:
latitude
Required
longitude
Type:salvus._core.types.float_
Description:
longitude
SphericalChunkDomain.plot()
Plot the domain, optionally with events overlaid.
This function uses ipyleaflet to plot the domain, and optionally the sources and receivers. See the online documentation for ipyleaflet for information on the relevant parameters.
SIGNATURE
def plot(
    self,
    zoom: int | None = None,
    events: Event | list[Event] | None = None,
    basemap: xyzservices.lib.TileProvider = {
        "url": "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",
        "max_zoom": 17,
        "html_attribution": 'Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)',
        "attribution": "Map data: (C) OpenStreetMap contributors, SRTM | Map style: (C) OpenTopoMap (CC-BY-SA)",
        "name": "OpenTopoMap",
    },
    domain_color: str = "green",
    cluster: bool = False,
) -> ipyleaflet.Map: ...
ARGUMENTS
Optional
zoom
Type:int | None
Default value:None
Description:
Zoom level to create the map with. If not given, it will zoom to the bounds of the domain.
Optional
events
Type:Event | list[Event] | None
Default value:None
Description:
A list of events to plot.
Optional
basemap
Type:xyzservices.lib.TileProvider
Default value:{'url': 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', 'max_zoom': 17, 'html_attribution': 'Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)', 'attribution': 'Map data: (C) OpenStreetMap contributors, SRTM | Map style: (C) OpenTopoMap (CC-BY-SA)', 'name': 'OpenTopoMap'}
Description:
The background map.
Optional
domain_color
Type:str
Default value:'green'
Description:
Color of the domain boundary.
Optional
cluster
Type:bool
Default value:False
Description:
If a very large number of sources and receivers are passed, the map rendering can become slow. Cluster tries to reduce noise on the map by grouping close objects together.
SphericalChunkDomain.write()
Write the domain to a file.
SIGNATURE
def write(self, filename: pathlib.Path) -> None: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
Filename to write it to.

SphericalDomain

A base class for domains specified in spherical coordinates.
SIGNATURE
class SphericalDomain(salvus.project.domain.Domain):
    def __init__(
        self,
        radius_in_meter: salvus._core.types.float_,
        polygon: SphericalPolygon | None = None,
        minimum_radius_in_meter: float | None = None,
    ) -> None: ...
ARGUMENTS
Required
radius_in_meter
Type:salvus._core.types.float_
Description:
Planet radius.
Optional
polygon
Type:SphericalPolygon | None
Default value:None
Description:
Optionally further restrict the domain with a polygon.
Optional
minimum_radius_in_meter
Type:float | None
Default value:None
Description:
Minimum radius of the domain.

Properties

  • bounding_box(np.ndarray)-Domain bounding box.
  • bounds(DomainBounds)-Get the bounds of this domain.
  • coordinate_system(CoordinateSystem)-Coordinate system of the domain.
  • dim(int)-Dimensions of the domain.
  • polygon(SphericalPolygon | None)-Polygon restricting the domain.

Class Methods

SphericalDomain.from_geojson()
Generate the domain from a polygon specified inside a GeoJSON file.
SIGNATURE
def from_geojson(
    radius_in_meter: salvus._core.types.float_, geojson: Path | str | dict
) -> SphericalDomain: ...
ARGUMENTS
Required
radius_in_meter
Type:salvus._core.types.float_
Description:
Radius of the sphere in meters.
Required
geojson
Type:Path | str | dict
Description:
The GeoJSON document.
SphericalDomain.from_json_data()
Load the domain from a file.
SIGNATURE
def from_json_data(d: dict) -> Domain: ...
ARGUMENTS
Required
d
Type:dict
Description:
Dictionary with the JSON data.
SphericalDomain.from_material()
Create a new domain from the extents of a material model.
SIGNATURE
def from_material(m: typing.Any) -> Domain: ...
ARGUMENTS
Required
m
Type:typing.Any
Description:
The material model.
SphericalDomain.from_spherical_polygon()
Create a domain from a spherical polygon.
SIGNATURE
def from_spherical_polygon(
    radius_in_meter: salvus._core.types.float_, polygon: SphericalPolygon
) -> SphericalChunkDomain | SphericalGlobeDomain: ...
ARGUMENTS
Required
radius_in_meter
Type:salvus._core.types.float_
Description:
Planet radius.
Required
polygon
Type:SphericalPolygon
Description:
The spherical polygon.
SphericalDomain.from_volume_model()
Create a new domain from the extents of a volumetric model.
SIGNATURE
def from_volume_model(model: volume._VolumeBase) -> Domain: ...
ARGUMENTS
Required
model
Type:volume._VolumeBase
Description:
The volumetric model from which to create the domain.
SphericalDomain.from_xarray()
Create a new domain from the extents of an xarray object.
SIGNATURE
def from_xarray(
    d: xr.Dataset | xr.DataArray,
) -> dim2.BoxDomain | dim3.BoxDomain: ...
ARGUMENTS
Required
d
Type:xr.Dataset | xr.DataArray
Description:
The xarray Dataset or DataArray.
SphericalDomain.load()
Load the domain from a file.
SIGNATURE
def load(filename: pathlib.Path) -> Domain: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
File from which to load.

Methods

SphericalDomain.dim_enum()
The dimension as a typed enum.
SIGNATURE
def dim_enum(self) -> Dim: ...
SphericalDomain.estimate_max_travel_distance_in_m()
Estimate the maximum distance waves travel to fully cross the domain.
Will return either the arc distance between two antipodal points or the maximum distance between any two points of the bounding polygon, if given.
SIGNATURE
def estimate_max_travel_distance_in_m(self) -> float: ...
SphericalDomain.generate_random_points_in_domain()
Generate random points in the domain.
SIGNATURE
def generate_random_points_in_domain(
    self, num_points: salvus._core.types.int_
) -> np.ndarray: ...
ARGUMENTS
Required
num_points
Type:salvus._core.types.int_
Description:
Number of points to generate
SphericalDomain.is_point_inside_domain()
Check if the given point is inside the domain.
Argument names of course vary.
SIGNATURE
def is_point_inside_domain(self) -> bool: ...
SphericalDomain.plot()
Plot the domain.
SIGNATURE
def plot(self) -> None: ...
SphericalDomain.write()
Write the domain to a file.
SIGNATURE
def write(self, filename: pathlib.Path) -> None: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
Filename to write it to.

SphericalGlobeDomain

A Domain representing a full sphere, possibly masked by a polygon.
SIGNATURE
class SphericalGlobeDomain(salvus.project.domain.dim3.SphericalDomain):
    def __init__(
        self,
        radius_in_meter: salvus._core.types.float_,
        polygon: SphericalPolygon | None = None,
        minimum_radius_in_meter: float | None = None,
    ) -> None: ...
ARGUMENTS
Required
radius_in_meter
Type:salvus._core.types.float_
Description:
Planet radius.
Optional
polygon
Type:SphericalPolygon | None
Default value:None
Description:
Optionally further restrict the domain.
Optional
minimum_radius_in_meter
Type:float | None
Default value:None
Description:
The minimum radius of the domain.

Properties

  • bounding_box(np.ndarray)-Domain bounding box.
  • bounds(DomainBounds)-Get the 3-D domain bounds.
  • coordinate_system(CoordinateSystem)-Coordinate system of the domain.
  • dim(int)-Dimensions of the domain.
  • polygon(SphericalPolygon | None)-Polygon restricting the domain.

Class Methods

SphericalGlobeDomain.from_geojson()
Generate the domain from a polygon specified inside a GeoJSON file.
SIGNATURE
def from_geojson(
    radius_in_meter: salvus._core.types.float_, geojson: Path | str | dict
) -> SphericalDomain: ...
ARGUMENTS
Required
radius_in_meter
Type:salvus._core.types.float_
Description:
Radius of the sphere in meters.
Required
geojson
Type:Path | str | dict
Description:
The GeoJSON document.
SphericalGlobeDomain.from_json_data()
Load the domain from a file.
SIGNATURE
def from_json_data(d: dict) -> Domain: ...
ARGUMENTS
Required
d
Type:dict
Description:
Dictionary with the JSON data.
SphericalGlobeDomain.from_material()
Create a new domain from the extents of a material model.
SIGNATURE
def from_material(m: typing.Any) -> Domain: ...
ARGUMENTS
Required
m
Type:typing.Any
Description:
The material model.
SphericalGlobeDomain.from_spherical_polygon()
Create a domain from a spherical polygon.
SIGNATURE
def from_spherical_polygon(
    radius_in_meter: salvus._core.types.float_, polygon: SphericalPolygon
) -> SphericalChunkDomain | SphericalGlobeDomain: ...
ARGUMENTS
Required
radius_in_meter
Type:salvus._core.types.float_
Description:
Planet radius.
Required
polygon
Type:SphericalPolygon
Description:
The spherical polygon.
SphericalGlobeDomain.from_volume_model()
Create a new domain from the extents of a volumetric model.
SIGNATURE
def from_volume_model(model: volume._VolumeBase) -> Domain: ...
ARGUMENTS
Required
model
Type:volume._VolumeBase
Description:
The volumetric model from which to create the domain.
SphericalGlobeDomain.from_xarray()
Create a new domain from the extents of an xarray object.
SIGNATURE
def from_xarray(
    d: xr.Dataset | xr.DataArray,
) -> dim2.BoxDomain | dim3.BoxDomain: ...
ARGUMENTS
Required
d
Type:xr.Dataset | xr.DataArray
Description:
The xarray Dataset or DataArray.
SphericalGlobeDomain.load()
Load the domain from a file.
SIGNATURE
def load(filename: pathlib.Path) -> Domain: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
File from which to load.

Methods

SphericalGlobeDomain.dim_enum()
The dimension as a typed enum.
SIGNATURE
def dim_enum(self) -> Dim: ...
SphericalGlobeDomain.estimate_max_travel_distance_in_m()
Estimate the maximum distance waves travel to fully cross the domain.
Will return either the arc distance between two antipodal points or the maximum distance between any two points of the bounding polygon, if given.
SIGNATURE
def estimate_max_travel_distance_in_m(self) -> float: ...
SphericalGlobeDomain.generate_random_points_in_domain()
Generate random points in the domain.
SIGNATURE
def generate_random_points_in_domain(
    self, num_points: salvus._core.types.int_
) -> np.ndarray: ...
ARGUMENTS
Required
num_points
Type:salvus._core.types.int_
Description:
Number of points to generate
SphericalGlobeDomain.is_point_inside_domain()
A point in spherical coordinates is always within the global domain. A separate check is required if the spherical domain contains a polygon.
SIGNATURE
def is_point_inside_domain(
    self,
    latitude: salvus._core.types.float_,
    longitude: salvus._core.types.float_,
) -> bool: ...
ARGUMENTS
Required
latitude
Type:salvus._core.types.float_
Description:
Latitude in degrees.
Required
longitude
Type:salvus._core.types.float_
Description:
Longitude in degrees.
SphericalGlobeDomain.plot()
Plot the domain.
SIGNATURE
def plot(self) -> None: ...
SphericalGlobeDomain.write()
Write the domain to a file.
SIGNATURE
def write(self, filename: pathlib.Path) -> None: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
Filename to write it to.

UtmDomain

A Domain object which represents a UTM zone on Earth.
Construct a UTM domain.
Any of the coordinate axes can by +/- np.inf to signify that the domain is unbounded in that direction. Elevation (the z-coordinate here) is interpreted as the distance above or below the elevation datum, 0 marking the datum itself and positive numbers representing height in meters above the datum. Note that any of the coordinate bounds can be +/- np.inf. This can be useful mainly for the z (elevation) axis, when you later want to determine the maximum depth or elevation of your meshes and models.
SIGNATURE
class UtmDomain(salvus.project.domain.dim3.BoxDomain):
    def __init__(
        self,
        x0: salvus._core.types.float_,
        x1: salvus._core.types.float_,
        y0: salvus._core.types.float_,
        y1: salvus._core.types.float_,
        utm: pyproj.CRS,
    ) -> None: ...
ARGUMENTS
Required
x0
Type:salvus._core.types.float_
Description:
Minimum x-coordinate (easting).
Required
x1
Type:salvus._core.types.float_
Description:
Maximum x-coordinate (easting).
Required
y0
Type:salvus._core.types.float_
Description:
Minimum y-coordinate (northing).
Required
y1
Type:salvus._core.types.float_
Description:
Maximum y-coordinate (northing).
Required
utm
Type:pyproj.CRS
Description:
A pyproj.CRS object which represents the coordinate frame of the desired UTM domain.

Properties

  • bounding_box(np.ndarray)-Domain bounding box.
  • bounds(DomainBounds)-Get the 3-D domain bounds.
  • coordinate_system(CoordinateSystem)-Coordinate system of the domain.
  • dim(int)-Dimensions of the domain.
  • spherical_bounding_box(tuple[npt.NDArray, npt.NDArray])-Get the bounding box of this domain in spherical WGS 84 coordinates. Returns: A 2-tuple of length 2 numpy arrays, which have the minimum and maximum latitude and longitude values.
  • utm(pyproj.CRS)-The projection object defining the domain within the UTM zone.

Class Methods

UtmDomain.from_appeears_request()
Construct a UTM domain from an AppEEARS request.
The AppEEARS webservice (https://lpdaacsvc.cr.usgs.gov/appeears/) is a service run by the USGS. The service provides an easy interface for the downloading of Salvus-compatible topography files from the NASA SRTM missions. This function allows you to create a domain object directly from the .json file that comes with the AppEEARS request.
SIGNATURE
def from_appeears_request(
    json_file: Path | dict | str,
    shrink_domain: salvus._core.types.float_ = 0.0,
) -> UtmDomain: ...
ARGUMENTS
Required
json_file
Type:Path | dict | str
Description:
Path to the AppEEARS request JSON, or the json file itself (as a dictionary).
Optional
shrink_domain
Type:salvus._core.types.float_
Default value:0.0
Description:
Often the actual domain of interest is smaller than the full size of the domain specified in AppEEARS. Enter a value here to shrink the domain in the easting and northing dimensions by the provided number of meters. This is especially useful when one wants to attach absorbing boundary layers to the domain, as without shrinking the boundary layers may extend past the topographic information in the AppEEARS data. Defaults to 0.0.
UtmDomain.from_bounds()
Construct a domain from its bounds.
The bounds can be specified in a number of ways:
  • As a DomainBounds object.
  • As x, y, and z coordinates. If either coordinate is a single value, it will be assumed to be the extent of the domain in that dimension, and the minimum coordinate value will be set to 0.
# Create a box domain with a width of 1.0, a depth of 2.0, and height
# of 3.0.
d = sn.domain.dim3.BoxDomain.from_bounds(1.0, 2.0, 3.0)
# Create a box domain from -1 to 2 in x, 3 to 4 in y, and 5 to 6 in z.
d = sn.domain.dim3.BoxDomain.from_bounds(
    x=(-1.0, 2.0),
    y=(3.0, 4.0),
    z=(5.0, 6.0),
)
SIGNATURE
def from_bounds() -> BoxDomain: ...
UtmDomain.from_events()
Generate a UTM domain from the surface extent of one or more events.
SIGNATURE
def from_events(
    events: Event | list[Event],
    utm: pyproj.CRS,
    buffer_in_meters: salvus._core.types.float_ = 0.0,
) -> UtmDomain: ...
ARGUMENTS
Required
events
Type:Event | list[Event]
Description:
A list of events from which to compute the extent. These events should be comprised of Cartesian sources and receivers. The extent will be measured from the first two coordinates of each contained source / receiver object, which should represent x (easting) and y (northing). These objects do not yet need to be attached to a mesh, as the "z" value will be ignored as in the convention in UTM domains.
Required
utm
Type:pyproj.CRS
Description:
A pyproj.CRS object which represents the coordinate frame of the desired UTM domain.
Optional
buffer_in_meters
Type:salvus._core.types.float_
Default value:0.0
Description:
Add this much distance to the bounding box defined by the sources and receivers. You almost always want to set something here, otherwise some of your sources and receivers will be extremely close to the edge.
UtmDomain.from_json_data()
Load the domain from a file.
SIGNATURE
def from_json_data(d: dict) -> Domain: ...
ARGUMENTS
Required
d
Type:dict
Description:
Dictionary with the JSON data.
UtmDomain.from_material()
Create a new domain from the extents of a material model.
SIGNATURE
def from_material(m: typing.Any) -> Domain: ...
ARGUMENTS
Required
m
Type:typing.Any
Description:
The material model.
UtmDomain.from_salvus_xyz()
Construct a Box domain from a 3-D Salvus model.
The model can either be stored as an xarray.Dataset object, or in a NetCDF file on disk conforming to the Salvus XY file format.
SIGNATURE
def from_salvus_xyz(
    model: Path | str | xr.Dataset,
    shrink_domain: salvus._core.types.float_ = 0.0,
) -> BoxDomain: ...
ARGUMENTS
Required
model
Type:Path | str | xr.Dataset
Description:
Model file, either stored in memory (as an xarray.Dataset) or on disk (as a NetCDF file).
Optional
shrink_domain
Type:salvus._core.types.float_
Default value:0.0
Description:
Reduce the size of the domain w.r.t. the size as defined in the Salvus model.
UtmDomain.from_spherical_chunk()
Create a UTM domain from geographical latitude/longitude bounds.
SIGNATURE
def from_spherical_chunk(
    min_latitude: salvus._core.types.float_,
    max_latitude: salvus._core.types.float_,
    min_longitude: salvus._core.types.float_,
    max_longitude: salvus._core.types.float_,
) -> UtmDomain: ...
ARGUMENTS
Required
min_latitude
Type:salvus._core.types.float_
Description:
Minimum domain latitude in WGS84.
Required
max_latitude
Type:salvus._core.types.float_
Description:
Maximum domain latitude in WGS84.
Required
min_longitude
Type:salvus._core.types.float_
Description:
Minimum domain longitude in WGS84.
Required
max_longitude
Type:salvus._core.types.float_
Description:
Maximum domain longitude in WGS84.
UtmDomain.from_volume_model()
Create a new domain from the extents of a volumetric model.
SIGNATURE
def from_volume_model(model: volume._VolumeBase) -> Domain: ...
ARGUMENTS
Required
model
Type:volume._VolumeBase
Description:
The volumetric model from which to create the domain.
UtmDomain.from_xarray()
Create a new domain from the extents of an xarray object.
SIGNATURE
def from_xarray(
    d: xr.Dataset | xr.DataArray,
) -> dim2.BoxDomain | dim3.BoxDomain: ...
ARGUMENTS
Required
d
Type:xr.Dataset | xr.DataArray
Description:
The xarray Dataset or DataArray.
UtmDomain.load()
Load the domain from a file.
SIGNATURE
def load(filename: pathlib.Path) -> Domain: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
File from which to load.
UtmDomain.unit()
Construct a 3D unit domain on [0, 1] x [0, 1] x [0, 1].
SIGNATURE
def unit() -> BoxDomain: ...

Methods

UtmDomain.dim_enum()
The dimension as a typed enum.
SIGNATURE
def dim_enum(self) -> Dim: ...
UtmDomain.download_topography_and_bathymetry()
Download topography for the current domain from the https://www.gmrt.org gridservice.
SIGNATURE
def download_topography_and_bathymetry(
    self,
    filename: str,
    buffer_in_degrees: salvus._core.types.float_ = 0.0,
    resolution: str = "default",
) -> None: ...
ARGUMENTS
Required
filename
Type:str
Description:
Filename to safe to.
Optional
buffer_in_degrees
Type:salvus._core.types.float_
Default value:0.0
Description:
Buffer outside the current domain to account for edge effects when interpolating the topography/bathymetry.
Optional
resolution
Type:str
Default value:'default'
Description:
Resolution for the topography. Possibilities are "low"/"default", "med", "high", and"max'.
UtmDomain.estimate_max_travel_distance_in_m()
Estimate the maximum distance waves travel to fully cross the domain.
For cartesian domains it will return the distance between two opposing corners. Dimensions that are unbounded are not considered in that computation.
SIGNATURE
def estimate_max_travel_distance_in_m(self) -> float: ...
UtmDomain.is_point_inside_domain()
Determine whether or not p point is within the box.
SIGNATURE
def is_point_inside_domain(
    self,
    x: salvus._core.types.float_,
    y: salvus._core.types.float_,
    z: salvus._core.types.float_ | None = None,
) -> bool: ...
ARGUMENTS
Required
x
Type:salvus._core.types.float_
Description:
x-coordinate to test.
Required
y
Type:salvus._core.types.float_
Description:
y-coordinate to test.
Optional
z
Type:salvus._core.types.float_ | None
Default value:None
Description:
z-coordinate to test. If None test will only be done for the x- and y-coordinates. Defaults to None.
UtmDomain.plot()
Plot the domain, optionally with events overlaid.
This function uses ipyleaflet to plot the domain, and optionally the sources and receivers. See the online documentation for ipyleaflet for information on the relevant parameters.
SIGNATURE
def plot(
    self,
    zoom: int | None = None,
    events: Event | list[Event] | None = None,
    basemap: xyzservices.lib.TileProvider = {
        "url": "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",
        "max_zoom": 17,
        "html_attribution": 'Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)',
        "attribution": "Map data: (C) OpenStreetMap contributors, SRTM | Map style: (C) OpenTopoMap (CC-BY-SA)",
        "name": "OpenTopoMap",
    },
    cluster: bool = False,
) -> ipyleaflet.Map: ...
ARGUMENTS
Optional
zoom
Type:int | None
Default value:None
Description:
Zoom level to create the map with. If None, it will zoom to the domain bounds.
Optional
events
Type:Event | list[Event] | None
Default value:None
Description:
A list of events to plot.
Optional
basemap
Type:xyzservices.lib.TileProvider
Default value:{'url': 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', 'max_zoom': 17, 'html_attribution': 'Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)', 'attribution': 'Map data: (C) OpenStreetMap contributors, SRTM | Map style: (C) OpenTopoMap (CC-BY-SA)', 'name': 'OpenTopoMap'}
Description:
The background map.
Optional
cluster
Type:bool
Default value:False
Description:
If a very large number of sources and receivers are passed, the map rendering can become slow. Cluster tries to reduce noise on the map by grouping close objects together.
UtmDomain.write()
Write the domain to a file.
SIGNATURE
def write(self, filename: pathlib.Path) -> None: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
Filename to write it to.

Used in tutorials

Functionality from this module is used in the following tutorials.
PAGE CONTENTS