Version:

salvus.project.configuration.model.volume.seismology

salvus.project.configuration.model.volume.seismology salvus project configuration model volume seismology
Seismological models.

Classes

CrustalModel

A crustal model.
SIGNATURE
class CrustalModel(
    salvus.project.configuration.model.volume.seismology._SeismologyBase
):
    def __init__(
        self,
        name: str,
        data: Path | str | xr.Dataset,
        parameters: list[str] | None = None,
        taper_in_degrees: float | None = None,
        use_nan_mask_for_taper: str | None = None,
        use_symlink: bool = False,
    ): ...
ARGUMENTS
Required
name
Type:str
Description:
Name of the model.
Required
data
Type:Path | str | xr.Dataset
Description:
The actual data values.
Optional
parameters
Type:list[str] | None
Default value:None
Description:
Only interpolate these parameters from the model.
Optional
taper_in_degrees
Type:float | None
Default value:None
Description:
How many degrees to use to taper into the background model.
Optional
use_nan_mask_for_taper
Type:str | None
Default value:None
Description:
Use a NaN mask for the taper.
Optional
use_symlink
Type:bool
Default value:False
Description:
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.

Properties

  • dim(int)-Dimensions of the model.
  • ds(xr.Dataset)-The actual dataset representing the model.
  • interpolation_mode(str)-Interpolation mode.
  • name(str)-Model name.
  • restrict_to_layers(int | list[int] | str | None)-Layers to restrict to.

Class Methods

CrustalModel.from_json()
Recreate the object from a dictionary serialization of its initialization parameters.
SIGNATURE
def from_json(parent_folder: pathlib.Path, d: dict) -> _ModelBase: ...
ARGUMENTS
Required
parent_folder
Type:pathlib.Path
Description:
Path to which the serialized model is relative to.
Required
d
Type:dict
Description:
Dictionary containing its init parameters and a few other things.

Methods

CrustalModel.to_generic_model_cartesian()
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.
SIGNATURE
def to_generic_model_cartesian(
    self,
    utm: pyproj.CRS | str,
    ellipsoid: pyproj.CRS | str,
    radius_in_meters: float = 6371000.0,
    points: (
        tuple[int, int, int] | tuple[UtmDomain, int, int, tuple[float, int]]
    ),
    method: str = "nearest",
    extrapolate: bool = True,
) -> CartesianGenericModel: ...
ARGUMENTS
Required
utm
Type:pyproj.CRS | str
Description:
A pyproj CRS object describing the UTM domain to cast to.
Required
ellipsoid
Type:pyproj.CRS | str
Description:
A pyproj CRS object describing the ellipsoid that the model is currently parameterized with respect to.
Optional
radius_in_meters
Type:float
Default value:6371000.0
Description:
The vertical units of the model are re-parameterized to depth. This radius is treated as depth 0.
Required
points
Type:tuple[int, int, int] | tuple[UtmDomain, int, int, tuple[float, int]]
Description:
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 a UtmDomain object 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.
Optional
method
Type:str
Default value:'nearest'
Description:
Which method to use for the scipy interpolation. Can be either "nearest" or "linear". Note that "linear" may take a long time, depending on the size of the model.
Optional
extrapolate
Type:bool
Default value:True
Description:
Set the extrapolate flag on the resulting Cartesian model, which controls how the model is eventually interpolated onto a mesh which exceeds the model bounds.
CrustalModel.to_json()
Serialize the model to JSON (and an associated NetCDF file).
SIGNATURE
def to_json(self, parent_folder: pathlib.Path | str) -> dict: ...
ARGUMENTS
Required
parent_folder
Type:pathlib.Path | str
Description:
Parent folder where the JSON + NetCDF files should be stored.

GenericModel

A generic (crust + mantle) model.
SIGNATURE
class GenericModel(
    salvus.project.configuration.model.volume.seismology._SeismologyBase
):
    def __init__(
        self,
        name: str,
        data: Path | str | xr.Dataset,
        parameters: list[str] | None = None,
        taper_in_degrees: float | None = None,
        use_nan_mask_for_taper: str | None = None,
        restrict_to_layers: int | list[int] | str | None = None,
        ignore_element_flags: tuple[str, int] | None = None,
        use_symlink: bool = False,
    ): ...
ARGUMENTS
Required
name
Type:str
Description:
Name of the model.
Required
data
Type:Path | str | xr.Dataset
Description:
The actual data values.
Optional
parameters
Type:list[str] | None
Default value:None
Description:
Only interpolate these parameters from the model.
Optional
taper_in_degrees
Type:float | None
Default value:None
Description:
How many degrees to use to taper into the background model.
Optional
use_nan_mask_for_taper
Type:str | None
Default value:None
Description:
Use a NaN mask for the taper.
Optional
restrict_to_layers
Type:int | list[int] | str | None
Default value:None
Description:
Restrict to a few layers.
Optional
ignore_element_flags
Type:tuple[str, int] | None
Default value:None
Description:
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.
Optional
use_symlink
Type:bool
Default value:False
Description:
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.

Properties

  • dim(int)-Dimensions of the model.
  • ds(xr.Dataset)-The actual dataset representing the model.
  • interpolation_mode(str)-Interpolation mode.
  • name(str)-Model name.
  • restrict_to_layers(int | list[int] | str | None)-Layers to restrict to.

Class Methods

GenericModel.from_json()
Recreate the object from a dictionary serialization of its initialization parameters.
SIGNATURE
def from_json(parent_folder: pathlib.Path, d: dict) -> _ModelBase: ...
ARGUMENTS
Required
parent_folder
Type:pathlib.Path
Description:
Path to which the serialized model is relative to.
Required
d
Type:dict
Description:
Dictionary containing its init parameters and a few other things.

Methods

GenericModel.to_generic_model_cartesian()
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.
SIGNATURE
def to_generic_model_cartesian(
    self,
    utm: pyproj.CRS | str,
    ellipsoid: pyproj.CRS | str,
    radius_in_meters: float = 6371000.0,
    points: (
        tuple[int, int, int] | tuple[UtmDomain, int, int, tuple[float, int]]
    ),
    method: str = "nearest",
    extrapolate: bool = True,
) -> CartesianGenericModel: ...
ARGUMENTS
Required
utm
Type:pyproj.CRS | str
Description:
A pyproj CRS object describing the UTM domain to cast to.
Required
ellipsoid
Type:pyproj.CRS | str
Description:
A pyproj CRS object describing the ellipsoid that the model is currently parameterized with respect to.
Optional
radius_in_meters
Type:float
Default value:6371000.0
Description:
The vertical units of the model are re-parameterized to depth. This radius is treated as depth 0.
Required
points
Type:tuple[int, int, int] | tuple[UtmDomain, int, int, tuple[float, int]]
Description:
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 a UtmDomain object 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.
Optional
method
Type:str
Default value:'nearest'
Description:
Which method to use for the scipy interpolation. Can be either "nearest" or "linear". Note that "linear" may take a long time, depending on the size of the model.
Optional
extrapolate
Type:bool
Default value:True
Description:
Set the extrapolate flag on the resulting Cartesian model, which controls how the model is eventually interpolated onto a mesh which exceeds the model bounds.
GenericModel.to_json()
Serialize the model to JSON (and an associated NetCDF file).
SIGNATURE
def to_json(self, parent_folder: pathlib.Path | str) -> dict: ...
ARGUMENTS
Required
parent_folder
Type:pathlib.Path | str
Description:
Parent folder where the JSON + NetCDF files should be stored.

MantleModel

A mantle model.
SIGNATURE
class MantleModel(
    salvus.project.configuration.model.volume.seismology._SeismologyBase
):
    def __init__(
        self,
        name: str,
        data: Path | str | xr.Dataset,
        parameters: list[str] | None = None,
        taper_in_degrees: float | None = None,
        use_nan_mask_for_taper: str | None = None,
        use_symlink: bool = False,
    ): ...
ARGUMENTS
Required
name
Type:str
Description:
Name of the model.
Required
data
Type:Path | str | xr.Dataset
Description:
The actual data values.
Optional
parameters
Type:list[str] | None
Default value:None
Description:
Only interpolate these parameters from the model.
Optional
taper_in_degrees
Type:float | None
Default value:None
Description:
How many degrees to use to taper into the background model.
Optional
use_nan_mask_for_taper
Type:str | None
Default value:None
Description:
Use a NaN mask for the taper.
Optional
use_symlink
Type:bool
Default value:False
Description:
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.

Properties

  • dim(int)-Dimensions of the model.
  • ds(xr.Dataset)-The actual dataset representing the model.
  • interpolation_mode(str)-Interpolation mode.
  • name(str)-Model name.
  • restrict_to_layers(int | list[int] | str | None)-Layers to restrict to.

Class Methods

MantleModel.from_json()
Recreate the object from a dictionary serialization of its initialization parameters.
SIGNATURE
def from_json(parent_folder: pathlib.Path, d: dict) -> _ModelBase: ...
ARGUMENTS
Required
parent_folder
Type:pathlib.Path
Description:
Path to which the serialized model is relative to.
Required
d
Type:dict
Description:
Dictionary containing its init parameters and a few other things.

Methods

MantleModel.to_generic_model_cartesian()
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.
SIGNATURE
def to_generic_model_cartesian(
    self,
    utm: pyproj.CRS | str,
    ellipsoid: pyproj.CRS | str,
    radius_in_meters: float = 6371000.0,
    points: (
        tuple[int, int, int] | tuple[UtmDomain, int, int, tuple[float, int]]
    ),
    method: str = "nearest",
    extrapolate: bool = True,
) -> CartesianGenericModel: ...
ARGUMENTS
Required
utm
Type:pyproj.CRS | str
Description:
A pyproj CRS object describing the UTM domain to cast to.
Required
ellipsoid
Type:pyproj.CRS | str
Description:
A pyproj CRS object describing the ellipsoid that the model is currently parameterized with respect to.
Optional
radius_in_meters
Type:float
Default value:6371000.0
Description:
The vertical units of the model are re-parameterized to depth. This radius is treated as depth 0.
Required
points
Type:tuple[int, int, int] | tuple[UtmDomain, int, int, tuple[float, int]]
Description:
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 a UtmDomain object 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.
Optional
method
Type:str
Default value:'nearest'
Description:
Which method to use for the scipy interpolation. Can be either "nearest" or "linear". Note that "linear" may take a long time, depending on the size of the model.
Optional
extrapolate
Type:bool
Default value:True
Description:
Set the extrapolate flag on the resulting Cartesian model, which controls how the model is eventually interpolated onto a mesh which exceeds the model bounds.
MantleModel.to_json()
Serialize the model to JSON (and an associated NetCDF file).
SIGNATURE
def to_json(self, parent_folder: pathlib.Path | str) -> dict: ...
ARGUMENTS
Required
parent_folder
Type:pathlib.Path | str
Description:
Parent folder where the JSON + NetCDF files should be stored.
PAGE CONTENTS