Mondaic

salvus.project.configuration.model.volume.cartesian

salvus.project.configuration.model.volume.cartesian salvus project configuration model volume cartesian

Cartesian volume models.

Classes

GenericModel

class GenericModel(
    salvus.project.configuration.model.volume.cartesian._CartesianBase
):
    def __init__(
        self,
        name: str,
        data: pathlib.Path | str | xr.Dataset,
        extrapolate: bool = True,
        use_symlink: bool = False,
        mode: str | None = None,
        ignore_element_flags: tuple[str, int] | None = None,
    ): ...

Generic background model.

Parameters
  • name str — Model name.
  • data pathlib.Path | str | xr.Dataset — The model data.
  • extrapolate bool — Extrapolate the values if necessary.
  • use_symlink bool — 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.
  • mode str | None — Which mode of interpolation should be used. See the documentation for salvus.toolbox.interpolate_cartesian.
  • ignore_element_flags tuple[str, int] | None — A tuple of (elemental_field_name, elemental_field_value). Elements which contain this value in their elemental_field p will not be interpolated onto. For instance, to restrict interpolation to elastic elements only, one could pass mask=('fluid', 1).
Attributes
dim int

Dimensions of the model.

ds xr.Dataset

The actual dataset representing the model.

extrapolate bool

Extrapolate or not?

interpolation_mode str

Interpolation mode.

mode str | None

Which interpolate mode?

name str

Model name.

restrict_to_layers int | list[int] | str | None

Layers to restrict to.

Methods
from_json()
def from_json(parent_folder: pathlib.Path, d: dict) -> _ModelBase: ...

Recreate the object from a dictionary serialization of its initialization parameters.

Parameters
  • parent_folder pathlib.Path — Path to which the serialized model is relative to.
  • d dict — Dictionary containing its init parameters and a few other things.
Returns _ModelBase
to_json()
def to_json(self, parent_folder: pathlib.Path | str) -> dict: ...

Serialize the model to JSON (and an associated NetCDF file).

Parameters
  • parent_folder pathlib.Path | str — Parent folder where the JSON + NetCDF files should be stored.
Returns dict

Used in tutorials