Version:

salvus.project.configuration.model.volume.cartesian

salvus.project.configuration.model.volume.cartesian salvus project configuration model volume cartesian
Cartesian volume models.

Classes

GenericModel

Generic background model.
SIGNATURE
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,
    ): ...
ARGUMENTS
Required
name
Type:str
Description:
Model name.
Required
data
Type:pathlib.Path | str | xr.Dataset
Description:
The model data.
Optional
extrapolate
Type:bool
Default value:True
Description:
Extrapolate the values if necessary.
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.
Optional
mode
Type:str | None
Default value:None
Description:
Which mode of interpolation should be used. See the documentation for salvus.toolbox.interpolate_cartesian.
Optional
ignore_element_flags
Type:tuple[str, int] | None
Default value:None
Description:
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).

Properties

  • 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.

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_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.

Used in tutorials

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