using obspy-scan with Reftek data

Hi,

I have a directory tree with raw data copied from a Reftek RT130. I want to make some simple plots of the data holdings for this station over monthly timescales using obspy-scan. However, that script doesn’t know how to read the Reftek data format. Has anyone worked around this, perhaps leveraging the obspy.io.reftek read library?

Thanks,
Brian

Hi Brian,

Reftek support will be in upcoming release 1.1.0, but it's not yet in
1.0.3. So either you switch to master for now, or wait a few more days
for 1.1.0.

cheers,
T

Thanks! I’ll wait a few days and upgrade to the newest version.

I updated obspy to the new version. Now obspy-scan recognizes the data as Reftek, but it fails with the following error:

UserWarning: Encountered some packets of types that are not implemented yet (types: [‘AD’, ‘CD’, ‘DS’, ‘FD’, ‘OM’, ‘SC’, 'SH’])

I figured it out. Turns out I had to specify wildcards for each subdirectory as follows:

obspy-scan 2017/2017*/AD10/1/*

Instead of:

obspy-scan 2017/2017*

Hi Brian,

what you showed was a warning that shows up when reading Reftek130 files
that contain packet types the are not implemented yet. Mostly that would
be special metadata on the waveforms (calibration, triggers etc), see
the included manual if you're interested in details ("Packet
Description", pg. 7 and following):
https://github.com/obspy/obspy/blob/master/obspy/io/reftek/docs/130_record.pdf

However, even if the warning shows, obspy-scan should still not error
out but continue. Let me know if it doesn't.

So the catch all wildcard should still work (even if it might show lots
of warnings). But yes, if those warnings annoy you, just running on the
data subfolder ".../1/" is probably a good idea. On the other hand if
you're scared of missing data with too specific wildcards during the
reading you could suppress those warning messages by doing the scan in a
tiny python script like:

"""
import warnings
from obspy.imaging.scripts.scan import scan

with warnings.catch_warnings():
    warnings.filterwarnings(
        action='ignore', message=r'No event trailer \(ET\) packets',
        category=UserWarning)
    warnings.filterwarnings(
        action='ignore',
        message='Encountered some packets of types that are not '
                'implemented yet',
        category=UserWarning)
    scan(paths=['/path/to/your/data'], plot=True)
"""

cheers,
T

Hi Tobias,

Thanks for the tips. I tried to make day plots from files taken off the Reftek, but it failed with an error that reads: ValueError: All traces need to be of the same id for a dayplot

from obspy import read
st = read("2017/2017231/AD10/1/*”)

st.plot(type=“dayplot”)

If I remove the type="dayplot” part, it successfully plots a normal time series with no errors.

According to the source code for obspy.imaging.waveform, the ValueError refers to len(self.stream) != 1. Do I need to merge the packet files somehow before trying to plot?

Thanks,
Brian

Hi Brian,

according to the error message you get, you have more than one SEED ID
in the data you read. I would suspect that you have all three (or even
more) components in there, since Reftek stores them next to each other
in the same directory. You probably just want to select the "Z"
component (or one of the horizontals). Since you didn't specify
'component_codes' to 'read()' (see obspy.io.reftek.core._read_reftek130
docs), you likely have components '0', '1', '2'. So something like this
should work.. (depends on you sensor/setup, but usually first channel
'0' should be Z)

from obspy import read
st = read("2017/2017231/AD10/1/*”)
st.select(component='0').plot(type="dayplot")

cheers,
T

That’s the trick I was missing. Now it works. Thanks!