Checking readability of mseed files

Hi All,
I am reading in a large number of mseed files for some analysis taking several hours, and have trouble with bad mseed files that obspy can’t read. Every time obspy encounters an unreadable mseed file, my script crashes, and I have to re-start the analysis from scratch after removing them. This is very time consuming. I was wondering if anyone has figured out a way to first figure out bad mseed files, i.e. the ones that obspy can’t read (or crashes on), and remove them in a pre-processing step? Once I get rid of these files, I can directly run the anlysis without any interruption.

I tried python -m obspy.io.mseed.scripts.recordanalyzer (Thanks Tobias!) but this doesn’t do the job I want. I also tried to figure this out with get_flags(), but that too isn’t helpful. All I want is to figure out whether obspy can (or not) read an mseed file without crashing.

Thanks very much!

Januka

Januka Attanayake

Research Fellow | Earthquake Seismology
Homepage: https://sites.google.com/site/janukaattanayake

School of Earth Sciences | McCoy Bldg. 200
University of Melbourne | Parkville 3010 VIC
Australia

Pleas open an issue on Github and attach one of the files that makes
ObsPy crash on your computer. This should not happen. If anything else
than a "read()" command is needed to reproduce the crash, please add a
minimal code example.

best,
Tobias

Hi Tobias,
Thanks. The file is 70+ MB after zipping. Thus, unless there’s a convenient way to upload it, I’ll have to slip this one through knowing that the file has a bad blockette. I received instructions for a workaround from Richard Sanderson at UCSB through the list.

Januka

Januka Attanayake

Research Fellow | Earthquake Seismology
Homepage: https://sites.google.com/site/janukaattanayake

School of Earth Sciences | McCoy Bldg. 200
University of Melbourne | Parkville 3010 VIC
Australia

Pleas open an issue on Github and attach one of the files that makes
ObsPy crash on your computer. This should not happen. If anything else
than a “read()” command is needed to reproduce the crash, please add a
minimal code example.

best,
Tobias

Hi Januka,

please still open an issue if the program crashes (as opposed to an
exception being raised gracefully), and use your preferred file sharing
application to give us access to the file. Just let me know if you dont
use any file sharing you can upload this to I can set something up.

Tobias

As ObsPy uses libmseed to read miniSEED files, a straightforward way to check the input data is to use the ‘msview’ utility. It is part of the libmseed distribution, though somewhat hidden in the ‘example’ directory. If libmseed cannot read the file it is most probably corrupt and you will know before you upload 70 MB of data.

Regards
Joachim

Thanks Joachim,
I was able to write a simple try: except: loop as Richard suggested. That was good enough for my situation. I will try to upload the file soon.

Januka

Januka Attanayake

Research Fellow | Earthquake Seismology
Homepage: https://sites.google.com/site/janukaattanayake

School of Earth Sciences | McCoy Bldg. 200
University of Melbourne | Parkville 3010 VIC
Australia