Version:

salvus.project.domain

salvus.project.domain salvus project domain
Domain definitions for Salvus.

Classes

Domain

The domain base class.
SIGNATURE
class Domain(abc.ABC):
    def __init__(self): ...

Properties

  • bounding_box(np.ndarray)-Domain bounding box.
  • bounds(DomainBounds)-Get the bounds of this domain.
  • coordinate_system(CoordinateSystem)-Get the coordinate system of the domain.
  • dim(int)-Number of dimensions.

Class Methods

Domain.from_json_data()
Load the domain from a file.
SIGNATURE
def from_json_data(d: dict) -> Domain: ...
ARGUMENTS
Required
d
Type:dict
Description:
Dictionary with the JSON data.
Domain.from_material()
Create a new domain from the extents of a material model.
SIGNATURE
def from_material(m: typing.Any) -> Domain: ...
ARGUMENTS
Required
m
Type:typing.Any
Description:
The material model.
Domain.from_volume_model()
Create a new domain from the extents of a volumetric model.
SIGNATURE
def from_volume_model(model: volume._VolumeBase) -> Domain: ...
ARGUMENTS
Required
model
Type:volume._VolumeBase
Description:
The volumetric model from which to create the domain.
Domain.from_xarray()
Create a new domain from the extents of an xarray object.
SIGNATURE
def from_xarray(
    d: xr.Dataset | xr.DataArray,
) -> dim2.BoxDomain | dim3.BoxDomain: ...
ARGUMENTS
Required
d
Type:xr.Dataset | xr.DataArray
Description:
The xarray Dataset or DataArray.
Domain.load()
Load the domain from a file.
SIGNATURE
def load(filename: pathlib.Path) -> Domain: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
File from which to load.

Methods

Domain.dim_enum()
The dimension as a typed enum.
SIGNATURE
def dim_enum(self) -> Dim: ...
Domain.estimate_max_travel_distance_in_m()
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.
SIGNATURE
def estimate_max_travel_distance_in_m(self) -> float: ...
Domain.is_point_inside_domain()
Check if the given point is inside the domain.
Argument names of course vary.
SIGNATURE
def is_point_inside_domain(self) -> bool: ...
Domain.plot()
Plot the domain.
SIGNATURE
def plot(self) -> None: ...
Domain.write()
Write the domain to a file.
SIGNATURE
def write(self, filename: pathlib.Path) -> None: ...
ARGUMENTS
Required
filename
Type:pathlib.Path
Description:
Filename to write it to.

DomainBounds

Small proxy object representing a domain's bounds.
SIGNATURE
class DomainBounds(builtins.object):
    def __init__(
        self,
        hc: dict[str, tuple[float, float]],
        vc: dict[str, tuple[float, float]],
    ) -> None: ...
ARGUMENTS
Required
hc
Type:dict[str, tuple[float, float]]
Description:
The horizontal coordinates ({dim_name: (lower_bound, upper_bound)}).
Required
vc
Type:dict[str, tuple[float, float]]
Description:
The vertical coordinate ({dim_name: (lower_bound, upper_bound)}).

Properties

  • coordinates(list[str])-Get all the coordinate names.
  • da(xr.DataArray)-Get all the bounds as an xarray dataarray.
  • dim(int)-The dimension of the domain.
  • horizontal_bounds_da(xr.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

DomainBounds.as_dict()
Return the bounds as a dictionary.
SIGNATURE
def as_dict(self) -> dict[str, tuple[float, float]]: ...

Submodules

Used in tutorials

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