Mondaic
This API reference is not for the latest stable Salvus version.

salvus.project.configuration.model.volume.cartesian

Classes

GenericModel

class GenericModel(
    salvus.project.configuration.model.volume.cartesian._CartesianBase
):
    def __init__(
        self,
        name: str,
        data: Union[pathlib.Path, str, xarray.core.dataset.Dataset],
        extrapolate: bool = True,
        use_symlink: bool = False,
        mode: Optional[str] = None,
        ignore_element_flags: Optional[Tuple[str, int]] = None,
    ):
        ...

Generic background model.

Parameters
  • name str — Model name.
  • data Union[pathlib.Path, str, xarray.core.dataset.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 Optional[str] — Which mode of interpolation should be used. See the documentation for salvus.toolbox.interpolate_cartesian.
  • ignore_element_flags Optional[Tuple[str, int]] — 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 xarray.core.dataset.Dataset

The actual dataset representing the model.

extrapolate bool

Extrapolate or not?

interpolation_mode str

Interpolation mode.

mode Optional[str]

Which interpolate mode?

name str

Model name.

restrict_to_layers Optional[int, List[int], str]

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: Union[str, pathlib.Path]) -> Dict:
    ...

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

Parameters
  • parent_folder Union[str, pathlib.Path] — Parent folder where the JSON + NetCDF files should be stored.
Returns Dict