salvus.project.configuration.model.volume.cartesian
salvus.project.configuration.model.volume.cartesian salvus project configuration model volume cartesian Cartesian volume models.
Classes
GenericModel
GenericModelclass 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
namestr — Model name.datapathlib.Path | str | xr.Dataset — The model data.extrapolatebool — Extrapolate the values if necessary.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.modestr | None — Which mode of interpolation should be used. See the documentation forsalvus.toolbox.interpolate_cartesian.ignore_element_flagstuple[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 passmask=('fluid', 1).
Attributes
dim int
dim intDimensions of the model.
ds xr.Dataset
ds xr.DatasetThe actual dataset representing the model.
extrapolate bool
extrapolate boolExtrapolate or not?
interpolation_mode str
interpolation_mode strInterpolation mode.
mode str | None
mode str | NoneWhich interpolate mode?
name str
name strModel name.
restrict_to_layers int | list[int] | str | None
restrict_to_layers int | list[int] | str | NoneLayers to restrict to.
Methods
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.
Parameters
parent_folderpathlib.Path — Path to which the serialized model is relative to.ddict — Dictionary containing its init parameters and a few other things.
Returns _ModelBase
to_json()
to_json()def to_json(self, parent_folder: pathlib.Path | str) -> dict: ...Serialize the model to JSON (and an associated NetCDF file).
Parameters
parent_folderpathlib.Path | str — Parent folder where the JSON + NetCDF files should be stored.
Returns dict
Used in tutorials
- Attenuation
- Constructing the Starting Model
- Creating and plotting custom gathers from Salvus' receiver outputs
- Full-Waveform Inversion
- Lamb's problem
- Mapping between simulation and inversion space
- Marmousi Model
- Mesh-to-mesh interpolation
- My First Salvus Inversion
- My First Salvus Simulation
- Working with variable models and extracting slices