mth5.clients package
Submodules
mth5.clients.make_mth5 module
Updated on Wed Aug 25 19:57:00 2021
@author: jpeacock + tronan
- class mth5.clients.make_mth5.MakeMTH5(client='IRIS', mth5_version='0.2.0')[source]
Bases:
object
Make an MTH5 file from data archived at IRIS. You will need to know the data you want before hand, and place that into a dataframe with columns
‘network’ –> FDSN Network code
‘station’ –> FDSN Station code
‘location’ –> FDSN Location code
‘channel’ –> FDSN Channel code
‘start’ –> Start time YYYY-MM-DDThh:mm:ss
‘end’ –> End time YYYY-MM-DDThh:mm:ss
From this data frame data will be pulled from IRIS using Obspy tools.
- get_df_from_inventory(inventory)[source]
Create an data frame from an inventory object
- Parameters
inventory (
obspy.Inventory
) – inventory object- Returns
dataframe in proper format
- Return type
pandas.DataFrame
- get_inventory_from_df(df, client=None, data=True)[source]
Get an
obspy.Inventory
object from apandas.DataFrame
- Parameters
df (
pandas.DataFrame
) –DataFrame with columns
’network’ FDSN Network code
’station’ FDSN Station code
’location’ FDSN Location code
’channel’ FDSN Channel code
’start’ Start time YYYY-MM-DDThh:mm:ss
’end’ End time YYYY-MM-DDThh:mm:ss
client (string) – FDSN client
data (boolean, optional) – True if you want data False if you want just metadata, defaults to True
- Returns
An inventory of metadata requested and data
- Return type
obspy.Inventory
andobspy.Stream
Note
If any of the column values are blank, then any value will searched for. For example if you leave ‘station’ blank, any station within the given start and end time will be returned.
- get_unique_networks_and_stations(df)[source]
Get unique lists of networks, stations, locations, and channels from a given data frame.
[{‘network’: FDSN code, “stations”: [list of stations for network]}]
- Parameters
df (
pandas.DataFrame
) – request data frame- Returns
list of network dictionaries with [{‘network’: FDSN code, “stations”: [list of stations for network]}]
- Return type
list
- make_filename(df)[source]
Make a filename from a data frame that is networks and stations
- Parameters
df (
pandas.DataFrame
) – request data frame- Returns
file name as network_01+stations_network_02+stations.h5
- Return type
string
- make_mth5_from_fdsnclient(df, path=None, client=None, interact=False)[source]
Make an MTH5 file from an FDSN data center
- Parameters
df (
pandas.DataFrame
) –DataFrame with columns
’network’ –> FDSN Network code
’station’ –> FDSN Station code
’location’ –> FDSN Location code
’channel’ –> FDSN Channel code
’start’ –> Start time YYYY-MM-DDThh:mm:ss
’end’ –> End time YYYY-MM-DDThh:mm:ss
path (string or
pathlib.Path
, optional) – Path to save MTH5 file to, defaults to Noneclient (string, optional) – FDSN client name, defaults to “IRIS”
- Raises
AttributeError – If the input DataFrame is not properly formatted an Attribute Error will be raised.
ValueError – If the values of the DataFrame are not correct a ValueError will be raised.
- Returns
MTH5 file name
- Return type
pathlib.Path
Note
If any of the column values are blank, then any value will searched for. For example if you leave ‘station’ blank, any station within the given start and end time will be returned.