Archivable and exchangeable format for magnetotelluric data

# MTH5

MTH5 is an HDF5 data container for magnetotelluric time series data, but could be extended to other data types. This package provides tools for reading/writing/manipulating MTH5 files.

MTH5 uses h5py to interact with the HDF5 file, xarray to interact with the data in a nice way, and all metadata use mt_metadata. This project is in cooperation with the Incorporated Research Institutes of Seismology, the U.S. Geological Survey, and other collaborators. Facilities of the IRIS Consortium are supported by the National Science Foundationâ€™s Seismological Facilities for the Advancement of Geoscience (SAGE) Award under Cooperative Support Agreement EAR-1851048. USGS is partially funded through the Community for Data Integration and IMAGe through the Minerals Resources Program.

• Version: 0.3.1
• Examples: Click the Binder badge above and Jupyter Notebook examples are in docs/examples/notebooks
• Suggested Citation: Peacock, J. R., Kappler, K., Ronan, T., Heagy, L., Kelbert, A., Frassetto, A. (2022) MTH5: An archive and exchangeable data format for magnetotelluric time series data, Computers & Geoscience, 162, doi:10.1016/j.cageo.2022.105102

## Features

• Read and write HDF5 files formated for magnetotelluric time series.
• From MTH5 a user can create an MTH5 file, get/add/remove stations, runs, channels and filters and all associated metadata.
• Data is contained as an xarray which can house the data and metadata together, and data is indexed by time.
• Readers for some data types are included as plugins, namely
• Z3D
• NIMS BIN
• USGS ASCII
• LEMI
• StationXML + miniseed

## Introduction

The goal of MTH5 is to provide a self describing heirarchical data format for working, sharing, and archiving. MTH5 was cooperatively developed with community input and follows logically how magnetotelluric data are collected. This module provides open-source tools to interact with an MTH5 file.

The metadata follows the standards proposed by the IRIS-PASSCAL MT Software working group and documented in MT Metadata Standards Note: If you would like to comment or contribute checkout Issues or Slack.

## MTH5 Format

• The basic format of MTH5 is illustrated below, where metadata is attached at each level.

## MTH5 File Version 0.1.0

MTH5 file version 0.1.0 was the original file version where Survey was the highest level of the file. This has some limitations in that only one Survey could be saved in a single file, but if you have mulitple Surveys that you would like to store we need to add a higher level Experiment.

Important: Some MTH5 0.1.0 files have already been archived on ScienceBase and has been used as the working format for Aurora and is here for reference. Moving forward the new format will be 0.2.0 as described below.

## MTH5 File Version 0.2.0

MTH5 file version 0.2.0 has Experiment as the top level. This allows for multiple Surveys to be included in a single file and therefore allows for more flexibility. For example if you would like to remote reference stations in a local survey with stations from a different survey collected at the same time you can have all those surveys and stations in the same file and make it easier for processing.

Hint: MTH5 is comprehensively logged, therefore if any problems arise you can always check the mth5_debug.log (if you are in debug mode, change the mode in the mth5.init) and the mth5_error.log, which will be written to your current working directory.

## Examples

Make a simple MTH5 with one station, 2 runs, and 2 channels (version 0.2.0)

from mth5.mth5 import MTH5

mth5_object = MTH5()
mth5_object.open_mth5(r"/home/mt/example_mth5.h5", "a")

# IMPORTANT: Must always use the write_metadata method when metadata is updated.

ex = m.add_channel("mt002", "001", "ex", "electric", None, survey="example")

print(mth5_object)

/:
====================
|- Group: Experiment
--------------------
|- Group: Reports
-----------------
|- Group: Standards
-------------------
--> Dataset: summary
......................
|- Group: Surveys
-----------------
|- Group: example
-----------------
|- Group: Filters
-----------------
|- Group: coefficient
---------------------
|- Group: fap
-------------
|- Group: fir
-------------
|- Group: time_delay
--------------------
|- Group: zpk
-------------
|- Group: Reports
-----------------
|- Group: Standards
-------------------
--> Dataset: summary
......................
|- Group: Stations
------------------
|- Group: mt001
---------------
|- Group: mt002
---------------
|- Group: 001
-------------
--> Dataset: ex
.................
--> Dataset: hy
.................
|- Group: 002
-------------


## Credits

This project is in cooperation with the Incorporated Research Institutes of Seismology, the U.S. Geological Survey, and other collaborators. Facilities of the IRIS Consortium are supported by the National Science Foundationâ€™s Seismological Facilities for the Advancement of Geoscience (SAGE) Award under Cooperative Support Agreement EAR-1851048. USGS is partially funded through the Community for Data Integration and IMAGe through the Minerals Resources Program.

# History

## 0.1.0 (2021-06-30)

• First release on PyPI.

## 0.2.0 (2021-10-31)

• Updated the structure of MTH5 to have Experiment as the top level
• Updated tests
• Backwards compatibility works
• Updated Docs

## 0.2.5 (2022-04-07)

• fixed bugs
• Added TransferFunctions and TransferFunction groups at the station level that can now hold transfer functions
• Added channel_summary and tf_summary tables that are updated upon close if the file is in 'w' mode
• Updated tests
• Updated documentation
• Note: tests for make_mth5 from IRIS are currently not working as there has been some reorganization with data at the DMC

## 0.2.6 (2022-07-01)

• minor bug fixes
• updated tests
• updated documentation

## 0.2.7 (2022-09-14)

• Rebased IO module to make a module for each data logger type
• Updated tests
• Updated documentation
• Factored make_mth5

## 0.3.0 (2022-09-25)

• change default initialize_mth5 to use append mode, issue #92 by @kkappler in #94
• Fix issue 105 by @kkappler in PR #106
• adding in parallel mth5 tutorial by @nre900 in #110
• adding in new tutorial and modifications to mth5_in_parallel.ipynb by @nre900 in issue #112
• Remove response by @kujaku11 in PR #100

## 0.3.1 (2023-01-18)

• Speed up station and survey validataion by
• remove kwarg specifying default value
• update initialize_mth5
• Have a single metadata object for ChannelTS and RunTS
• Use h5 Paths to get groups and datasets
• Bump wheel from 0.33.6 to 0.38.1

## Project details

Uploaded source
Uploaded py2 py3