Version:

salvus.project.configuration.topography.cartesian

salvus.project.configuration.topography.cartesian salvus project configuration topography cartesian
Cartesian topographies.

Classes

GenericTopography

Generic topography - currently not implemented.
SIGNATURE
class GenericTopography(
    salvus.project.configuration.topography.cartesian._CartesianBase
):
    def __init__(self) -> None: ...

Properties

  • coordinates(np.ndarray | tuple[np.ndarray, np.ndarray])-Coordinates of the data values.
  • ds(xr.Dataset)-The actual dataset representing the model.
  • name(str)-Name of the topography configuration.
  • no_deformation_above(float)-Don't deform above this values.
  • no_deformation_below(float | None)-Don't deform below this value.
  • reference_elevation(float)-Reference elevation height.
  • relative_elevation_model(np.ndarray)-Relative elevation model.

Class Methods

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

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

SurfaceTopography

Surface topography.
SIGNATURE
class SurfaceTopography(
    salvus.project.configuration.topography.cartesian._CartesianBase
):
    def __init__(
        self,
        name: str,
        data: pathlib.Path | str | xr.Dataset,
        no_deformation_below: float | None = None,
        no_deformation_above: float | None = None,
        use_symlink: bool = False,
    ) -> None: ...
ARGUMENTS
Required
name
Type:str
Description:
Name for this topography model.
Required
data
Type:pathlib.Path | str | xr.Dataset
Description:
xarray dataset, or path to a NetCDF file saved by xarray, which contains the digital elevation model (DEM).
Optional
no_deformation_below
Type:float | None
Default value:None
Description:
Do not deform the mesh below this value.
Optional
no_deformation_above
Type:float | None
Default value:None
Description:
Usually not necessary for the users to set, as it will be auto-derived from the topography model in most cases. However, if special requirements are present (for instance: the presence of an atmospheric layer above the surface topography), one may benefit from setting this value.
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

  • coordinates(np.ndarray | tuple[np.ndarray, np.ndarray])-Coordinates of the data values.
  • ds(xr.Dataset)-The actual dataset representing the model.
  • name(str)-Name of the topography configuration.
  • no_deformation_above(float)-Don't deform above this values.
  • no_deformation_below(float | None)-Don't deform below this value.
  • reference_elevation(float)-Reference elevation height.
  • relative_elevation_model(np.ndarray)-Relative elevation model.

Class Methods

SurfaceTopography.from_appeears_request()
Create a surface topography from an APPEEARS data file.
The APPEEARS (https://lpdaacsvc.cr.usgs.gov/appeears/) service is a webservice that allows, among other things, researchers to download high-resolution digital elevation models (up to 30m resolution) for much of the globe. This helper function allows Salvus users to transform the APPEEARS topography files into a Salvus "Topography Model" for use in waveform simulations.
SIGNATURE
def from_appeears_request(
    name: str,
    data: pathlib.Path,
    utm: pyproj.CRS,
    resample_topo_nx: int = 100,
    decimate_topo_factor: int = 1,
    gaussian_std_in_meters: float = 100.0,
    no_deformation_below: float | None = None,
    no_deformation_above: float | None = None,
    dem_variable_name: str | None = None,
) -> SurfaceTopography: ...
ARGUMENTS
Required
name
Type:str
Description:
Name for this topography model.
Required
data
Type:pathlib.Path
Description:
Path to the APPEEARS NetCDF file.
Required
utm
Type:pyproj.CRS
Description:
A pyproj.CRS object describing the UTM projection to which the elevation data should be transformed. The APPEEARS data is assumed to be referenced to the WGS84 ellipsoid by convention. This can usually be gathered from the target UtmDomain object.
Optional
resample_topo_nx
Type:int
Default value:100
Description:
The elevation model is re-sampled onto a regular grid in UTM coordinate. This parameter controls the number of points per dimension in the re-sampled dataset. Resample the elevation model to this many points. If the interpolation stage is taking very long, you can consider decreasing this value.
Optional
decimate_topo_factor
Type:int
Default value:1
Description:
Decimate the provided topography model this factor (before conversion to UTM). If the interpolation stage is taking very long, you can consider increasing this value.
Optional
gaussian_std_in_meters
Type:float
Default value:100.0
Description:
Apply a Gaussian filter to the topography model once it has been transformed into UTM coordinates. This serves to smooth the model, and may be necessary if there are very sharp changes in elevation relative to the size of an element.
Optional
no_deformation_below
Type:float | None
Default value:None
Description:
Do not deform the mesh below this value. Useful if you have a 1-D model which need to place at a specific depth below the WGS84 sea level.
Optional
no_deformation_above
Type:float | None
Default value:None
Description:
Do not deform the mesh above this value. Useful in special circumstances (i.e. if an atmosphere layer is desired).
Optional
dem_variable_name
Type:str | None
Default value:None
Description:
The variable name of the actual topography data in the netcdf file. In most cases Salvus will be able to automatically determine this. If not, please specify it.
SurfaceTopography.from_gmrt_file()
Create a surface topography from a GMRT data file.
The GMRT (https://www.gmrt.org/) service is a webservice that allows, among other things, researchers to download high-resolution digital elevation and bathymetry models (up to 30m resolution) for much of the globe. This helper function allows Salvus users to transform the GMRT topography files into a Salvus "Topography Model" for use in waveform simulations.
SIGNATURE
def from_gmrt_file(
    name: str,
    utm: pyproj.CRS,
    data: pathlib.Path,
    resample_topo_nx: int = 100,
    decimate_topo_factor: int = 1,
    gaussian_std_in_meters: float = 100.0,
    no_deformation_below: float | None = None,
    no_deformation_above: float | None = None,
) -> SurfaceTopography: ...
ARGUMENTS
Required
name
Type:str
Description:
Name for this topography model.
Required
utm
Type:pyproj.CRS
Description:
A pyproj.CRS object describing the UTM projection to which the elevation data should be transformed. The GMRT data is assumed to be referenced to the WGS84 ellipsoid by convention. This can usually be gathered from the target UtmDomain object.
Required
data
Type:pathlib.Path
Description:
Path to the GMRT NetCDF file.
Optional
resample_topo_nx
Type:int
Default value:100
Description:
The elevation model is re-sampled onto a regular grid in UTM coordinate. This parameter controls the number of points per dimension in the re-sampled dataset. Resample the elevation model to this many points. If the interpolation stage is taking very long, you can consider decreasing this value.
Optional
decimate_topo_factor
Type:int
Default value:1
Description:
Decimate the provided topography model this factor (before conversion to UTM). If the interpolation stage is taking very long, you can consider increasing this value.
Optional
gaussian_std_in_meters
Type:float
Default value:100.0
Description:
Apply a Gaussian filter to the topography model once it has been transformed into UTM coordinates. This serves to smooth the model, and may be necessary if there are very sharp changes in elevation relative to the size of an element.
Optional
no_deformation_below
Type:float | None
Default value:None
Description:
Do not deform the mesh below this value. Useful if you have a 1-D model which need to place at a specific depth below the WGS84 sea level.
Optional
no_deformation_above
Type:float | None
Default value:None
Description:
Do not deform the mesh above this value. Useful in special circumstances (i.e. if an atmosphere layer is desired).
SurfaceTopography.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

SurfaceTopography.extract_2d_line()
Extract a 1-D profile from a 2-D topography model.
When considering the computational cost of waveform simulations it is often desireable to run run 2-D simulations instead of 3-D ones. This function allows users to extract 1-D lines from 2-D topography models (such as those generated with the from_apppears_request or from_gmrt_file functions), and use these lines to deform the surface of a 2-D mesh according to the topographic profile along the chosen line.
Additional keyword arguments are passed to the internal interpolation function. We currently use RectBivariateSpline from scipy.
SIGNATURE
def extract_2d_line(
    self,
    name: str,
    p0: tuple[float, float],
    p1: tuple[float, float],
    buffer_in_meters: float = 0.0,
    n_points: int,
) -> SurfaceTopography: ...
ARGUMENTS
Required
name
Type:str
Description:
Name for this topography model.
Required
p0
Type:tuple[float, float]
Description:
A tuple of points (x0, y0) defining the start of the profile.
Required
p1
Type:tuple[float, float]
Description:
A tuple of points (x1, y1) defining the end of the profile.
Optional
buffer_in_meters
Type:float
Default value:0.0
Description:
A length in meters on each side of the profile to extend the topography model by. This can be useful, for instance, if you will eventually attach absorbing boundaries to the 2-D mesh and require the topography model to extend into the absorbing region.
Required
n_points
Type:int
Description:
The number of points with which to perform the interpolation.
SurfaceTopography.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