gwexpy.interop.mt_
Interoperate with the MTH5 magnetotelluric HDF5 format.
Interoperability with MTH5 (Magnetotelluric HDF5) format.
Provides read/write functionality for magnetotelluric time series data. Requires the mth5 package.
Functions
|
Read a channel from MTH5 to TimeSeries. |
|
Write a TimeSeries to an MTH5 file. |
- gwexpy.interop.mt_.to_mth5(series, mth5_obj: str | Any, station: str | None = None, run: str | None = None, channel_type: str = 'electric') None[source]
Write a TimeSeries to an MTH5 file.
- Parameters:
series (TimeSeries) – Data to write.
mth5_obj (str or mth5.mth5.MTH5) – Open MTH5 object or path to HDF5 file.
station (str, optional) – Station name. Defaults to ‘Station01’.
run (str, optional) – Run name. Defaults to ‘Run01’.
channel_type ({'electric', 'magnetic', 'auxiliary'}, optional) – Channel type for metadata. Default is ‘electric’.
- Raises:
ImportError – If mth5 package is not installed.
Examples
>>> from gwexpy.timeseries import TimeSeries >>> from gwexpy.interop.mt_ import to_mth5 >>> ts = TimeSeries([1, 2, 3], dt=0.001, name="Ex") >>> to_mth5(ts, "data.h5", station="Site01", run="Run01")
- gwexpy.interop.mt_.from_mth5(mth5_obj: str | Any, station: str, run: str, channel: str, survey: str | None = None)[source]
Read a channel from MTH5 to TimeSeries.
- Parameters:
- Returns:
The loaded time series data.
- Return type:
TimeSeries
- Raises:
ImportError – If mth5 package is not installed.
KeyError – If station, run, or channel is not found.
Examples
>>> from gwexpy.interop.mt_ import from_mth5 >>> ts = from_mth5("data.h5", "Site01", "Run01", "Ex")