ah files

Hi all,

I have tried to read a file in AH format with obspy.core.stream.read. If I don’t specify the format, I get the error “Unknown format for file”. If I specify the format, the error says it cannot open the file.

Does anyone usually use AH files with obspy? Although it is an old file of mine, I don’t have any particular reason to think that the file is corrupted.

I am attaching the file, perhaps someone can give a try.



test.ah (1.65 MB)

Hi Laura,

are you running the latest ObsPy version 1.1.0? If yes, can you please open an issue on GitHub and send us the file so we can have a look.



worked for me


from obspy.io.ah.core import _read_ah


Thanks for answering.

I was not running 1.1.0, but I have now updated and the issue is still there.

I tried as Kalil showed, but in that case (as also showed by him) there are not traces in stream… so it is not really working.

I will open an issue on GitHub soon.


Hi Laura,

yes, please open an issue on GitHub.
On a first glance (I don't know much about the AH module), it seems that
your file is not AH v2 as it should have some magic number in the first
bytes of the file. Furthermore, it seems that our "is AH v1"-code
expects some information on following string header field lengths in
places where your file only has null-strings. So we need to check in
more detail what's up with this file.. whether it's a valid AH file and
our reader fails, or whether it's a malformed file..


Thanks for these details, Tobias.
I have a bunch of these files that I used to open with an old homemade software. Unfortunatly I don’t have access to this software anymore. It is also plausible that the way I was “taught” to build these ah files was specific for that software. I will try to find out more and open the the issue.