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

salvus.data.io

Functions for data I/O.

Functions

external_data_to_hdf5()

def external_data_to_hdf5(
    data: xarray.core.dataset.Dataset,
    receivers: types,
    output_filename: pathlib.Path,
) -> None: ...

Write an xarray.Dataset to a Salvus compatible HDF5 file that can be added to a project.

Parameters
  • data xarray.core.dataset.Dataset — The data to write to the file.
  • receivers types — The corresponding Salvus receivers or receiver channels in the same order as the data (the first dimension in the data is the receiver index).
  • output_filename pathlib.Path — Where to store the file.
Returns None

get_built_in_topo_dataset_name()

def get_built_in_topo_dataset_name(
    file_name: types, radius: float, edge_length: float, model_order: int
) -> str: ...

Choose a dataset from Mondaic’s built-in Earth topography files.

The dataset chosen will have the highest angular order available, with the caveat that at least 4 points in the mesh should sample the topography’s highest wavenumber.

Parameters
  • file_name types — The name of the topography file.
  • radius float — The radius of the planet.
  • edge_length float — The maximum edge length at the mesh’s top surface.
  • model_order int — The order of the model representation.
Returns str

get_dem()

def get_dem(
    scale: float,
    varname: str,
    fname: types,
    min_phi: types = None,
    max_phi: types = None,
    min_theta: types = None,
    max_theta: types = None,
) -> builtins.tuple: ...

Get the DEM from a hierarchical HDF5 file.

Parameters
  • scale float — Radius scale.
  • varname str — Variable to get.
  • fname types — The filename.
  • min_phi types — Minimum phi value.
  • max_phi types — Maximum phi value
  • min_theta types — Minimum theta value.
  • max_theta types — Maximum theta value.
Returns builtins.tuple

manage_topo_bounds()

def manage_topo_bounds(
    euler_angles: builtins.tuple,
    min_phi: types,
    max_phi: types,
    min_theta: types,
    max_theta: types,
) -> builtins.tuple: ...

Reset topography bounds if the 1st euler angle is nonzero.

A subtle issue exists in the computation of the domain for partial reads of topography files when euler angles are nonzero. In such cases we reset topographic bounds to their default value (None) which instructs the subsequent call to get_dem to ignore the partial read optimization and instead consider the entire file.

Parameters
  • euler_angles builtins.tuple — The euler angles provided by the user.
  • min_phi types — The computed minimum phi value of the bounding box.
  • max_phi types — The computed maximum phi value of the bounding box.
  • min_theta types — The computed minimum theta value of the bounding box.
  • max_theta types — The computed maximum theta value of the bounding box.
Returns builtins.tuple — If the last euler angle is not None, or if it nonzero, reset the phi / theta values to None as well, otherwise return the phi / theta values as they were.

read_built_in_topo_dataset()

def read_built_in_topo_dataset(
    d: salvus.project.domain.dim3.SphericalDomain,
    file_name: types,
    dataset_name: str,
    radius: float,
) -> xarray.core.dataarray.DataArray: ...

Read one of Mondaic’s built-in topography datasets.

Generic implementation for surface topography, moho topography, and ocean bathymetry.

Parameters
  • d salvus.project.domain.dim3.SphericalDomain — The domain.
  • file_name types — The topography file name.
  • dataset_name str — The dataset name in the file.
  • radius float — The radius of the spherical domain.
Returns xarray.core.dataarray.DataArray