Skip to content

Using Obspy to load data into PH5

Derick Hess edited this page Mar 14, 2019 · 14 revisions

Introduction

PH5 natively supports common data loggers in use by the IRIS PASSCAL facility. These include reftek 125a and 130, Q330, Geodes, and Fairfield 1 channel and 3 channel nodal instruments. As has grown it has become important to allow community members to easily import their own data in to PH5.

To accomplish this, two new packages were developed: metadatatoph5 and obspytoph5. Using these two packages, allows for the easy ingestion of new data types.

Getting your metadata in to PH5

The easiest way to ingest metadata in to PH5 for a custom data source is to use stationXML. Creating stationXML allows you to load all the necessary metadata and response information into PH5 at one time.

A few things to note: PH5 works based on datalogger serial number, so in your stationxml a datalogger serial number will be required in order to load waveform data into PH5. Second, PH5 fundamentally works at the channel level. In your stationXML it is advisable to put lat, lon, and elevation for each channel. Metadatatoph5 though will use assume station lat, lon and elevation for associated channels in the case channel locations are not present.

PASSCAL provides a tool called Nexus that can be used to edit stationXML. Nexus is also capable of grabbing RESP files from the IRIS Nominal Response Library and calculating responses if your instrumentation is in the NRL.

Once you have a valid stationXML file describing the data you would like to load, it can be loaded using metadatatoph5 from the command line metadatatoph5 -n master.ph5 -f <file-name>. If you do not have a PH5 archive master.ph5 yet, this program will create one for you.

As an example we will load a simple stationxml file describing a single station and channel in to PH5. This PH5 loaded with metadata will be used later in the tutorial to load custom waveform data described by this stationxml.

For Developers

metadatatoph5 can also be used as a module in your own applications to load an obspy inventory object in to PH5. An example on how to do this will be provided here soon

Getting your data in to PH5:

Using the obspytoph5 package in your own software allows you to load obspy streams into PH5, provided the metadata already exists in PH5. Below will show a simple example of creating an obspy stream with data from a text file and loading it in to PH5.