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

salvus.project.domain

Various domain definitions for the project.

Classes

Domain

class Domain(builtins.object):
    def __init__(self): ...

Initialize self. See help(type(self)) for accurate signature.

Attributes
bounding_box numpy.ndarray

Domain bounding box.

bounds salvus.project.domain.DomainBounds

Get the bounds of this domain.

coordinate_system salvus.geometry.coordinates.coordinates.CoordinateSystem

Get the coordinate system of the domain.

dim int

Number of dimensions.

Methods
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_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.

What exactly is returned differs per domain type. For cartesian domains it will return the the distance between two opposing corners, for spherical domains the distance between two opposing corners on the surface.

In many cases the returned value is the distance surface waves have to travel to cross the domain which in turn is useful to gauge the necessary duration of simulations.

Returns float
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

DomainBounds

class DomainBounds(builtins.object):
    def __init__(
        self,
        hc: Dict[str, Tuple[float, float]],
        vc: Dict[str, Tuple[float, float]],
    ) -> None: ...

Small proxy object representing a domain’s bounds.

Parameters
  • hc Dict[str, Tuple[float, float]] — The horizontal coordinates ({dim_name: (lower_bound, upper_bound)}).
  • vc Dict[str, Tuple[float, float]] — The vertical coordinate ({dim_name: (lower_bound, upper_bound)}).
Attributes
coordinates List[str]

Get all the coordinate names.

da xarray.core.dataarray.DataArray

Get all the bounds as an xarray dataarray.

dim int

The dimension of the domain.

horizontal_bounds_da xarray.core.dataarray.DataArray

Get the horizontal bounds as an xarray DataArray.

horizontal_coordinates List[str]

Get the horizontal coordinate names.

sorted_bounds List[Tuple[float, float]]

A list of domain bounds sorted by their coordinate name.

vertical_bounds Tuple[float, float]

Get the bounds of the vertical coordinate.

vertical_coordinate str

Get the vertical coordinate name.

Methods
as_dict()
def as_dict(self) -> Dict[str, Tuple[float, float]]: ...

Return the bounds as a dictionary.

Returns Dict[str, Tuple[float, float]]

Submodules