salvus.data.io
Functions for data I/O.
Functions
external_data_to_hdf5()
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.
dataxarray.core.dataset.Dataset — The data to write to the file.receiverstypes — 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_filenamepathlib.Path — Where to store the file.
get_built_in_topo_dataset_name()
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.
file_nametypes — The name of the topography file.radiusfloat — The radius of the planet.edge_lengthfloat — The maximum edge length at the mesh’s top surface.model_orderint — The order of the model representation.
get_dem()
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.
scalefloat — Radius scale.varnamestr — Variable to get.fnametypes — The filename.min_phitypes — Minimum phi value.max_phitypes — Maximum phi valuemin_thetatypes — Minimum theta value.max_thetatypes — Maximum theta value.
manage_topo_bounds()
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.
euler_anglesbuiltins.tuple — The euler angles provided by the user.min_phitypes — The computed minimum phi value of the bounding box.max_phitypes — The computed maximum phi value of the bounding box.min_thetatypes — The computed minimum theta value of the bounding box.max_thetatypes — The computed maximum theta value of the bounding box.
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()
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.
dsalvus.project.domain.dim3.SphericalDomain — The domain.file_nametypes — The topography file name.dataset_namestr — The dataset name in the file.radiusfloat — The radius of the spherical domain.