salvus.project.domain.dim3
salvus.project.domain.dim3 salvus project domain dim3 3-D cartesian and spherical domains.
Classes
BoxDomain
BoxDomainclass 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: ...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.
x0salvus._core.types.float_ — Minimum x-coordinate.x1salvus._core.types.float_ — Maximum x-coordinate.y0salvus._core.types.float_ — Minimum y-coordinate.y1salvus._core.types.float_ — Maximum y-coordinate.z0salvus._core.types.float_ — Minimum z-coordinate.z1salvus._core.types.float_ — Maximum z-coordinate.
bounding_box np.ndarray
bounding_box np.ndarrayDomain bounding box.
bounds DomainBounds
bounds DomainBoundsGet the 3-D domain bounds.
coordinate_system CoordinateSystem
coordinate_system CoordinateSystemCoordinate system of the domain.
dim int
dim intDimensions of the domain.
from_bounds()
from_bounds()def from_bounds() -> BoxDomain: ...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),
)from_json_data()
from_json_data()def from_json_data(d: dict) -> Domain: ...Load the domain from a file.
ddict — Dictionary with the JSON data.
from_material()
from_material()def from_material(m: typing.Any) -> Domain: ...Create a new domain from the extents of a material model.
mtyping.Any — The material model.
from_salvus_xyz()
from_salvus_xyz()def from_salvus_xyz(
model: Path | str | xr.Dataset,
shrink_domain: salvus._core.types.float_ = 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.
modelPath | str | xr.Dataset — Model file, either stored in memory (as anxarray.Dataset) or on disk (as a NetCDF file).shrink_domainsalvus._core.types.float_ — Reduce the size of the domain w.r.t. the size as defined in the Salvus model.
from_volume_model()
from_volume_model()def from_volume_model(model: volume._VolumeBase) -> Domain: ...Create a new domain from the extents of a volumetric model.
modelvolume._VolumeBase — The volumetric model from which to create the domain.
from_xarray()
from_xarray()def from_xarray(
d: xr.Dataset | xr.DataArray,
) -> dim2.BoxDomain | dim3.BoxDomain: ...Create a new domain from the extents of an xarray object.
dxr.Dataset | xr.DataArray — The xarray Dataset or DataArray.
load()
load()def load(filename: pathlib.Path) -> Domain: ...Load the domain from a file.
filenamepathlib.Path — File from which to load.
unit()
unit()def unit() -> BoxDomain: ...Construct a 3D unit domain on [0, 1] x [0, 1] x [0, 1].
dim_enum()
dim_enum()def dim_enum(self) -> Dim: ...The dimension as a typed enum.
estimate_max_travel_distance_in_m()
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.
is_point_inside_domain()
is_point_inside_domain()def is_point_inside_domain(
self,
x: salvus._core.types.float_,
y: salvus._core.types.float_,
z: salvus._core.types.float_ | None = None,
) -> bool: ...Determine whether or not p point is within the box.
xsalvus._core.types.float_ — x-coordinate to test.ysalvus._core.types.float_ — y-coordinate to test.zsalvus._core.types.float_ | None — z-coordinate to test. If None test will only be done for the x- and y-coordinates. Defaults to None.
plot()
plot()def plot(
self, events: Event | list[Event] | None = None
) -> go.FigureWidget: ...Plot the domain.
eventsEvent | list[Event] | None — Optionally pass events for a domain.
write()
write()def write(self, filename: pathlib.Path) -> None: ...Write the domain to a file.
filenamepathlib.Path — Filename to write it to.
SphericalChunkDomain
SphericalChunkDomainclass 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: ...A Domain representing a part of a sphere, possibly masked by a polygon.
lat_centersalvus._core.types.float_ — Latitude (in geocentric coordinates) of the domain center in degrees.lat_extentsalvus._core.types.float_ — Latitude extent (in geocentric coordinates) of the domain in degrees.lon_centersalvus._core.types.float_ — Longitude of the domain center in degrees.lon_extentsalvus._core.types.float_ — Longitude extent of the domain in degrees.radius_in_metersalvus._core.types.float_ — Planet radius.polygonSphericalPolygon | None — Spherical polygon to further restrict the domain.minimum_radius_in_meterfloat | None — Minimum radius of the domain.chunk_rotationfloat | None — Rotate the spherical chunk counterclockwise about a vector that points to its center. Specified in degrees.
bounding_box np.ndarray
bounding_box np.ndarrayDomain bounding box.
bounds DomainBounds
bounds DomainBoundsGet the 3-D domain bounds.
coordinate_system CoordinateSystem
coordinate_system CoordinateSystemCoordinate system of the domain.
dim int
dim intDimensions of the domain.
polygon SphericalPolygon | None
polygon SphericalPolygon | NonePolygon restricting the domain.
from_geojson()
from_geojson()def from_geojson(
radius_in_meter: salvus._core.types.float_, geojson: Path | str | dict
) -> SphericalDomain: ...Generate the domain from a polygon specified inside a GeoJSON file.
radius_in_metersalvus._core.types.float_ — Radius of the sphere in meters.geojsonPath | str | dict — The GeoJSON document.
from_json_data()
from_json_data()def from_json_data(d: dict) -> Domain: ...Load the domain from a file.
ddict — Dictionary with the JSON data.
from_material()
from_material()def from_material(m: typing.Any) -> Domain: ...Create a new domain from the extents of a material model.
mtyping.Any — The material model.
from_spherical_polygon()
from_spherical_polygon()def from_spherical_polygon(
radius_in_meter: salvus._core.types.float_, polygon: SphericalPolygon
) -> SphericalChunkDomain | SphericalGlobeDomain: ...Create a domain from a spherical polygon.
radius_in_metersalvus._core.types.float_ — Planet radius.polygonSphericalPolygon — The spherical polygon.
from_volume_model()
from_volume_model()def from_volume_model(model: volume._VolumeBase) -> Domain: ...Create a new domain from the extents of a volumetric model.
modelvolume._VolumeBase — The volumetric model from which to create the domain.
from_xarray()
from_xarray()def from_xarray(
d: xr.Dataset | xr.DataArray,
) -> dim2.BoxDomain | dim3.BoxDomain: ...Create a new domain from the extents of an xarray object.
dxr.Dataset | xr.DataArray — The xarray Dataset or DataArray.
load()
load()def load(filename: pathlib.Path) -> Domain: ...Load the domain from a file.
filenamepathlib.Path — File from which to load.
dim_enum()
dim_enum()def dim_enum(self) -> Dim: ...The dimension as a typed enum.
estimate_max_travel_distance_in_m()
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.
generate_random_points_in_domain()
generate_random_points_in_domain()def generate_random_points_in_domain(
self, num_points: salvus._core.types.int_
) -> np.ndarray: ...Generate random points in the domain.
num_pointssalvus._core.types.int_ — Number of points to generate
is_point_inside_domain()
is_point_inside_domain()def is_point_inside_domain(
self,
latitude: salvus._core.types.float_,
longitude: salvus._core.types.float_,
) -> bool: ...Check if given point is inside the domain.
latitudesalvus._core.types.float_ — latitudelongitudesalvus._core.types.float_ — longitude
plot()
plot()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: © <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.
zoomint | None — Zoom level to create the map with. If not given, it will zoom to the bounds of the domain.eventsEvent | list[Event] | None — A list of events to plot.basemapxyzservices.lib.TileProvider — The background map.domain_colorstr — Color of the domain boundary.clusterbool — 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.
write()
write()def write(self, filename: pathlib.Path) -> None: ...Write the domain to a file.
filenamepathlib.Path — Filename to write it to.
SphericalDomain
SphericalDomainclass 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: ...A base class for domains specified in spherical coordinates.
radius_in_metersalvus._core.types.float_ — Planet radius.polygonSphericalPolygon | None — Optionally further restrict the domain with a polygon.minimum_radius_in_meterfloat | None — Minimum radius of the domain.
bounding_box np.ndarray
bounding_box np.ndarrayDomain bounding box.
bounds DomainBounds
bounds DomainBoundsGet the bounds of this domain.
coordinate_system CoordinateSystem
coordinate_system CoordinateSystemCoordinate system of the domain.
dim int
dim intDimensions of the domain.
polygon SphericalPolygon | None
polygon SphericalPolygon | NonePolygon restricting the domain.
from_geojson()
from_geojson()def from_geojson(
radius_in_meter: salvus._core.types.float_, geojson: Path | str | dict
) -> SphericalDomain: ...Generate the domain from a polygon specified inside a GeoJSON file.
radius_in_metersalvus._core.types.float_ — Radius of the sphere in meters.geojsonPath | str | dict — The GeoJSON document.
from_json_data()
from_json_data()def from_json_data(d: dict) -> Domain: ...Load the domain from a file.
ddict — Dictionary with the JSON data.
from_material()
from_material()def from_material(m: typing.Any) -> Domain: ...Create a new domain from the extents of a material model.
mtyping.Any — The material model.
from_spherical_polygon()
from_spherical_polygon()def from_spherical_polygon(
radius_in_meter: salvus._core.types.float_, polygon: SphericalPolygon
) -> SphericalChunkDomain | SphericalGlobeDomain: ...Create a domain from a spherical polygon.
radius_in_metersalvus._core.types.float_ — Planet radius.polygonSphericalPolygon — The spherical polygon.
from_volume_model()
from_volume_model()def from_volume_model(model: volume._VolumeBase) -> Domain: ...Create a new domain from the extents of a volumetric model.
modelvolume._VolumeBase — The volumetric model from which to create the domain.
from_xarray()
from_xarray()def from_xarray(
d: xr.Dataset | xr.DataArray,
) -> dim2.BoxDomain | dim3.BoxDomain: ...Create a new domain from the extents of an xarray object.
dxr.Dataset | xr.DataArray — The xarray Dataset or DataArray.
load()
load()def load(filename: pathlib.Path) -> Domain: ...Load the domain from a file.
filenamepathlib.Path — File from which to load.
dim_enum()
dim_enum()def dim_enum(self) -> Dim: ...The dimension as a typed enum.
estimate_max_travel_distance_in_m()
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.
generate_random_points_in_domain()
generate_random_points_in_domain()def generate_random_points_in_domain(
self, num_points: salvus._core.types.int_
) -> np.ndarray: ...Generate random points in the domain.
num_pointssalvus._core.types.int_ — Number of points to generate
is_point_inside_domain()
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.
plot()
plot()def plot(self) -> None: ...Plot the domain.
write()
write()def write(self, filename: pathlib.Path) -> None: ...Write the domain to a file.
filenamepathlib.Path — Filename to write it to.
SphericalGlobeDomain
SphericalGlobeDomainclass 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: ...A Domain representing a full sphere, possibly masked by a polygon.
radius_in_metersalvus._core.types.float_ — Planet radius.polygonSphericalPolygon | None — Optionally further restrict the domain.minimum_radius_in_meterfloat | None — The minimum radius of the domain.
bounding_box np.ndarray
bounding_box np.ndarrayDomain bounding box.
bounds DomainBounds
bounds DomainBoundsGet the 3-D domain bounds.
coordinate_system CoordinateSystem
coordinate_system CoordinateSystemCoordinate system of the domain.
dim int
dim intDimensions of the domain.
polygon SphericalPolygon | None
polygon SphericalPolygon | NonePolygon restricting the domain.
from_geojson()
from_geojson()def from_geojson(
radius_in_meter: salvus._core.types.float_, geojson: Path | str | dict
) -> SphericalDomain: ...Generate the domain from a polygon specified inside a GeoJSON file.
radius_in_metersalvus._core.types.float_ — Radius of the sphere in meters.geojsonPath | str | dict — The GeoJSON document.
from_json_data()
from_json_data()def from_json_data(d: dict) -> Domain: ...Load the domain from a file.
ddict — Dictionary with the JSON data.
from_material()
from_material()def from_material(m: typing.Any) -> Domain: ...Create a new domain from the extents of a material model.
mtyping.Any — The material model.
from_spherical_polygon()
from_spherical_polygon()def from_spherical_polygon(
radius_in_meter: salvus._core.types.float_, polygon: SphericalPolygon
) -> SphericalChunkDomain | SphericalGlobeDomain: ...Create a domain from a spherical polygon.
radius_in_metersalvus._core.types.float_ — Planet radius.polygonSphericalPolygon — The spherical polygon.
from_volume_model()
from_volume_model()def from_volume_model(model: volume._VolumeBase) -> Domain: ...Create a new domain from the extents of a volumetric model.
modelvolume._VolumeBase — The volumetric model from which to create the domain.
from_xarray()
from_xarray()def from_xarray(
d: xr.Dataset | xr.DataArray,
) -> dim2.BoxDomain | dim3.BoxDomain: ...Create a new domain from the extents of an xarray object.
dxr.Dataset | xr.DataArray — The xarray Dataset or DataArray.
load()
load()def load(filename: pathlib.Path) -> Domain: ...Load the domain from a file.
filenamepathlib.Path — File from which to load.
dim_enum()
dim_enum()def dim_enum(self) -> Dim: ...The dimension as a typed enum.
estimate_max_travel_distance_in_m()
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.
generate_random_points_in_domain()
generate_random_points_in_domain()def generate_random_points_in_domain(
self, num_points: salvus._core.types.int_
) -> np.ndarray: ...Generate random points in the domain.
num_pointssalvus._core.types.int_ — Number of points to generate
is_point_inside_domain()
is_point_inside_domain()def is_point_inside_domain(
self,
latitude: salvus._core.types.float_,
longitude: salvus._core.types.float_,
) -> bool: ...A point in spherical coordinates is always within the global domain. A separate check is required if the spherical domain contains a polygon.
latitudesalvus._core.types.float_ — Latitude in degrees.longitudesalvus._core.types.float_ — Longitude in degrees.
plot()
plot()def plot(self) -> None: ...Plot the domain.
write()
write()def write(self, filename: pathlib.Path) -> None: ...Write the domain to a file.
filenamepathlib.Path — Filename to write it to.
UtmDomain
UtmDomainclass 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: ...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.
x0salvus._core.types.float_ — Minimum x-coordinate (easting).x1salvus._core.types.float_ — Maximum x-coordinate (easting).y0salvus._core.types.float_ — Minimum y-coordinate (northing).y1salvus._core.types.float_ — Maximum y-coordinate (northing).utmpyproj.CRS — Apyproj.CRSobject which represents the coordinate frame of the desired UTM domain.
bounding_box np.ndarray
bounding_box np.ndarrayDomain bounding box.
bounds DomainBounds
bounds DomainBoundsGet the 3-D domain bounds.
coordinate_system CoordinateSystem
coordinate_system CoordinateSystemCoordinate system of the domain.
dim int
dim intDimensions of the domain.
spherical_bounding_box tuple[npt.NDArray, npt.NDArray]
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
utm pyproj.CRSThe projection object defining the domain within the UTM zone.
from_appeears_request()
from_appeears_request()def from_appeears_request(
json_file: Path | dict | str,
shrink_domain: salvus._core.types.float_ = 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.
json_filePath | dict | str — Path to the AppEEARS request JSON, or the json file itself (as a dictionary).shrink_domainsalvus._core.types.float_ — 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.
from_bounds()
from_bounds()def from_bounds() -> BoxDomain: ...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),
)from_events()
from_events()def from_events(
events: Event | list[Event],
utm: pyproj.CRS,
buffer_in_meters: salvus._core.types.float_ = 0.0,
) -> UtmDomain: ...Generate a UTM domain from the surface extent of one or more events.
eventsEvent | list[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.utmpyproj.CRS — Apyproj.CRSobject which represents the coordinate frame of the desired UTM domain.buffer_in_meterssalvus._core.types.float_ — 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.
from_json_data()
from_json_data()def from_json_data(d: dict) -> Domain: ...Load the domain from a file.
ddict — Dictionary with the JSON data.
from_material()
from_material()def from_material(m: typing.Any) -> Domain: ...Create a new domain from the extents of a material model.
mtyping.Any — The material model.
from_salvus_xyz()
from_salvus_xyz()def from_salvus_xyz(
model: Path | str | xr.Dataset,
shrink_domain: salvus._core.types.float_ = 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.
modelPath | str | xr.Dataset — Model file, either stored in memory (as anxarray.Dataset) or on disk (as a NetCDF file).shrink_domainsalvus._core.types.float_ — Reduce the size of the domain w.r.t. the size as defined in the Salvus model.
from_spherical_chunk()
from_spherical_chunk()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: ...Create a UTM domain from geographical latitude/longitude bounds.
min_latitudesalvus._core.types.float_ — Minimum domain latitude in WGS84.max_latitudesalvus._core.types.float_ — Maximum domain latitude in WGS84.min_longitudesalvus._core.types.float_ — Minimum domain longitude in WGS84.max_longitudesalvus._core.types.float_ — Maximum domain longitude in WGS84.
from_volume_model()
from_volume_model()def from_volume_model(model: volume._VolumeBase) -> Domain: ...Create a new domain from the extents of a volumetric model.
modelvolume._VolumeBase — The volumetric model from which to create the domain.
from_xarray()
from_xarray()def from_xarray(
d: xr.Dataset | xr.DataArray,
) -> dim2.BoxDomain | dim3.BoxDomain: ...Create a new domain from the extents of an xarray object.
dxr.Dataset | xr.DataArray — The xarray Dataset or DataArray.
load()
load()def load(filename: pathlib.Path) -> Domain: ...Load the domain from a file.
filenamepathlib.Path — File from which to load.
unit()
unit()def unit() -> BoxDomain: ...Construct a 3D unit domain on [0, 1] x [0, 1] x [0, 1].
dim_enum()
dim_enum()def dim_enum(self) -> Dim: ...The dimension as a typed enum.
download_topography_and_bathymetry()
download_topography_and_bathymetry()def download_topography_and_bathymetry(
self,
filename: str,
buffer_in_degrees: salvus._core.types.float_ = 0.0,
resolution: str = "default",
) -> None: ...Download topography for the current domain from the https://www.gmrt.org gridservice.
filenamestr — Filename to safe to.buffer_in_degreessalvus._core.types.float_ — Buffer outside the current domain to account for edge effects when interpolating the topography/bathymetry.resolutionstr — Resolution for the topography. Possibilities are"low"/"default","med","high", and"max'.
estimate_max_travel_distance_in_m()
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.
is_point_inside_domain()
is_point_inside_domain()def is_point_inside_domain(
self,
x: salvus._core.types.float_,
y: salvus._core.types.float_,
z: salvus._core.types.float_ | None = None,
) -> bool: ...Determine whether or not p point is within the box.
xsalvus._core.types.float_ — x-coordinate to test.ysalvus._core.types.float_ — y-coordinate to test.zsalvus._core.types.float_ | None — z-coordinate to test. If None test will only be done for the x- and y-coordinates. Defaults to None.
plot()
plot()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: © <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.
zoomint | None — Zoom level to create the map with. If None, it will zoom to the domain bounds.eventsEvent | list[Event] | None — A list of events to plot.basemapxyzservices.lib.TileProvider — The background map.clusterbool — 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.
write()
write()def write(self, filename: pathlib.Path) -> None: ...Write the domain to a file.
filenamepathlib.Path — Filename to write it to.
Used in tutorials
- Continental Scale FWI Tutorial - Part 1: Project Setup & Data Acquisition
- Continental-scale Simulations
- Creating and plotting custom gathers from Salvus' receiver outputs
- How to combine (fuse) measured and simulated data in Salvus
- Layered Meshing 01: Basics
- Layered Meshing 03: Meshing complex geophysical domains
- Materials 1: Introduction to materials
- Materials 4: Simulating with Materials and Exotic Waveforms from Anisotropy
- Mesh-to-mesh interpolation
- Meshing cylindrical domains
- Seismological Gradients in Salvus*Project*
- Simulating ultrasound inspection data with the W-Scan instrument library
- Surface topography
- Working with Salvus' wavefield output files
- Working with variable models and extracting slices