mth5.data.station_config
This module contains tools for building MTH5 files from synthetic data.
- Development Notes:
These tools are a work in progress and ideally will be able to yield
generalize to more than just the legacy EMTF ascii datasets that they initially served.
Definitions used in the creation of synthetic mth5 files.
Survey level: ‘mth5_path’, Path to output h5
- Station level: mt_metadata Station() object with station info.
the id field (name of the station) is required.
other station metadata can be added
channel_nomenclature - The channel_nomenclature was previously stored at the run level. It makes more sense to store
this info at the station level, as the only reason the nomenclature would change (that I can think of) would be if the acquistion system changed, in which case it would make the most sense to initialize a new station object.
Run level: ‘columns’, :channel names as a list; [“hx”, “hy”, “hz”, “ex”, “ey”] Run level: ‘raw_data_path’, Path to ascii data source Run level: ‘noise_scalars’, dict keyed by channel, default is zero, Run level: ‘nan_indices’, iterable of integers, where to put nan [ Run level: ‘filters’, dict of filters keyed by columns Run level: ‘run_id’, name of the run Run level: ‘sample_rate’, 1.0
Attributes
Classes
Place to store information that will be needed to initialize and MTH5 Run object. |
|
Class used to contain information needed to generate MTH5 file from synthetic data. |
|
This class can be used to interact with the legacy synthetic data files |
Functions
|
Creates a collection of filters |
|
This method prepares the metadata needed to generate an mth5 with syntheric data. |
|
Just like station 1, but the data are different |
|
Create a synthetic station with multiple runs. Rather than generate fresh |
|
Just like station 01, but data are resampled to 8Hz |
|
Module Contents
- mth5.data.station_config.make_filters(as_list: bool | None = False) dict | list[source]
Creates a collection of filters
- Because the synthetic data from EMTF are already in mV/km and nT, no calibration filters are required.
The filters here are placeholders to show where instrument response function information would get assigned.
- Parameters:
as_list (bool) – If True we return a list, False return a dict
- Return filters_list:
Filters for populating the filters lists of synthetic data
- Rtype filters_list:
Union[List, Dict]
- class mth5.data.station_config.SyntheticRun(id: str, sample_rate: float, channels: List[str], raw_data_path: str | pathlib.Path | None = None, noise_scalars: dict | None = None, nan_indices: dict | None = None, filters: dict | None = None, start: str | None = None, timeseries_dataframe: pandas.DataFrame | None = None, data_source: str = 'legacy emtf ascii')[source]
Bases:
objectPlace to store information that will be needed to initialize and MTH5 Run object.
Initially this class worked only with the synthetic ASCII data from legacy EMTF.
- class mth5.data.station_config.SyntheticStation(station_metadata: mt_metadata.timeseries.Station, mth5_name: str | pathlib.Path | None = None, channel_nomenclature_keyword: mt_metadata.processing.aurora.channel_nomenclature.SupportedNomenclatureEnum = SupportedNomenclatureEnum.default)[source]
Bases:
objectClass used to contain information needed to generate MTH5 file from synthetic data.
- TODO: could add channel_nomenclature to this obj (instead of run) but would need to decide that
runs cannot change channel nomenclature first. If that were decided, the channel_map() could go here as well.
- mth5.data.station_config.make_station_01(channel_nomenclature: mt_metadata.processing.aurora.channel_nomenclature.SupportedNomenclatureEnum = SupportedNomenclatureEnum.default) SyntheticStation[source]
This method prepares the metadata needed to generate an mth5 with syntheric data.
- Parameters:
channel_nomenclature (str) – Must be one of the nomenclatures defined in SupportedNomenclatureEnum
- Returns:
Object with all info needed to generate MTH5 file from synthetic data.
- Return type:
- mth5.data.station_config.make_station_02(channel_nomenclature: mt_metadata.processing.aurora.channel_nomenclature.SupportedNomenclatureEnum = SupportedNomenclatureEnum.default) SyntheticStation[source]
Just like station 1, but the data are different
- Parameters:
channel_nomenclature (SupportedNomenclatureEnum) – Must be one of the nomenclatures defined in SupportedNomenclatureEnum
- Returns:
Object with all info needed to generate MTH5 file from synthetic data.
- Return type:
- mth5.data.station_config.make_station_03(channel_nomenclature: mt_metadata.processing.aurora.channel_nomenclature.SupportedNomenclatureEnum = SupportedNomenclatureEnum.default) SyntheticStation[source]
Create a synthetic station with multiple runs. Rather than generate fresh synthetic data, we just reuse test1.asc for each run.
- Parameters:
channel_nomenclature (SupportedNomenclatureEnum) – Literal, Must be one of the nomenclatures defined in “channel_nomenclatures.json”
- Return type:
- Returns:
Object with all info needed to generate MTH5 file from synthetic data.
- mth5.data.station_config.make_station_04(channel_nomenclature: mt_metadata.processing.aurora.channel_nomenclature.SupportedNomenclatureEnum = SupportedNomenclatureEnum.default) SyntheticStation[source]
Just like station 01, but data are resampled to 8Hz
- Parameters:
channel_nomenclature (SupportedNomenclatureEnum) – Literal, Must be one of the nomenclatures defined in “channel_nomenclatures.json”
- Return type:
- Returns:
Object with all info needed to generate MTH5 file from synthetic data.
- class mth5.data.station_config.LegacyEMTFAsciiFile(file_path: pathlib.Path)[source]
This class can be used to interact with the legacy synthetic data files that were originally in EMTF.
- Development Notes:
As of 2025-02-03 the only LegacyEMTFAsciiFile date sources are sampled at 1Hz. One-off upsampling can be handled in this class if the requested sample rate differs.
- load_dataframe(channel_names: list, sample_rate: float) pandas.DataFrame[source]
Loads an EMTF legacy ASCII time series into a dataframe.
- These files have an awkward whitespace separator, and also need to have the
electric field channels inverted to fix a phase swap.
- Parameters:
channel_names (list) – The names of the channels in the legacy EMTF file, in order.
sample_rate (float) – The sample rate of the output time series in Hz.
- Return df:
The labelled time series from the legacy EMTF file.
- Rtype df:
pd.DataFrame