BAZ attribute in SAC header

Dear all,

I use obspy 1.0.1.

I have a SAC-file (attached) and stla, stlo, etc. is set, so I can access the dist, az and baz values in SAC using the list header command without problems.

Reading the same file then with obspy, the command:

print( stream[0].stats.sac.baz )


in getattr
raise AttributeError(e.args[0])
AttributeError: baz

nvhdr, leven, iftype and lcalda are properly set.

Why is the baz attribute not available in the obspy module, althought in SAC everything is as usual?

This question goes in the direction, what is the cleanest way to set SAC header attributes in obspy when the orignal file was, let’s say, mseed?

Thank you very much in advance for suggestions.


XX.LSo1.00.SHX (1.19 MB)

Hi John,

The default behavior for reading SAC has files changed with 1.0. Only headers that are defined in the SAC header are carried to the stats.sac dictionary. If you’d like all headers to, regardless of whether they are set, use the “debug_headers=True” keyword during the read.