[obspy-users] Seismic data format conversion

Lion Krischer krischer at geophysik.uni-muenchen.de
Thu Oct 13 17:27:09 CEST 2016



> for tr in st2:
>     stats = {'network': N[i], 'station': St[i], 'location':
> '','channel': C[i], 'npts': 30000,
>     'sampling_rate': 1000,    'mseed': {'dataquality': 'D'}}
>     i = i+1
>     tr = Stream([Trace(data=tr.data, header=stats)])
>     tr.write(str(i)+'.MSEED',format='MSEED')
>     print tr

The stats are all the metadata - you do not copy the time information
from one to the next.


Just replace

>>> tr = Stream([Trace(data=tr.data, header=stats)])

with

>>> tr.stats.update(stats)


as proposed before and everything should work fine.

Also best remove the `sampling_rate` key from the dictionary one just
use the one in the existing stats dictionary.


Cheers!

Lion


More information about the obspy-users mailing list