Help reading wfdisc/css data files

Hello ObsPy Forum,

I’m trying to load/read wfdisc/css format data so I can convert them to an easier to manipulate format (e.g., sac) for subsequent Earthworm ingestion/processing. I’ve tried following the wfdisc table format specified in this link but I’m getting some cryptic “KeyError” messages (see below). Can anyone provide some guidance or suggestions regarding reading these data? I’m relatively new to ObsPy so perhaps it’s something obvious. I’m also looking at using Pisces but no luck so far. I’ve uploaded a working example here. Any help would be greatly appreciated.

Many thanks,

Traceback (most recent call last):
File “”, line 1, in
File “/opt/miniconda3/lib/python3.12/site-packages/”, line 232, in fun
return caller(func, *(extras + args), **kw)
File “/opt/miniconda3/lib/python3.12/site-packages/obspy/core/util/”, line 297, in _map_example_filename
return func(*args, **kwargs)
File “/opt/miniconda3/lib/python3.12/site-packages/obspy/core/”, line 208, in read
st = _generic_reader(pathname_or_url, _read, **kwargs)
File “/opt/miniconda3/lib/python3.12/site-packages/obspy/core/util/”, line 658, in _generic_reader
generic = callback_func(pathnames[0], **kwargs)
File “/opt/miniconda3/lib/python3.12/site-packages/”, line 232, in fun
return caller(func, *(extras + args), **kw)
File “/opt/miniconda3/lib/python3.12/site-packages/obspy/core/util/”, line 208, in uncompress_file
result = func(filename, *args, **kwargs)
File “/opt/miniconda3/lib/python3.12/site-packages/obspy/core/”, line 249, in _read
stream, format = _read_from_plugin(‘waveform’, filename, format=format,
File “/opt/miniconda3/lib/python3.12/site-packages/obspy/core/util/”, line 423, in _read_from_plugin
list_obj = read_format(filename, **kwargs)
File “/opt/miniconda3/lib/python3.12/site-packages/obspy/io/css/”, line 129, in _read_css
dtype = DTYPE[line[143:145]]


KeyError: b’ s’

Your file seems garbled. CSS/WFDISC is fixed format and it’s trying to read the compression type there and it gets ' s' and when you look in the file there’s 's4' there which seems to be the compression type but it’s one column off. So there seem to be issues with the placement of columns in the file.

You can compare with example data under tests/data and the specs under docs/ in our repo:

Hello Tobias,

Many apologies for the super late response. Mahalo nui loa for your quick reply and the useful tips. Pointing me to the tests/data folder in your repo helped as I was able to use the example wfdisc table in tests/data to subtly modify my table and I could then load a few data files without read errors. I think there may be problems with some of the info in my fields because the data look nonsensical when I try to plot them. I will continue to investigate. Also, I was able to write to sac format (both the test data and my files), which is my short-term goal for subsequent analysis. Yay! Thanks again and please stay tuned as I may have some additional questions.