Metadata for magnetotelluric data
Project description
mt_metadata version 0.3.9
Standard MT metadata
Description
MT Metadata is a project led by IRIS-PASSCAL MT Software working group and USGS to develop tools that standardize magnetotelluric metadata, well, at least create tools for standards that are generally accepted. This include the two main types of magnetotelluric data
-
Time Series
- Structured as:
- Experiment -> Survey -> Station -> Run -> Channel
- Supports translation to/from StationXML
- Structured as:
-
Transfer Functions
- Supports (will support) to/from:
- EDI (most common format)
- ZMM (Egberts EMTF output)
- JFILE (BIRRP output)
- EMTFXML (Kelbert's format)
- AVG (Zonge output)
- Supports (will support) to/from:
Most people will be using the transfer functions, but a lot of that metadata comes from the time series metadata. This module supports both and has tried to make them more or less seamless to reduce complication.
- Version: 0.3.9
- Free software: MIT license
- Documentation: https://mt-metadata.readthedocs.io.
- Examples: Click the
Binder
badge above and Jupyter Notebook examples are in mt_metadata/examples/notebooks and docs/source/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
Installation
From Source
git clone https://github.com/kujaku11/mt_metadata.git
python setup.py install
You can add the flag -e
if you want to change the code.
PIP
pip install mt_metadata
Conda
conda install mt_metadata
Standards
Each metadata keyword has an associated standard that goes with it. These are stored internally in JSON file. The JSON files are read in when the package is loaded to initialize the standards. Each keyword is described by:
-
type - How the value should be represented based on very basic types
- string
- number (float or integer)
- boolean
-
required - A boolean (True or False) denoting whether the metadata key word required to represent the data.
-
style - How the value should be represented within the type. For instance is the value a controlled string where there are only a few options, or is the value a controlled naming convention where only a 5 character alpha-numeric string is allowed. The styles are
- Alpha Numeric a string with alphabetic and numberic characters
- Free Form a free form string
- Controlled Vocabulary only certain values are allowed according to options
- Date a date and/or time string in ISO format
- Number a float or integer
- Boolean the value can only be True or False
-
units - Units of the value
-
description - Full description of what the metadata key is meant to convey.
-
options - Any options of a Controlled Vocabulary style.
-
alias - Any aliases that may represent the same metadata key.
-
example - An example value to inform the user.
All input values are internally validated according to the definition providing a robust way to standardize metadata.
Each metadata object is based on a Base class that has methods:
- to/from_json
- to/from_xml
- to_from_dict
- attribute_information
And each object has a doc string that describes the standard:
Metadata Key | Description | Example |
---|---|---|
key | description of what the key describes | example value |
Required: False | ||
Units: None | ||
Type: string | ||
Style: controlled vocabulary |
The time series module is more mature than the transfer function module at the moment, and this is still a work in progress.
Example
from mt_metadata import timeseries
x = timeseries.Instrument()
Help
help(x)
+----------------------------------------------+-----------------------------------------------+----------------+
| **Metadata Key** | **Description** | **Example** |
+==============================================+===============================================+================+
| **id** | instrument ID number can be serial number or | mt01 |
| | a designated ID | |
| Required: True | | |
| | | |
| Units: None | | |
| | | |
| Type: string | | |
| | | |
| Style: free form | | |
+----------------------------------------------+-----------------------------------------------+----------------+
| **manufacturer** | who manufactured the instrument | mt gurus |
| | | |
| Required: True | | |
| | | |
| Units: None | | |
| | | |
| Type: string | | |
| | | |
| Style: free form | | |
+----------------------------------------------+-----------------------------------------------+----------------+
| **type** | instrument type | broadband |
| | | 32-bit |
| Required: True | | |
| | | |
| Units: None | | |
| | | |
| Type: string | | |
| | | |
| Style: free form | | |
+----------------------------------------------+-----------------------------------------------+----------------+
| **model** | model version of the instrument | falcon5 |
| | | |
| Required: False | | |
| | | |
| Units: None | | |
| | | |
| Type: string | | |
| | | |
| Style: free form | | |
+----------------------------------------------+-----------------------------------------------+----------------+
Fill in metadata
x.model = "falcon 5"
x.type = "broadband 32-bit"
x.manufacturer = "MT Gurus"
x.id = "f176"
to JSON
print(x.to_json())
{
"instrument": {
"id": "f176",
"manufacturer": "MT Gurus",
"model": "falcon 5",
"type": "broadband 32-bit"
}
}
to XML
print(x.to_xml(string=True))
<?xml version="1.0" ?>
<instrument>
<id>f176</id>
<manufacturer>MT Gurus</manufacturer>
<model>falcon 5</model>
<type>broadband 32-bit</type>
</instrument>
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 (2020-12-30)
- First release on PyPI.
0.1.3 (2021-06-25)
- Added time series filters
- PoleZeroFilter
- CoefficientFilter
- FIRFilter
- TimeDelayFilter
- FrequencyAmplitudePhaseFilter
- Added translations to/from StationXML
- Updated tests
- Fixed minor bugs
- Updated documentation
0.1.5 (2021-11-13)
- Bug fixes
- Updated how units are handled
- If survey.id is None set it to fdsn.network if available (mainly an IRIS DMC fix)
- Updated translation of Experiment to StationXML
- Updated tests
0.1.6 (2021-12-07)
- Bug fixes (mainly in mt_metadata.timeseries.filters)
- Updated tests
- Channel codes are handled "better"
- Updating translation between Experiment and StationXML
- Updated how filters are plotted
- Adding notebooks to documentation
0.1.7 (2022-01-10)
- Updating how transfer functions are handled
- Added readers and metadata standards for
- EDI files
- Z-files
- J-Files
- AVG file
- EMTF XML files
- Added tests for transfer functions
- Updated mt_metadata.transfer_functions.core.TF
- Added documentation on transfer functions
0.1.8 (2022-04-07)
- Bug fixes (mainly in the transfer functions)
- Combined timeseries and transfer_function metadata where similar, so now transfer_function metadata imports from timeseries when applicable. Reduces files and redundancy.
- Updated documentation
0.2.0 (2022-09-10)
- minor bug fixes
- update reading .AVG files
0.2.1 (2023-01-18)
- Update setup.py
- updating reading emtfxml files
- Fix issue 95
- Add model error
- Make sure filter names are unique
- Fix Empty Z file
- Add metadata
- added test for multiple networks in stationxml
- updating to make mth5 work with single metadata object in ChannelTS and RunTS
- added test for null channel component
- Mth5 patch129 fixes
- Update edi.py
- add a line to allow aux channel component to be empty
- Update edi.py
- Mth5 patch129 fixes
0.2.2 (2023-02-17)
- Fixed bug in Station.channels_recorded when a string is input
0.2.3 (2023-04-24)
- Add methods for t0/from transfer function file type
- Update when an np.datetime64 is input
- MTime update to handle nanosecond accuracy
- MTime and pandas Timestamp cannot handle large future or past dates
- Fix input time with
isoformat
attribute - updating if a timedelta is subtracted
- Updates from main into fix_issue_133
- Fix issue #133
- Update EMTFXML ouptut format
- Add FC Metadata
0.3.0 (2023-09-29)
- Fixing Bugs in https://github.com/kujaku11/mt_metadata/pull/138
- adding a merge for TFs in https://github.com/kujaku11/mt_metadata/pull/136
- Fix write EDI bugs in https://github.com/kujaku11/mt_metadata/pull/149
- Use loguru instead of builtin logging in https://github.com/kujaku11/mt_metadata/pull/153
- Loguru in https://github.com/kujaku11/mt_metadata/pull/154
- Try to fix bug with filter assignment in https://github.com/kujaku11/mt_metadata/pull/155
- Empower edi in https://github.com/kujaku11/mt_metadata/pull/158
- TF survey metadata in https://github.com/kujaku11/mt_metadata/pull/159
- added logic for if channel location values are None in https://github.com/kujaku11/mt_metadata/pull/160
- Changes to support writing z-files with channel_nomenclature in https://github.com/kujaku11/mt_metadata/pull/161
- Minor changes to support zfiles tests in https://github.com/kujaku11/mt_metadata/pull/163
- Test aurora issue 295 in https://github.com/kujaku11/mt_metadata/pull/165
- Fcs in https://github.com/kujaku11/mt_metadata/pull/142
- Fcs in https://github.com/kujaku11/mt_metadata/pull/166
- Update environment.yml in https://github.com/kujaku11/mt_metadata/pull/167
- updating documentation in https://github.com/kujaku11/mt_metadata/pull/168
0.3.1 (2023-10-15)
- Minor bug fixes
0.3.2 (2023-11-08)
- remove restriction on Pandas < 2
- minor bug fixes
0.3.3 (2023-11-08)
- update pandas.append to concat
0.3.4 ()
- Update HISTORY.rst by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/179
- Remove filter direction attributes by @kkappler in https://github.com/kujaku11/mt_metadata/pull/181
- Fix issue 173 by @kkappler in https://github.com/kujaku11/mt_metadata/pull/182
- Patch 173 by @kkappler in https://github.com/kujaku11/mt_metadata/pull/183
- Add some common helper functions by @kkappler in https://github.com/kujaku11/mt_metadata/pull/185
- Bug fix in FC layer by @kkappler in https://github.com/kujaku11/mt_metadata/pull/186
- Fix mth5 issue 187 by @kkappler in https://github.com/kujaku11/mt_metadata/pull/187
- bug fixes by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/180
- updating how a TF is initiated, initialize xarray is expensive by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/188
- Change default value of
get_elevation
to False by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/191 - Updating git clone address in the readme by @xandrd in https://github.com/kujaku11/mt_metadata/pull/189
- Fix how Z-files read/write by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/192
- Adjust how TF._initialize_transfer_function is setup by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/193
- Add Ability to store processing configuration in TF by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/196
- Bump version: 0.3.3 → 0.3.4 by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/198
0.3.5 ()
- Patches by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/200
- Fix issue #202 by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/203
- Patches by @kkappler in https://github.com/kujaku11/mt_metadata/pull/205
- Bump version: 0.3.4 → 0.3.5 by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/206
0.3.6 ()
- add method for accessing mag channel names by @kkappler in https://github.com/kujaku11/mt_metadata/pull/210
- Patches by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/208
- Fix mth5 issue 207 by @kkappler in https://github.com/kujaku11/mt_metadata/pull/209
- Minor changes by @kkappler in https://github.com/kujaku11/mt_metadata/pull/211
- Patches by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/212
0.3.7 (2024-08-16)
- Minor fixes numpy 2.0 by @kkappler in https://github.com/kujaku11/mt_metadata/pull/213
- Fix issue 216 by @kkappler in https://github.com/kujaku11/mt_metadata/pull/218
- Patches by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/219
- add u0 and r0 as regression parameters by @kkappler in https://github.com/kujaku11/mt_metadata/pull/220
- Updating EMTF XML and StationXML writers by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/217
- Patches by @kkappler in https://github.com/kujaku11/mt_metadata/pull/221
- Patches by @kkappler in https://github.com/kujaku11/mt_metadata/pull/223
- Bump version: 0.3.6 → 0.3.7 by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/225
0.3.8 (2024-09-30)
- Add pop to ListDict by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/226
- Fix EDI Tipper flip by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/228
- Patches by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/227
- Bump version: 0.3.7 → 0.3.8 by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/229
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mt_metadata-0.3.9.tar.gz
.
File metadata
- Download URL: mt_metadata-0.3.9.tar.gz
- Upload date:
- Size: 4.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b076835dfa7c0ec6f110b91649c215510fb31d82946b85a021af93f54406dd0 |
|
MD5 | ad8a9305a4fbfd3f60e4ec0adf024f48 |
|
BLAKE2b-256 | 680b97f03897319607d7d43298ec97af9c23eb7920cd4b002cb14278a075e947 |
File details
Details for the file mt_metadata-0.3.9-py2.py3-none-any.whl
.
File metadata
- Download URL: mt_metadata-0.3.9-py2.py3-none-any.whl
- Upload date:
- Size: 696.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac06c319ab113f753cc14a5a948b0abbb044516291a9c0129281ea41e6827ab7 |
|
MD5 | e6145960aa07cae2e9746eb1184157e7 |
|
BLAKE2b-256 | 230f893813a93e5c174598c959d7e66c64a1eba9b997e4f3510113a1ec8e1071 |