mth5.utils package

Submodules

mth5.utils.exceptions module

Exceptions raised by MTH5

Created on Wed May 13 19:07:21 2020

@author: jpeacock

exception mth5.utils.exceptions.MTH5Error[source]

Bases: Exception

exception mth5.utils.exceptions.MTH5TableError[source]

Bases: Exception

exception mth5.utils.exceptions.MTSchemaError[source]

Bases: Exception

exception mth5.utils.exceptions.MTTSError[source]

Bases: Exception

exception mth5.utils.exceptions.MTTimeError[source]

Bases: Exception

mth5.utils.fdsn_tools module

Tools for FDSN standards

Created on Wed Sep 30 11:47:01 2020

author

Jared Peacock

license

MIT

mth5.utils.fdsn_tools.get_location_code(channel_obj)[source]

Get the location code given the components and channel number

Parameters

channel_obj (Channel) – Channel object

Returns

2 character location code

Return type

string

mth5.utils.fdsn_tools.get_measurement_code(measurement)[source]

get SEED sensor code given the measurement type

Parameters

measurement (string) – measurement type, e.g. * temperature * electric * magnetic

Returns

single character SEED sensor code, if the measurement type has not been defined yet Y is returned.

Return type

string

mth5.utils.fdsn_tools.get_orientation_code(azimuth, orientation='horizontal')[source]

Get orientation code given angle and orientation. This is a general code and the true azimuth is stored in channel

Parameters

azimuth (float) – angel assuming 0 is north, 90 is east, 0 is vertical down

Returns

single character SEED orientation code

Return type

string

mth5.utils.fdsn_tools.get_period_code(sample_rate)[source]

Get the SEED sampling rate code given a sample rate

Parameters

sample_rate (float) – sample rate in samples per second

Returns

single character SEED sampling code

Return type

string

mth5.utils.fdsn_tools.make_channel_code(channel_obj)[source]

Make the 3 character SEED channel code

Parameters

channel_obj (Channel) – Channel metadata

Returns

3 character channel code

Type

string

mth5.utils.fdsn_tools.make_mt_channel(code_dict, angle_tol=15)[source]
Parameters

code_dict (TYPE) – DESCRIPTION

Returns

DESCRIPTION

Return type

TYPE

mth5.utils.fdsn_tools.read_channel_code(channel_code)[source]

read FDSN channel code

Parameters

channel_code (TYPE) – DESCRIPTION

Returns

DESCRIPTION

Return type

TYPE

mth5.utils.helpers module

mth5.utils.helpers.get_compare_dict(input_dict)[source]

Helper function for removing 2 added attributes to metadata

  • hdf5_reference

  • mth5_type

Parameters

input_dict (TYPE) – DESCRIPTION

Returns

DESCRIPTION

Return type

TYPE

mth5.utils.helpers.initialize_mth5(h5_path, mode='a', file_version='0.1.0')[source]

mth5 initializer for the case of writting files.

Parameters
  • h5_path (string or pathlib.Path) – path to file

  • mode (string) –

    how to open the file, options are

    • ”r”: read

    • ”w”: write

    • ”a”: append

Returns

mth5 object

Return type

mth5.MTH5

mth5.utils.helpers.read_back_data(mth5_path, station_id, run_id, survey=None, close_mth5=True, return_objects=[])[source]

Testing helper function, used to confirm that the h5 file can be accessed and that the data size is as expected.

Parameters
  • mth5_path (Path or string) – the full path the the mth5 that this method is going to try to read

  • station_id (string) – the label for the station, e.g. “PKD”

  • run_id (string) – The label for the run to read. e.g. “001”

  • survey (string) – The label for the survey associated with the run to read.

  • close_mth5 (bool) – Whether or not to close the mth5 object after reading

  • return_objects – List of strings. Specifies what, if anything to return.

Allowed values: [“run”, “run_ts”] :type return_objects: List of strings. :return: run object :rtype: mth5.groups.RunGroup :return: run time series :rtype: mth5.timeseries.RunTS

mth5.utils.mth5_logger module

Module contents