Mondaic
This API reference is not for the latest stable Salvus version.

salvus.project.domain.dim3

3-D cartesian and spherical domains.

Classes

BoxDomain

class BoxDomain(salvus.project.domain.Domain):
    def __init__(
        self,
        x0: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        x1: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        y0: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        y1: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        z0: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        z1: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
    ) -> None:
        ...

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.infty to signify that the domain is unbounded in that direction.

Parameters
  • x0 Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum x-coordinate.
  • x1 Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum x-coordinate.
  • y0 Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum y-coordinate.
  • y1 Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum y-coordinate.
  • z0 Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum z-coordinate.
  • z1 Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum z-coordinate.
Attributes
bounding_box numpy.ndarray

Domain bounding box.

bounds salvus.project.domain.DomainBounds

Get the 3-D domain bounds.

coordinate_system str

Coordinate system of the domain.

dim int

Dimensions of the domain.

Methods
from_bounds()
def from_bounds(bounds: salvus.project.domain.DomainBounds) -> BoxDomain:
    ...

Construct from a domain bounds object.

Parameters
  • bounds salvus.project.domain.DomainBounds — The domain bounds.
Returns BoxDomain
from_json_data()
def from_json_data(d: Dict) -> Domain:
    ...

Load the domain from a file.

Parameters
  • d Dict — Dictionary with the JSON data.
Returns Domain
from_material()
def from_material(m: Any) -> Domain:
    ...

Create a new domain from the extents of a material model.

Parameters
  • m Any — The material model.
Returns Domain — Domain: A new domain.
from_salvus_xyz()
def from_salvus_xyz(
    model: Union[pathlib.Path, str, xarray.core.dataset.Dataset],
    shrink_domain: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ] = 0.0,
) -> BoxDomain:
    ...

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.

Parameters
  • model Union[pathlib.Path, str, xarray.core.dataset.Dataset] — Model file, either stored in memory (as an xarray.Dataset) or on disk (as a NetCDF file).
  • shrink_domain Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Reduce the size of the domain w.r.t. the size as defined in the Salvus model.
Returns BoxDomain — A constructed 3-D BoxDomain object.
from_volume_model()
def from_volume_model(
    model: salvus.project.configuration.model.volume._VolumeBase,
) -> Domain:
    ...

Create a new domain from the extents of a volumetric model.

Parameters
  • model salvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.
Returns Domain — A new domain object with the proper extents.
from_xarray()
def from_xarray(
    d: Union[xarray.core.dataset.Dataset, xarray.core.dataarray.DataArray]
) -> Domain:
    ...

Create a new domain from the extents of an xarray object.

Parameters
  • d Union[xarray.core.dataset.Dataset, xarray.core.dataarray.DataArray] — The xarray Dataset or DataArray.
Returns Domain — Domain: A new domain.
load()
def load(filename: pathlib.Path) -> Domain:
    ...

Load the domain from a file.

Parameters
  • filename pathlib.Path — File from which to load.
Returns Domain
dim_enum()
def dim_enum(self) -> salvus.project.components.types.Dim:
    ...

The dimension as a typed enum.

Returns salvus.project.components.types.Dim
estimate_max_travel_distance_in_m()
def estimate_max_travel_distance_in_m(self) -> float:
    ...

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.

Returns float
is_point_inside_domain()
def is_point_inside_domain(
    self,
    x: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    y: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    z: Optional[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ] = None,
) -> bool:
    ...

Determine whether or not p point is within the box.

Parameters
  • x Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — x-coordinate to test.
  • y Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — y-coordinate to test.
  • z Optional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — z-coordinate to test. If None test will only be done for the x- and y-coordinates. Defaults to None.
Returns bool — True or False whether or not the point is in the box.
plot()
def plot(
    self,
    events: Optional[
        salvus.flow.collections.event.Event,
        List[salvus.flow.collections.event.Event],
    ] = None,
) -> go.FigureWidget:
    ...

Plot the domain.

Parameters
  • events Optional[salvus.flow.collections.event.Event, List[salvus.flow.collections.event.Event]] — Optionally pass events for a domain.
Returns go.FigureWidget
write()
def write(self, filename: pathlib.Path) -> None:
    ...

Write the domain to a file.

Parameters
  • filename pathlib.Path — Filename to write it to.
Returns None

SphericalChunkDomain

class SphericalChunkDomain(salvus.project.domain.dim3.SphericalDomain):
    def __init__(
        self,
        lat_center: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        lat_extent: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        lon_center: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        lon_extent: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        radius_in_meter: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        polygon: Optional[
            salvus.project.domain.spherical_geometry.polygon.SphericalPolygon
        ] = None,
        minimum_radius_in_meter: Optional[float] = None,
        chunk_rotation: Optional[float] = None,
    ) -> None:
        ...

A Domain representing a part of a sphere, possibly masked by a polygon.

Parameters
  • lat_center Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Latitude of the domain center in degrees.
  • lat_extent Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Latitude extent of the domain in degrees.
  • lon_center Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Longitude of the domain center in degrees.
  • lon_extent Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Longitude extent of the domain in degrees.
  • radius_in_meter Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.
  • polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon] — Spherical polygon to further restrict the domain.
  • minimum_radius_in_meter Optional[float] — Minimum radius of the domain.
  • chunk_rotation Optional[float] — Rotate the spherical chunk counterclockwise about a vector that points to its center. Specified in degrees.
Attributes
bounding_box numpy.ndarray

Domain bounding box.

bounds salvus.project.domain.DomainBounds

Get the 3-D domain bounds.

coordinate_system str

Coordinate system of the domain.

dim int

Dimensions of the domain.

polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon]

Polygon restricting the domain.

Methods
from_geojson()
def from_geojson(
    radius_in_meter: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    geojson: Union[pathlib.Path, str, Dict],
) -> SphericalDomain:
    ...

Generate the domain from a polygon specified inside a GeoJSON file.

Parameters
  • radius_in_meter Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Radius of the sphere in meters.
  • geojson Union[pathlib.Path, str, Dict] — The GeoJSON document.
Returns SphericalDomain
from_json_data()
def from_json_data(d: Dict) -> Domain:
    ...

Load the domain from a file.

Parameters
  • d Dict — Dictionary with the JSON data.
Returns Domain
from_material()
def from_material(m: Any) -> Domain:
    ...

Create a new domain from the extents of a material model.

Parameters
  • m Any — The material model.
Returns Domain — Domain: A new domain.
from_spherical_polygon()
def from_spherical_polygon(
    radius_in_meter: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    polygon: salvus.project.domain.spherical_geometry.polygon.SphericalPolygon,
) -> Union[SphericalChunkDomain, SphericalGlobeDomain]:
    ...

Create a domain from a spherical polygon.

Parameters
  • radius_in_meter Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.
  • polygon salvus.project.domain.spherical_geometry.polygon.SphericalPolygon — The spherical polygon.
Returns Union[SphericalChunkDomain, SphericalGlobeDomain]
from_volume_model()
def from_volume_model(
    model: salvus.project.configuration.model.volume._VolumeBase,
) -> Domain:
    ...

Create a new domain from the extents of a volumetric model.

Parameters
  • model salvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.
Returns Domain — A new domain object with the proper extents.
from_xarray()
def from_xarray(
    d: Union[xarray.core.dataset.Dataset, xarray.core.dataarray.DataArray]
) -> Domain:
    ...

Create a new domain from the extents of an xarray object.

Parameters
  • d Union[xarray.core.dataset.Dataset, xarray.core.dataarray.DataArray] — The xarray Dataset or DataArray.
Returns Domain — Domain: A new domain.
load()
def load(filename: pathlib.Path) -> Domain:
    ...

Load the domain from a file.

Parameters
  • filename pathlib.Path — File from which to load.
Returns Domain
dim_enum()
def dim_enum(self) -> salvus.project.components.types.Dim:
    ...

The dimension as a typed enum.

Returns salvus.project.components.types.Dim
estimate_max_travel_distance_in_m()
def estimate_max_travel_distance_in_m(self) -> float:
    ...

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.

Returns float
generate_random_points_in_domain()
def generate_random_points_in_domain(
    self, num_points: Union[int, numpy.int32, numpy.int64]
) -> numpy.ndarray:
    ...

Generate random points in the domain.

Parameters
  • num_points Union[int, numpy.int32, numpy.int64] — Number of points to generate
Returns numpy.ndarray
is_point_inside_domain()
def is_point_inside_domain(
    self,
    latitude: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    longitude: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
) -> bool:
    ...

Check if given point is inside the domain.

Parameters
  • latitude Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — latitude
  • longitude Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — longitude
Returns bool
plot()
def plot(
    self,
    zoom: Optional[int] = None,
    events: Optional[
        salvus.flow.collections.event.Event,
        List[salvus.flow.collections.event.Event],
    ] = None,
    basemap: xyzservices.lib.TileProvider = {
        "url": "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",
        "max_zoom": 17,
        "html_attribution": 'Map data: © a href="https://www.openstreetmap.org/copyright">OpenStreetMap/a> contributors, a href="http://viewfinderpanoramas.org">SRTM/a> | Map style: © 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:
    ...

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.

Parameters
  • zoom Optional[int] — Zoom level to create the map with. If not given, it will zoom to the bounds of the domain.
  • events Optional[salvus.flow.collections.event.Event, List[salvus.flow.collections.event.Event]] — A list of events to plot.
  • basemap xyzservices.lib.TileProvider — The background map.
  • domain_color str — Color of the domain boundary.
  • cluster bool — 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.
Returns ipyleaflet.Map
write()
def write(self, filename: pathlib.Path) -> None:
    ...

Write the domain to a file.

Parameters
  • filename pathlib.Path — Filename to write it to.
Returns None

SphericalDomain

class SphericalDomain(salvus.project.domain.Domain):
    def __init__(
        self,
        radius_in_meter: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        polygon: Optional[
            salvus.project.domain.spherical_geometry.polygon.SphericalPolygon
        ] = None,
        minimum_radius_in_meter: Optional[float] = None,
    ) -> None:
        ...

A base class for domains specified in spherical coordinates.

Parameters
  • radius_in_meter Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.
  • polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon] — Optionally further restrict the domain with a polygon.
  • minimum_radius_in_meter Optional[float] — Minimum radius of the domain.
Attributes
bounding_box numpy.ndarray

Domain bounding box.

bounds salvus.project.domain.DomainBounds

Get the bounds of this domain.

coordinate_system str

Coordinate system of the domain.

dim int

Dimensions of the domain.

polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon]

Polygon restricting the domain.

Methods
from_geojson()
def from_geojson(
    radius_in_meter: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    geojson: Union[pathlib.Path, str, Dict],
) -> SphericalDomain:
    ...

Generate the domain from a polygon specified inside a GeoJSON file.

Parameters
  • radius_in_meter Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Radius of the sphere in meters.
  • geojson Union[pathlib.Path, str, Dict] — The GeoJSON document.
Returns SphericalDomain
from_json_data()
def from_json_data(d: Dict) -> Domain:
    ...

Load the domain from a file.

Parameters
  • d Dict — Dictionary with the JSON data.
Returns Domain
from_material()
def from_material(m: Any) -> Domain:
    ...

Create a new domain from the extents of a material model.

Parameters
  • m Any — The material model.
Returns Domain — Domain: A new domain.
from_spherical_polygon()
def from_spherical_polygon(
    radius_in_meter: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    polygon: salvus.project.domain.spherical_geometry.polygon.SphericalPolygon,
) -> Union[SphericalChunkDomain, SphericalGlobeDomain]:
    ...

Create a domain from a spherical polygon.

Parameters
  • radius_in_meter Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.
  • polygon salvus.project.domain.spherical_geometry.polygon.SphericalPolygon — The spherical polygon.
Returns Union[SphericalChunkDomain, SphericalGlobeDomain]
from_volume_model()
def from_volume_model(
    model: salvus.project.configuration.model.volume._VolumeBase,
) -> Domain:
    ...

Create a new domain from the extents of a volumetric model.

Parameters
  • model salvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.
Returns Domain — A new domain object with the proper extents.
from_xarray()
def from_xarray(
    d: Union[xarray.core.dataset.Dataset, xarray.core.dataarray.DataArray]
) -> Domain:
    ...

Create a new domain from the extents of an xarray object.

Parameters
  • d Union[xarray.core.dataset.Dataset, xarray.core.dataarray.DataArray] — The xarray Dataset or DataArray.
Returns Domain — Domain: A new domain.
load()
def load(filename: pathlib.Path) -> Domain:
    ...

Load the domain from a file.

Parameters
  • filename pathlib.Path — File from which to load.
Returns Domain
dim_enum()
def dim_enum(self) -> salvus.project.components.types.Dim:
    ...

The dimension as a typed enum.

Returns salvus.project.components.types.Dim
estimate_max_travel_distance_in_m()
def estimate_max_travel_distance_in_m(self) -> float:
    ...

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.

Returns float
generate_random_points_in_domain()
def generate_random_points_in_domain(
    self, num_points: Union[int, numpy.int32, numpy.int64]
) -> numpy.ndarray:
    ...

Generate random points in the domain.

Parameters
  • num_points Union[int, numpy.int32, numpy.int64] — Number of points to generate
Returns numpy.ndarray
is_point_inside_domain()
def is_point_inside_domain(self) -> bool:
    ...

Check if the given point is inside the domain.

Argument names of course vary.

Returns bool
plot()
def plot(self) -> None:
    ...

Plot the domain.

Returns None
write()
def write(self, filename: pathlib.Path) -> None:
    ...

Write the domain to a file.

Parameters
  • filename pathlib.Path — Filename to write it to.
Returns None

SphericalGlobeDomain

class SphericalGlobeDomain(salvus.project.domain.dim3.SphericalDomain):
    def __init__(
        self,
        radius_in_meter: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        polygon: Optional[
            salvus.project.domain.spherical_geometry.polygon.SphericalPolygon
        ] = None,
        minimum_radius_in_meter: Optional[float] = None,
    ) -> None:
        ...

A Domain representing a full sphere, possibly masked by a polygon.

Parameters
  • radius_in_meter Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.
  • polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon] — Optionally further restrict the domain.
  • minimum_radius_in_meter Optional[float] — The minimum radius of the domain.
Attributes
bounding_box numpy.ndarray

Domain bounding box.

bounds salvus.project.domain.DomainBounds

Get the 3-D domain bounds.

coordinate_system str

Coordinate system of the domain.

dim int

Dimensions of the domain.

polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon]

Polygon restricting the domain.

Methods
from_geojson()
def from_geojson(
    radius_in_meter: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    geojson: Union[pathlib.Path, str, Dict],
) -> SphericalDomain:
    ...

Generate the domain from a polygon specified inside a GeoJSON file.

Parameters
  • radius_in_meter Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Radius of the sphere in meters.
  • geojson Union[pathlib.Path, str, Dict] — The GeoJSON document.
Returns SphericalDomain
from_json_data()
def from_json_data(d: Dict) -> Domain:
    ...

Load the domain from a file.

Parameters
  • d Dict — Dictionary with the JSON data.
Returns Domain
from_material()
def from_material(m: Any) -> Domain:
    ...

Create a new domain from the extents of a material model.

Parameters
  • m Any — The material model.
Returns Domain — Domain: A new domain.
from_spherical_polygon()
def from_spherical_polygon(
    radius_in_meter: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    polygon: salvus.project.domain.spherical_geometry.polygon.SphericalPolygon,
) -> Union[SphericalChunkDomain, SphericalGlobeDomain]:
    ...

Create a domain from a spherical polygon.

Parameters
  • radius_in_meter Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.
  • polygon salvus.project.domain.spherical_geometry.polygon.SphericalPolygon — The spherical polygon.
Returns Union[SphericalChunkDomain, SphericalGlobeDomain]
from_volume_model()
def from_volume_model(
    model: salvus.project.configuration.model.volume._VolumeBase,
) -> Domain:
    ...

Create a new domain from the extents of a volumetric model.

Parameters
  • model salvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.
Returns Domain — A new domain object with the proper extents.
from_xarray()
def from_xarray(
    d: Union[xarray.core.dataset.Dataset, xarray.core.dataarray.DataArray]
) -> Domain:
    ...

Create a new domain from the extents of an xarray object.

Parameters
  • d Union[xarray.core.dataset.Dataset, xarray.core.dataarray.DataArray] — The xarray Dataset or DataArray.
Returns Domain — Domain: A new domain.
load()
def load(filename: pathlib.Path) -> Domain:
    ...

Load the domain from a file.

Parameters
  • filename pathlib.Path — File from which to load.
Returns Domain
dim_enum()
def dim_enum(self) -> salvus.project.components.types.Dim:
    ...

The dimension as a typed enum.

Returns salvus.project.components.types.Dim
estimate_max_travel_distance_in_m()
def estimate_max_travel_distance_in_m(self) -> float:
    ...

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.

Returns float
generate_random_points_in_domain()
def generate_random_points_in_domain(
    self, num_points: Union[int, numpy.int32, numpy.int64]
) -> numpy.ndarray:
    ...

Generate random points in the domain.

Parameters
  • num_points Union[int, numpy.int32, numpy.int64] — Number of points to generate
Returns numpy.ndarray
is_point_inside_domain()
def is_point_inside_domain(
    self,
    latitude: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    longitude: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
) -> bool:
    ...

A point in spherical coordinates is always within the global domain. A separate check is required if the spherical domain contains a polygon.

Parameters
  • latitude Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Latitude in degrees.
  • longitude Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Longitude in degrees.
Returns bool — True if point is inside domain.
plot()
def plot(self) -> None:
    ...

Plot the domain.

Returns None
write()
def write(self, filename: pathlib.Path) -> None:
    ...

Write the domain to a file.

Parameters
  • filename pathlib.Path — Filename to write it to.
Returns None

UtmDomain

class UtmDomain(salvus.project.domain.dim3.BoxDomain):
    def __init__(
        self,
        x0: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        x1: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        y0: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        y1: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        utm: pyproj.crs.crs.CRS,
    ) -> None:
        ...

A Domain object which represents a UTM zone on Earth.

Construct a UTM domain.

Any of the coordinate axes can by +/- np.infty 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.infty. 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.

Parameters
  • x0 Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum x-coordinate (easting).
  • x1 Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum x-coordinate (easting).
  • y0 Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum y-coordinate (northing).
  • y1 Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum y-coordinate (northing).
  • utm pyproj.crs.crs.CRS — A pyproj.CRS object which represents the coordinate frame of the desired UTM domain.
Attributes
bounding_box numpy.ndarray

Domain bounding box.

bounds salvus.project.domain.DomainBounds

Get the 3-D domain bounds.

coordinate_system str

Coordinate system of the domain.

dim int

Dimensions of the domain.

spherical_bounding_box Tuple[List[float], List[float]]

Get the bounding box of this domain in spherical WGS 84 coordinates.

Returns: A tuple of (lon, lat) values.

utm pyproj.crs.crs.CRS

The projection object defining the domain within the UTM zone.

Methods
from_appeears_request()
def from_appeears_request(
    json_file: Union[pathlib.Path, Dict, str],
    shrink_domain: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ] = 0.0,
) -> UtmDomain:
    ...

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.

Parameters
  • json_file Union[pathlib.Path, Dict, str] — Path to the AppEEARS request JSON, or the json file itself (as a dictionary).
  • shrink_domain Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — 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.
Returns UtmDomain — A constructed UTM domain object.
from_bounds()
def from_bounds(bounds: salvus.project.domain.DomainBounds) -> BoxDomain:
    ...

Construct from a domain bounds object.

Parameters
  • bounds salvus.project.domain.DomainBounds — The domain bounds.
Returns BoxDomain
from_events()
def from_events(
    events: Union[
        salvus.flow.collections.event.Event,
        List[salvus.flow.collections.event.Event],
    ],
    utm: pyproj.crs.crs.CRS,
    buffer_in_meters: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ] = 0.0,
) -> UtmDomain:
    ...

Generate a UTM domain from the surface extent of one or more events.

Parameters
  • events Union[salvus.flow.collections.event.Event, List[salvus.flow.collections.event.Event]] — 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.
  • utm pyproj.crs.crs.CRS — A pyproj.CRS object which represents the coordinate frame of the desired UTM domain.
  • buffer_in_meters Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — 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.
Returns UtmDomain
from_json_data()
def from_json_data(d: Dict) -> Domain:
    ...

Load the domain from a file.

Parameters
  • d Dict — Dictionary with the JSON data.
Returns Domain
from_material()
def from_material(m: Any) -> Domain:
    ...

Create a new domain from the extents of a material model.

Parameters
  • m Any — The material model.
Returns Domain — Domain: A new domain.
from_salvus_xyz()
def from_salvus_xyz(
    model: Union[pathlib.Path, str, xarray.core.dataset.Dataset],
    shrink_domain: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ] = 0.0,
) -> BoxDomain:
    ...

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.

Parameters
  • model Union[pathlib.Path, str, xarray.core.dataset.Dataset] — Model file, either stored in memory (as an xarray.Dataset) or on disk (as a NetCDF file).
  • shrink_domain Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Reduce the size of the domain w.r.t. the size as defined in the Salvus model.
Returns BoxDomain — A constructed 3-D BoxDomain object.
from_spherical_chunk()
def from_spherical_chunk(
    min_latitude: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    max_latitude: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    min_longitude: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    max_longitude: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
) -> UtmDomain:
    ...

Create a UTM domain from geographical latitude/longitude bounds.

Parameters
  • min_latitude Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum domain latitude.
  • max_latitude Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum domain latitude.
  • min_longitude Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum domain longitude.
  • max_longitude Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum domain longitude.
Returns UtmDomain
from_volume_model()
def from_volume_model(
    model: salvus.project.configuration.model.volume._VolumeBase,
) -> Domain:
    ...

Create a new domain from the extents of a volumetric model.

Parameters
  • model salvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.
Returns Domain — A new domain object with the proper extents.
from_xarray()
def from_xarray(
    d: Union[xarray.core.dataset.Dataset, xarray.core.dataarray.DataArray]
) -> Domain:
    ...

Create a new domain from the extents of an xarray object.

Parameters
  • d Union[xarray.core.dataset.Dataset, xarray.core.dataarray.DataArray] — The xarray Dataset or DataArray.
Returns Domain — Domain: A new domain.
load()
def load(filename: pathlib.Path) -> Domain:
    ...

Load the domain from a file.

Parameters
  • filename pathlib.Path — File from which to load.
Returns Domain
dim_enum()
def dim_enum(self) -> salvus.project.components.types.Dim:
    ...

The dimension as a typed enum.

Returns salvus.project.components.types.Dim
download_topography_and_bathymetry()
def download_topography_and_bathymetry(
    self,
    filename: str,
    buffer_in_degrees: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ] = 0.0,
    resolution: str = "default",
) -> None:
    ...

Download topography for the current domain from the https://www.gmrt.org gridservice.

Parameters
  • filename str — Filename to safe to.
  • buffer_in_degrees Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Buffer outside the current domain to account for edge effects when interpolating the topography/bathymetry.
  • resolution str — Resolution for the topography. Possibilities are "low"/"default", "med", "high", and"max'.
Returns None
estimate_max_travel_distance_in_m()
def estimate_max_travel_distance_in_m(self) -> float:
    ...

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.

Returns float
is_point_inside_domain()
def is_point_inside_domain(
    self,
    x: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    y: Union[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ],
    z: Optional[
        int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
    ] = None,
) -> bool:
    ...

Determine whether or not p point is within the box.

Parameters
  • x Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — x-coordinate to test.
  • y Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — y-coordinate to test.
  • z Optional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — z-coordinate to test. If None test will only be done for the x- and y-coordinates. Defaults to None.
Returns bool — True or False whether or not the point is in the box.
plot()
def plot(
    self,
    zoom: Optional[int] = None,
    events: Optional[
        salvus.flow.collections.event.Event,
        List[salvus.flow.collections.event.Event],
    ] = None,
    basemap: xyzservices.lib.TileProvider = {
        "url": "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",
        "max_zoom": 17,
        "html_attribution": 'Map data: © a href="https://www.openstreetmap.org/copyright">OpenStreetMap/a> contributors, a href="http://viewfinderpanoramas.org">SRTM/a> | Map style: © 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:
    ...

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.

Parameters
  • zoom Optional[int] — Zoom level to create the map with. If None, it will zoom to the domain bounds.
  • events Optional[salvus.flow.collections.event.Event, List[salvus.flow.collections.event.Event]] — A list of events to plot.
  • basemap xyzservices.lib.TileProvider — The background map.
  • cluster bool — 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.
Returns ipyleaflet.Map
write()
def write(self, filename: pathlib.Path) -> None:
    ...

Write the domain to a file.

Parameters
  • filename pathlib.Path — Filename to write it to.
Returns None