salvus.project.domain.dim3
3-D cartesian and spherical domains.
Classes
BoxDomain
BoxDomainclass 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.
x0Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum x-coordinate.x1Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum x-coordinate.y0Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum y-coordinate.y1Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum y-coordinate.z0Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum z-coordinate.z1Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum z-coordinate.
bounding_box numpy.ndarray
bounding_box numpy.ndarrayDomain bounding box.
bounds salvus.project.domain.DomainBounds
bounds salvus.project.domain.DomainBoundsGet the 3-D domain bounds.
coordinate_system str
coordinate_system strCoordinate system of the domain.
dim int
dim intDimensions of the domain.
from_bounds()
from_bounds()def from_bounds(bounds: salvus.project.domain.DomainBounds) -> BoxDomain:
...Construct from a domain bounds object.
boundssalvus.project.domain.DomainBounds — The domain bounds.
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: Any) -> Domain:
...Create a new domain from the extents of a material model.
mAny — The material model.
from_salvus_xyz()
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.
modelUnion[pathlib.Path, str, xarray.core.dataset.Dataset] — Model file, either stored in memory (as anxarray.Dataset) or on disk (as a NetCDF file).shrink_domainUnion[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.
from_volume_model()
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.
modelsalvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.
from_xarray()
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.
dUnion[xarray.core.dataset.Dataset, xarray.core.dataarray.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) -> salvus.project.components.types.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: 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.
xUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — x-coordinate to test.yUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — y-coordinate to test.zOptional[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.
plot()
plot()def plot(
self,
events: Optional[
salvus.flow.collections.event.Event,
List[salvus.flow.collections.event.Event],
] = None,
) -> go.FigureWidget:
...Plot the domain.
eventsOptional[salvus.flow.collections.event.Event, List[salvus.flow.collections.event.Event]] — 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: 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.
lat_centerUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Latitude of the domain center in degrees.lat_extentUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Latitude extent of the domain in degrees.lon_centerUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Longitude of the domain center in degrees.lon_extentUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Longitude extent of the domain in degrees.radius_in_meterUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.polygonOptional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon] — Spherical polygon to further restrict the domain.minimum_radius_in_meterOptional[float] — Minimum radius of the domain.chunk_rotationOptional[float] — Rotate the spherical chunk counterclockwise about a vector that points to its center. Specified in degrees.
bounding_box numpy.ndarray
bounding_box numpy.ndarrayDomain bounding box.
bounds salvus.project.domain.DomainBounds
bounds salvus.project.domain.DomainBoundsGet the 3-D domain bounds.
coordinate_system str
coordinate_system strCoordinate system of the domain.
dim int
dim intDimensions of the domain.
polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon]
polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon]Polygon restricting the domain.
from_geojson()
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.
radius_in_meterUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Radius of the sphere in meters.geojsonUnion[pathlib.Path, 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: Any) -> Domain:
...Create a new domain from the extents of a material model.
mAny — The material model.
from_spherical_polygon()
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.
radius_in_meterUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.polygonsalvus.project.domain.spherical_geometry.polygon.SphericalPolygon — The spherical polygon.
from_volume_model()
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.
modelsalvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.
from_xarray()
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.
dUnion[xarray.core.dataset.Dataset, xarray.core.dataarray.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) -> salvus.project.components.types.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: Union[int, numpy.int32, numpy.int64]
) -> numpy.ndarray:
...Generate random points in the domain.
num_pointsUnion[int, numpy.int32, numpy.int64] — Number of points to generate
is_point_inside_domain()
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.
latitudeUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — latitudelongitudeUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — longitude
plot()
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.
zoomOptional[int] — Zoom level to create the map with. If not given, it will zoom to the bounds of the domain.eventsOptional[salvus.flow.collections.event.Event, List[salvus.flow.collections.event.Event]] — 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: 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.
radius_in_meterUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.polygonOptional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon] — Optionally further restrict the domain with a polygon.minimum_radius_in_meterOptional[float] — Minimum radius of the domain.
bounding_box numpy.ndarray
bounding_box numpy.ndarrayDomain bounding box.
bounds salvus.project.domain.DomainBounds
bounds salvus.project.domain.DomainBoundsGet the bounds of this domain.
coordinate_system str
coordinate_system strCoordinate system of the domain.
dim int
dim intDimensions of the domain.
polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon]
polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon]Polygon restricting the domain.
from_geojson()
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.
radius_in_meterUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Radius of the sphere in meters.geojsonUnion[pathlib.Path, 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: Any) -> Domain:
...Create a new domain from the extents of a material model.
mAny — The material model.
from_spherical_polygon()
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.
radius_in_meterUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.polygonsalvus.project.domain.spherical_geometry.polygon.SphericalPolygon — The spherical polygon.
from_volume_model()
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.
modelsalvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.
from_xarray()
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.
dUnion[xarray.core.dataset.Dataset, xarray.core.dataarray.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) -> salvus.project.components.types.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: Union[int, numpy.int32, numpy.int64]
) -> numpy.ndarray:
...Generate random points in the domain.
num_pointsUnion[int, numpy.int32, numpy.int64] — 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: 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.
radius_in_meterUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.polygonOptional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon] — Optionally further restrict the domain.minimum_radius_in_meterOptional[float] — The minimum radius of the domain.
bounding_box numpy.ndarray
bounding_box numpy.ndarrayDomain bounding box.
bounds salvus.project.domain.DomainBounds
bounds salvus.project.domain.DomainBoundsGet the 3-D domain bounds.
coordinate_system str
coordinate_system strCoordinate system of the domain.
dim int
dim intDimensions of the domain.
polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon]
polygon Optional[salvus.project.domain.spherical_geometry.polygon.SphericalPolygon]Polygon restricting the domain.
from_geojson()
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.
radius_in_meterUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Radius of the sphere in meters.geojsonUnion[pathlib.Path, 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: Any) -> Domain:
...Create a new domain from the extents of a material model.
mAny — The material model.
from_spherical_polygon()
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.
radius_in_meterUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Planet radius.polygonsalvus.project.domain.spherical_geometry.polygon.SphericalPolygon — The spherical polygon.
from_volume_model()
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.
modelsalvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.
from_xarray()
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.
dUnion[xarray.core.dataset.Dataset, xarray.core.dataarray.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) -> salvus.project.components.types.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: Union[int, numpy.int32, numpy.int64]
) -> numpy.ndarray:
...Generate random points in the domain.
num_pointsUnion[int, numpy.int32, numpy.int64] — Number of points to generate
is_point_inside_domain()
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.
latitudeUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Latitude in degrees.longitudeUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — 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: 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.
x0Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum x-coordinate (easting).x1Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum x-coordinate (easting).y0Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum y-coordinate (northing).y1Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum y-coordinate (northing).utmpyproj.crs.crs.CRS — Apyproj.CRSobject which represents the coordinate frame of the desired UTM domain.
bounding_box numpy.ndarray
bounding_box numpy.ndarrayDomain bounding box.
bounds salvus.project.domain.DomainBounds
bounds salvus.project.domain.DomainBoundsGet the 3-D domain bounds.
coordinate_system str
coordinate_system strCoordinate system of the domain.
dim int
dim intDimensions of the domain.
spherical_bounding_box Tuple[List[float], List[float]]
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
utm pyproj.crs.crs.CRSThe projection object defining the domain within the UTM zone.
from_appeears_request()
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.
json_fileUnion[pathlib.Path, Dict, str] — Path to the AppEEARS request JSON, or the json file itself (as a dictionary).shrink_domainUnion[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.
from_bounds()
from_bounds()def from_bounds(bounds: salvus.project.domain.DomainBounds) -> BoxDomain:
...Construct from a domain bounds object.
boundssalvus.project.domain.DomainBounds — The domain bounds.
from_events()
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.
eventsUnion[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.utmpyproj.crs.crs.CRS — Apyproj.CRSobject which represents the coordinate frame of the desired UTM domain.buffer_in_metersUnion[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.
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: Any) -> Domain:
...Create a new domain from the extents of a material model.
mAny — The material model.
from_salvus_xyz()
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.
modelUnion[pathlib.Path, str, xarray.core.dataset.Dataset] — Model file, either stored in memory (as anxarray.Dataset) or on disk (as a NetCDF file).shrink_domainUnion[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.
from_spherical_chunk()
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.
min_latitudeUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum domain latitude.max_latitudeUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum domain latitude.min_longitudeUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Minimum domain longitude.max_longitudeUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Maximum domain longitude.
from_volume_model()
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.
modelsalvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.
from_xarray()
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.
dUnion[xarray.core.dataset.Dataset, xarray.core.dataarray.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) -> salvus.project.components.types.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: 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.
filenamestr — Filename to safe to.buffer_in_degreesUnion[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.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: 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.
xUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — x-coordinate to test.yUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — y-coordinate to test.zOptional[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.
plot()
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.
zoomOptional[int] — Zoom level to create the map with. If None, it will zoom to the domain bounds.eventsOptional[salvus.flow.collections.event.Event, List[salvus.flow.collections.event.Event]] — 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.