Obspy 1.0.0 sac header issues

Hi,

I am finally getting around (being forced) to change a set of scripts to adjust to the latest updates to obspy and came across a number of issues.

The first issue has been discussed in February 2016, and is related to setting sac-header location fields (stla, stlo, evla, evlo). Initially, all these items have values of -12345 (this is a SAC default for unset header values). When I set one of the items, say stlo, it appears that obspy tries to compute the distance and azimuth using the existing -12345 values, which throws an exception from the distance-azimuth calculation (‘out of bounds’, because -12345 is not in the geographic range). Unless you are handling/suppressing the exception, it can toss you out of the current section of your code.

To work around that problem/feature, set lcalda = False, set the location fields and then set lcalda = True. I am not sure rushing off to compute the distance and azimuth is the right thing to do in a header access implementation unless none of the key lats and lons equal -12345. This could be checked in the code if you want to keep the current approach. Or, am I missing something?

Also, I am perplexed by why i cannot store a value in the ‘evdp’ header field. The documentation states that this is “not used”, but it is an essential piece of the header. From the documentation:

"Event depth below surface (meters). [not currently used]"

http://docs.obspy.org/packages/autogen/obspy.io.sac.sactrace.SACTrace.html#obspy.io.sac.sactrace.SACTrace

If I don’t store an earthquake depth in ‘evdp’ where is depth information supposed to be stored? What am I missing here?

Chuck Ammon

================================i====================================
Charles J. Ammon, Department of Geosciences
Penn State University / 440 Deike Bldg / University Park, PA 16802
VOICE: (814) 865 2310 / FAXES: (814) 863 7823 or (814) 863 8724
http://eqseis.geosc.psu.edu/~cammon/
http://www.personal.psu.edu/faculty/c/j/cja12/

Hi Chuck,

we are aware of all these issue and most are already fixed. We will
release ObsPy 1.0.1 very soon. Sorry for any caused inconveniences.

https://github.com/obspy/obspy/pull/1285
https://github.com/obspy/obspy/pull/1317
https://github.com/obspy/obspy/issues/1345

If you checkout the latest master or our maintenance branch the issues
should mostly be gone.

Thanks for the report!

Lion

Hi Chuck,

as a side note, it's quick to get an overview over all issues related to
a specific submodule, e.g. io.sac:

https://github.com/obspy/obspy/issues?utf8=✓&q=label%3A.io.sac

I'm attaching a diff of the current maintenance changes for 1.0.1, in
case your interested in the details..

cheers,
Tobias

sac.diff (12.4 KB)