[obspy-users] Checking readability of mseed files (Januka Attanayake)

Januka Attanayake jattanayake at yahoo.com
Mon Jul 22 03:43:30 CEST 2019


Thanks Derrick, this is exactly what I ended up doing following Richard's comments. 
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
 

    On Wednesday, July 17, 2019, 04:08:29 PM GMT+10, Derrick Chambers <djachambeador at gmail.com> wrote:  
 
 Hi Januka,
You could simply loop through the files and try to read each one. If it fails, append the file name to a list and continue. At the end you can quarantine (move) the bad files. 
Something like this:
```pythonfrom pathlib import Path
import obspy
bad_files = []
for path in Path('path/to/your/files').rglob('*'):    try:        obspy.read(str(path), format='mseed')    except:        bad_files.append(path)
# ... do something with bad files```
Derrick
On Tue, Jul 16, 2019 at 3:01 AM <obspy-users-request at lists.swapbytes.de> wrote:

Send obspy-users mailing list submissions to
        obspy-users at lists.swapbytes.de

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.swapbytes.de/mailman/listinfo/obspy-users
or, via email, send a message with subject or body 'help' to
        obspy-users-request at lists.swapbytes.de

You can reach the person managing the list at
        obspy-users-owner at lists.swapbytes.de

When replying, please edit your Subject line so it is more specific
than "Re: Contents of obspy-users digest..."


Today's Topics:

   1. Checking readability of mseed files (Januka Attanayake)


----------------------------------------------------------------------

Message: 1
Date: Tue, 16 Jul 2019 06:01:11 +0000 (UTC)
From: Januka Attanayake <jattanayake at yahoo.com>
To: Obspy-users <obspy-users at lists.swapbytes.de>
Subject: [obspy-users] Checking readability of mseed files
Message-ID: <2084428003.1825828.1563256871481 at mail.yahoo.com>
Content-Type: text/plain; charset="utf-8"

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.swapbytes.de/pipermail/obspy-users/attachments/20190716/f9be100c/attachment-0001.html>

------------------------------

_______________________________________________
obspy-users mailing list
obspy-users at lists.swapbytes.de
https://lists.swapbytes.de/mailman/listinfo/obspy-users

End of obspy-users Digest, Vol 104, Issue 2
*******************************************

_______________________________________________
obspy-users mailing list
obspy-users at lists.swapbytes.de
https://lists.swapbytes.de/mailman/listinfo/obspy-users  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.swapbytes.de/pipermail/obspy-users/attachments/20190722/5d18abd8/attachment-0001.html>


More information about the obspy-users mailing list