salvus.project.domain
Various domain definitions for the project.
Classes
Domain
Domainclass Domain(builtins.object):
def __init__(self):
...Initialize self. See help(type(self)) for accurate signature.
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 strThe coordinate system of the domain.
Either "cartesian" or "spherical".
dim int
dim intNumber of dimensions.
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_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.
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.
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.
DomainBounds
DomainBoundsclass 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.
hcDict[str, Tuple[float, float]] — The horizontal coordinates ({dim_name: (lower_bound, upper_bound)}).vcDict[str, Tuple[float, float]] — The vertical coordinate ({dim_name: (lower_bound, upper_bound)}).
coordinates List[str]
coordinates List[str]Get all the coordinate names.
da xarray.core.dataarray.DataArray
da xarray.core.dataarray.DataArrayGet all the bounds as an xarray dataarray.
dim int
dim intThe dimension of the domain.
horizontal_bounds_crd Union[Tuple[salvus.project.components.types.CartesianCoordinate, ...], Tuple[salvus.project.components.types.CartesianCoordinatePair, ...]]
horizontal_bounds_crd Union[Tuple[salvus.project.components.types.CartesianCoordinate, ...], Tuple[salvus.project.components.types.CartesianCoordinatePair, ...]]The domain bounds as coordinate objects.
horizontal_bounds_da xarray.core.dataarray.DataArray
horizontal_bounds_da xarray.core.dataarray.DataArrayGet the horizontal bounds as an xarray DataArray.
horizontal_coordinates List[str]
horizontal_coordinates List[str]Get the horizontal coordinate names.
sorted_bounds List[Tuple[float, float]]
sorted_bounds List[Tuple[float, float]]A list of domain bounds sorted by their coordinate name.
vertical_bounds Tuple[float, float]
vertical_bounds Tuple[float, float]Get the bounds of the vertical coordinate.
vertical_coordinate str
vertical_coordinate strGet the vertical coordinate name.