salvus.project.configuration.model.volume.seismology
Classes
CrustalModel
CrustalModelclass CrustalModel(
salvus.project.configuration.model.volume.seismology._SeismologyBase
):
def __init__(
self,
name: str,
data: Union[pathlib.Path, str, xarray.core.dataset.Dataset],
parameters: Optional[List[str]] = None,
taper_in_degrees: Optional[float] = None,
use_nan_mask_for_taper: Optional[str] = None,
use_symlink: bool = False,
):
...A crustal model.
namestr — Name of the model.dataUnion[pathlib.Path, str, xarray.core.dataset.Dataset] — The actual data values.parametersOptional[List[str]] — Only interpolate these parameters from the model.taper_in_degreesOptional[float] — How many degrees to use to taper into the background model.use_nan_mask_for_taperOptional[str] — Use a NaN mask for the taper.use_symlinkbool — Don’t copy the data to the project but only use a symlink. Only works if the data is passed as a filename or path.
dim int
dim intDimensions of the model.
ds xarray.core.dataset.Dataset
ds xarray.core.dataset.DatasetThe actual dataset representing the model.
interpolation_mode str
interpolation_mode strInterpolation mode.
name str
name strModel name.
restrict_to_layers Optional[int, List[int], str]
restrict_to_layers Optional[int, List[int], str]Layers to restrict to.
from_json()
from_json()def from_json(parent_folder: pathlib.Path, d: Dict) -> _ModelBase:
...Recreate the object from a dictionary serialization of its initialization parameters.
parent_folderpathlib.Path — Path to which the serialized model is relative to.dDict — Dictionary containing its init parameters and a few other things.
to_generic_model_cartesian()
to_generic_model_cartesian()def to_generic_model_cartesian(
self,
utm: Union[pyproj.crs.crs.CRS, str],
ellipsoid: Union[pyproj.crs.crs.CRS, str],
radius_in_meters: float = 6371000.0,
points: Union[
Tuple[int, int, int],
Tuple[
salvus.project.domain.dim3.UtmDomain, int, int, Tuple[float, int]
],
],
method: str = "nearest",
extrapolate: bool = True,
) -> salvus.project.configuration.model.volume.cartesian.GenericModel:
...Convert a seismological model to a cartesian one.
Sometimes the model we work with are parameterized in spherical
coordinates, but we would like to work on UTM domains. This function
returns a Cartesian model which can then be used in a UTM context.
This model is re-sampled onto a regular grid in Cartesian coordinates
with, by default, the same extent as the original model in UTM
coordinates. This behavior can be changed by additionally passing a
UtmDomain object (see the documentation for points below).
If a model is passed with datasets suffixed with _nan, this routine
will interpret the NANs in the model as defining transparent regions.
Such a detection will automatically set extrapolate to False, and
only the masked version of the parameter arrays will be present in
the returned Cartesian model.
utmUnion[pyproj.crs.crs.CRS, str] — ApyprojCRS object describing the UTM domain to cast to.ellipsoidUnion[pyproj.crs.crs.CRS, str] — ApyprojCRS object describing the ellipsoid that the model is currently parameterized with respect to.radius_in_metersfloat — The vertical units of the model are re-parameterized to depth. This radius is treated as depth 0.pointsUnion[Tuple[int, int, int], Tuple[salvus.project.domain.dim3.UtmDomain, int, int, Tuple[float, int]]] — A tuple of either: - A 3-tuple containing the number of grid point to use for the resampling in each dimension (nx, ny, nz). In this case the model extent will be the same as that defined by the spherical model. This may not be very appropriate if the model is, for instance, a global model. - A 4-tuple with the first entry being aUtmDomainobject within which you would like to restrict the interpolation, and the next 2 entries being nx, ny as described above. The last entry should be another tuple itself with entries (max_depth, nz). This is because most global models go much deeper than the domain you’d like to simulate in a UTM setting.methodstr — Which method to use for thescipyinterpolation. Can be either “nearest” or “linear”. Note that “linear” may take a long time, depending on the size of the model.extrapolatebool — Set theextrapolateflag on the resulting Cartesian model, which controls how the model is eventually interpolated onto a mesh which exceeds the model bounds.
to_json()
to_json()def to_json(self, parent_folder: Union[str, pathlib.Path]) -> Dict:
...Serialize the model to JSON (and an associated NetCDF file).
parent_folderUnion[str, pathlib.Path] — Parent folder where the JSON + NetCDF files should be stored.
GenericModel
GenericModelclass GenericModel(
salvus.project.configuration.model.volume.seismology._SeismologyBase
):
def __init__(
self,
name: str,
data: Union[pathlib.Path, str, xarray.core.dataset.Dataset],
parameters: Optional[List[str]] = None,
taper_in_degrees: Optional[float] = None,
use_nan_mask_for_taper: Optional[str] = None,
restrict_to_layers: Optional[int, List[int], str] = None,
ignore_element_flags: Optional[Tuple[str, int]] = None,
use_symlink: bool = False,
):
...A generic (crust + mantle) model.
namestr — Name of the model.dataUnion[pathlib.Path, str, xarray.core.dataset.Dataset] — The actual data values.parametersOptional[List[str]] — Only interpolate these parameters from the model.taper_in_degreesOptional[float] — How many degrees to use to taper into the background model.use_nan_mask_for_taperOptional[str] — Use a NaN mask for the taper.restrict_to_layersOptional[int, List[int], str] — Restrict to a few layers.ignore_element_flagsOptional[Tuple[str, int]] — Don’t do interpolation in elements which have a specific flag. For example, passing (“fluid”, 1) will ignore all elements where the elemental field “fluid” is set to 1.use_symlinkbool — Don’t copy the data to the project but only use a symlink. Only works if the data is passed as a filename or path.
dim int
dim intDimensions of the model.
ds xarray.core.dataset.Dataset
ds xarray.core.dataset.DatasetThe actual dataset representing the model.
interpolation_mode str
interpolation_mode strInterpolation mode.
name str
name strModel name.
restrict_to_layers Optional[int, List[int], str]
restrict_to_layers Optional[int, List[int], str]Layers to restrict to.
from_json()
from_json()def from_json(parent_folder: pathlib.Path, d: Dict) -> _ModelBase:
...Recreate the object from a dictionary serialization of its initialization parameters.
parent_folderpathlib.Path — Path to which the serialized model is relative to.dDict — Dictionary containing its init parameters and a few other things.
to_generic_model_cartesian()
to_generic_model_cartesian()def to_generic_model_cartesian(
self,
utm: Union[pyproj.crs.crs.CRS, str],
ellipsoid: Union[pyproj.crs.crs.CRS, str],
radius_in_meters: float = 6371000.0,
points: Union[
Tuple[int, int, int],
Tuple[
salvus.project.domain.dim3.UtmDomain, int, int, Tuple[float, int]
],
],
method: str = "nearest",
extrapolate: bool = True,
) -> salvus.project.configuration.model.volume.cartesian.GenericModel:
...Convert a seismological model to a cartesian one.
Sometimes the model we work with are parameterized in spherical
coordinates, but we would like to work on UTM domains. This function
returns a Cartesian model which can then be used in a UTM context.
This model is re-sampled onto a regular grid in Cartesian coordinates
with, by default, the same extent as the original model in UTM
coordinates. This behavior can be changed by additionally passing a
UtmDomain object (see the documentation for points below).
If a model is passed with datasets suffixed with _nan, this routine
will interpret the NANs in the model as defining transparent regions.
Such a detection will automatically set extrapolate to False, and
only the masked version of the parameter arrays will be present in
the returned Cartesian model.
utmUnion[pyproj.crs.crs.CRS, str] — ApyprojCRS object describing the UTM domain to cast to.ellipsoidUnion[pyproj.crs.crs.CRS, str] — ApyprojCRS object describing the ellipsoid that the model is currently parameterized with respect to.radius_in_metersfloat — The vertical units of the model are re-parameterized to depth. This radius is treated as depth 0.pointsUnion[Tuple[int, int, int], Tuple[salvus.project.domain.dim3.UtmDomain, int, int, Tuple[float, int]]] — A tuple of either: - A 3-tuple containing the number of grid point to use for the resampling in each dimension (nx, ny, nz). In this case the model extent will be the same as that defined by the spherical model. This may not be very appropriate if the model is, for instance, a global model. - A 4-tuple with the first entry being aUtmDomainobject within which you would like to restrict the interpolation, and the next 2 entries being nx, ny as described above. The last entry should be another tuple itself with entries (max_depth, nz). This is because most global models go much deeper than the domain you’d like to simulate in a UTM setting.methodstr — Which method to use for thescipyinterpolation. Can be either “nearest” or “linear”. Note that “linear” may take a long time, depending on the size of the model.extrapolatebool — Set theextrapolateflag on the resulting Cartesian model, which controls how the model is eventually interpolated onto a mesh which exceeds the model bounds.
to_json()
to_json()def to_json(self, parent_folder: Union[str, pathlib.Path]) -> Dict:
...Serialize the model to JSON (and an associated NetCDF file).
parent_folderUnion[str, pathlib.Path] — Parent folder where the JSON + NetCDF files should be stored.
MantleModel
MantleModelclass MantleModel(
salvus.project.configuration.model.volume.seismology._SeismologyBase
):
def __init__(
self,
name: str,
data: Union[pathlib.Path, str, xarray.core.dataset.Dataset],
parameters: Optional[List[str]] = None,
taper_in_degrees: Optional[float] = None,
use_nan_mask_for_taper: Optional[str] = None,
use_symlink: bool = False,
):
...A mantle model.
namestr — Name of the model.dataUnion[pathlib.Path, str, xarray.core.dataset.Dataset] — The actual data values.parametersOptional[List[str]] — Only interpolate these parameters from the model.taper_in_degreesOptional[float] — How many degrees to use to taper into the background model.use_nan_mask_for_taperOptional[str] — Use a NaN mask for the taper.use_symlinkbool — Don’t copy the data to the project but only use a symlink. Only works if the data is passed as a filename or path.
dim int
dim intDimensions of the model.
ds xarray.core.dataset.Dataset
ds xarray.core.dataset.DatasetThe actual dataset representing the model.
interpolation_mode str
interpolation_mode strInterpolation mode.
name str
name strModel name.
restrict_to_layers Optional[int, List[int], str]
restrict_to_layers Optional[int, List[int], str]Layers to restrict to.
from_json()
from_json()def from_json(parent_folder: pathlib.Path, d: Dict) -> _ModelBase:
...Recreate the object from a dictionary serialization of its initialization parameters.
parent_folderpathlib.Path — Path to which the serialized model is relative to.dDict — Dictionary containing its init parameters and a few other things.
to_generic_model_cartesian()
to_generic_model_cartesian()def to_generic_model_cartesian(
self,
utm: Union[pyproj.crs.crs.CRS, str],
ellipsoid: Union[pyproj.crs.crs.CRS, str],
radius_in_meters: float = 6371000.0,
points: Union[
Tuple[int, int, int],
Tuple[
salvus.project.domain.dim3.UtmDomain, int, int, Tuple[float, int]
],
],
method: str = "nearest",
extrapolate: bool = True,
) -> salvus.project.configuration.model.volume.cartesian.GenericModel:
...Convert a seismological model to a cartesian one.
Sometimes the model we work with are parameterized in spherical
coordinates, but we would like to work on UTM domains. This function
returns a Cartesian model which can then be used in a UTM context.
This model is re-sampled onto a regular grid in Cartesian coordinates
with, by default, the same extent as the original model in UTM
coordinates. This behavior can be changed by additionally passing a
UtmDomain object (see the documentation for points below).
If a model is passed with datasets suffixed with _nan, this routine
will interpret the NANs in the model as defining transparent regions.
Such a detection will automatically set extrapolate to False, and
only the masked version of the parameter arrays will be present in
the returned Cartesian model.
utmUnion[pyproj.crs.crs.CRS, str] — ApyprojCRS object describing the UTM domain to cast to.ellipsoidUnion[pyproj.crs.crs.CRS, str] — ApyprojCRS object describing the ellipsoid that the model is currently parameterized with respect to.radius_in_metersfloat — The vertical units of the model are re-parameterized to depth. This radius is treated as depth 0.pointsUnion[Tuple[int, int, int], Tuple[salvus.project.domain.dim3.UtmDomain, int, int, Tuple[float, int]]] — A tuple of either: - A 3-tuple containing the number of grid point to use for the resampling in each dimension (nx, ny, nz). In this case the model extent will be the same as that defined by the spherical model. This may not be very appropriate if the model is, for instance, a global model. - A 4-tuple with the first entry being aUtmDomainobject within which you would like to restrict the interpolation, and the next 2 entries being nx, ny as described above. The last entry should be another tuple itself with entries (max_depth, nz). This is because most global models go much deeper than the domain you’d like to simulate in a UTM setting.methodstr — Which method to use for thescipyinterpolation. Can be either “nearest” or “linear”. Note that “linear” may take a long time, depending on the size of the model.extrapolatebool — Set theextrapolateflag on the resulting Cartesian model, which controls how the model is eventually interpolated onto a mesh which exceeds the model bounds.
to_json()
to_json()def to_json(self, parent_folder: Union[str, pathlib.Path]) -> Dict:
...Serialize the model to JSON (and an associated NetCDF file).
parent_folderUnion[str, pathlib.Path] — Parent folder where the JSON + NetCDF files should be stored.