obspy / obspy

ObsPy: A Python Toolbox for seismology/seismological observatories.
https://www.obspy.org
Other
1.17k stars 536 forks source link

Waveform conversion problems #50

Closed trac2github closed 12 years ago

trac2github commented 12 years ago

test.py: {{{ from obspy.core import read import sys

st = read("http://examples.obspy.org/gaps.mseed") tr = st[0] tr.write("gaps1.asc", format=sys.argv[1]) }}}

Executing tests: {{{ for FORMAT in MSEED SAC GSE2 SH_ASC Q WAV; do python ./test.py $FORMAT; done

Traceback (most recent call last): File "./test.py", line 6, in tr.write("gaps1.asc", format=sys.argv[1]) File "/home/moritz/research/ffb/obspy/obspy.core/trunk/obspy/core/trace.py", line 409, in write Stream([self]).write(filename, format, _kwargs) File "/home/moritz/research/ffb/obspy/obspy.core/trunk/obspy/core/stream.py", line 597, in write writeFormat(self, filename, _kwargs) File "/home/moritz/research/ffb/obspy/obspy.mseed/trunk/obspy/mseed/core.py", line 188, in writeMSEED raise Exception(msg) Exception: Unsupported data type int32 Traceback (most recent call last): File "./test.py", line 6, in tr.write("gaps1.asc", format=sys.argv[1]) File "/home/moritz/research/ffb/obspy/obspy.core/trunk/obspy/core/trace.py", line 409, in write Stream([self]).write(filename, format, _kwargs) File "/home/moritz/research/ffb/obspy/obspy.core/trunk/obspy/core/stream.py", line 597, in write writeFormat(self, filename, _kwargs) File "/home/moritz/research/ffb/obspy/obspy.sac/trunk/obspy/sac/core.py", line 132, in writeSAC trace.stats.sac.setdefault('nvhdr', 1) File "/home/moritz/research/ffb/obspy/obspy.core/trunk/obspy/core/util.py", line 60, in getitem return super(AttribDict, self).getitem(name) KeyError: 'sac' Traceback (most recent call last): File "./test.py", line 6, in tr.write("gaps1.asc", format=sys.argv[1]) File "/home/moritz/research/ffb/obspy/obspy.core/trunk/obspy/core/trace.py", line 409, in write Stream([self]).write(filename, format, _kwargs) File "/home/moritz/research/ffb/obspy/obspy.core/trunk/obspy/core/stream.py", line 597, in write writeFormat(self, filename, _kwargs) File "/home/moritz/research/ffb/obspy/obspy.sh/trunk/obspy/sh/core.py", line 202, in writeASC for key, value in trace.stats.get('sh', []).iteritems(): AttributeError: 'list' object has no attribute 'iteritems' Traceback (most recent call last): File "./test.py", line 6, in tr.write("gaps1.asc", format=sys.argv[1]) File "/home/moritz/research/ffb/obspy/obspy.core/trunk/obspy/core/trace.py", line 409, in write Stream([self]).write(filename, format, _kwargs) File "/home/moritz/research/ffb/obspy/obspy.core/trunk/obspy/core/stream.py", line 597, in write writeFormat(self, filename, _kwargs) File "/home/moritz/research/ffb/obspy/obspy.sh/trunk/obspy/sh/core.py", line 428, in writeQ for key, value in trace.stats.get('sh', []).iteritems(): AttributeError: 'list' object has no attribute 'iteritems' }}}

That is we have a major problem converting files. Most of the cases assume format specific attributes. We need test cases like this in our default tests.

trac2github commented 12 years ago

[beyreuth] Fixed with revision r1011.