Hi all,
I have some error whe opening some CSS files, when data dtype is “i4” in data header of waveform data file.
I have installed obspy version 0.9.2 on Windows 7 64-bit.
First of all, error raises KeyError:
KeyError Traceback (most recent call last)
in ()
----> 1 readCSS(filename)
C:\Anaconda\lib\site-packages\obspy-0.9.2-py2.7-win32.egg\obspy\css\core.py in readCSS(filename, **kwargs)
95 filename = os.path.join(basedir, dirname, filename)
96 offset = int(line[246:256])
—> 97 dtype = DTYPE[line[143:145]]
98 fmt = “>” + dtype * npts
99 with open(filename, “rb”) as fh:
KeyError: ‘i4’
Looked at core.py file, and changed DTYPE to
DTYPE = {
Big-endian integers
b’s4’: b’>i’,
b’s2’: b’>h’,
Little-endian integers
b’i4’: b’<i’,
b’i2’: b’<h’,
ASCII integers
b’c0’: (b’S12’, np.int),
b’c#’: (b’S12’, np.int),
Big-endian floating point
b’t4’: b’>f’,
b’t8’: b’>d’,
Little-endian floating point
b’f4’: b’<f’,
b’f8’: b’<d’,
ASCII floating point
b’a0’: (b’S15’, np.float32),
b’a#’: (b’S15’, np.float32),
b’b0’: (b’S24’, np.float64),
b’b#’: (b’S24’, np.float64),
}
(from dev-version of obspy?)
raises error:
error Traceback (most recent call last)
in ()
----> 1 readCSS(filename)
C:\Anaconda\lib\site-packages\obspy-0.9.2-py2.7-win32.egg\obspy\css\core.py in readCSS(filename, **kwargs)
99 with open(filename, “rb”) as fh:
100 fh.seek(offset)
–> 101 size = struct.calcsize(fmt)
102 data = fh.read(size)
103 data = struct.unpack(fmt, data)
error: bad char in struct format
Dont’ know what to do, hoping for response.