Unknown blockette length for type ...

Hi all,

I’m coming to you with a special problem that is not caused by Obspy, however, I was hoping you could still help me out.

We got several years of mseed data from our Antarctic station that we currently cannot use. When reading the files, the following error is thrown:

msr_unpack(_WA0__BHN_D): Unknown blockette length for type 341

and occasionally also:

msr_unpack(_WA0__BHN_D): Unknown blockette length for type 597

Obviously, this a blockette problem. This happens with Obspy, SEISAN, Antilope, SAC (error 1301 no data …) but not in PQL II. We also tried the MSEEDINFO tool without any errors thrown. The tool used to write the files was somewhat self-made, but apparently based on PIZZA. If it helps, I use Obspy1.1.0. installed via conda (python2).

I attached a file. Any ideas how to repair this? Would be much appreciated including a beer at the next conference! :slight_smile:



VNA2_2007_164.BHN (5.76 MB)

The things we do for beer…

It was kind of a curious issue so I dug into it. Attached is a simple script that fixes this particular error (will only work for files with the same record length and blockettes per record).

The problem was that the last blockette in each record pointed to another blockette (blockettes build up a chain which has to be followed to get all of them). It always pointed to the beginning of the data which I guess would make it fairly easy to detect this type of error automatically. Thus it interpreted the beginning of data as another record and kept jumping around the file to find the next blockette which would point to another next blockette…

The attached script zeros the pointer to the next blockette for the final blockette in each record and ObsPy can then read the file.

If this becomes a more common issue we’ll add some autodetection to ObsPy to discover that. Until then its just an invalid file and not ObsPy’s responsibility.



fix_funky_file.py (916 Bytes)