[obspy-users] Stats for miniseed and Endtime Questions

gonzalo antonio fernandez marañon tonino.gafm at gmail.com
Tue Dec 29 22:32:10 CET 2015


Dear Comunity

I would like to share with you a small script to convert from ascii
one colum data to miniseed.

from __future__ import print_function
import os
import csv
import numpy as np
from obspy.core import Stream, Trace, UTCDateTime, read
os.chdir("E:\Evento-21-12-2015")
path='SIVLP_z.ascii'
with open(path) as f:
    reader = csv.reader(f, delimiter="\n")
    d = list(reader)
d_np = np.loadtxt(path, delimiter="\n")
tr=Trace()
tr.data=d_np
stats = {'network': 'BO', 'station': 'SIV', 'location': '',
         'channel': 'LPZ', 'npts': len(d_np), 'sampling_rate': 4.0,
         'starttime':'2015-12-21T16:20:00.000',
         'mseed': {'dataquality': 'D'}}
s_sivN=Stream([Trace(data=d_np,header=stats)])
s_sivN.write("SIVLP_Z.mseed",format="MSEED")

It converts ok the data to miniseed, when I type

ll=read('SIVLP_Z.mseed')
print ll

1 Trace(s) in Stream:
BO.SIV..LPZ | 2015-12-21T16:20:00.000000Z -
2015-12-21T16:29:59.750000Z | 4.0 Hz, 2400 samples

All ok..

But then while I am typing

ll.stats

Traceback (most recent call last):
  File "<pyshell#19>", line 1, in <module>
    print ll.stats
AttributeError: 'Stream' object has no attribute 'stats'

I do not have the stats...What am I doing wrong?

Thank you a lot for your time and help.

Best Regards.
Gonzalo F


More information about the obspy-users mailing list