obspy.io.sac.util.obspy_to_sac_header¶
- obspy_to_sac_header(stats, keep_sac_header=True)[source]¶
Make a SAC header dictionary from an ObsPy Stats or dict instance.
Parameters: - stats (dict or Stats) Filled ObsPy Stats header
- keep_sac_header (bool)
If keep_sac_header is True, old stats.sac header values are kept, and a minimal set of values are updated from the stats dictionary according to these guidelines: * npts, delta always come from stats * If an old reftime is found and valid, the new b and e will be made
and properly referenced to it. If the SAC reftime is invalid, the reftime will be set from stats.starttime (with micro/milliseconds precision adjustments) only if an existing SAC iztype is 9 and no other relative time headers are set.- If ‘kstnm’, ‘knetwk’, ‘kcmpnm’, or ‘khole’ are not set, they are taken from ‘station’, ‘network’, ‘channel’, and ‘location’ in stats.
If keep_sac_header is False, a new SAC header is constructed from only information found in the stats dictionary, with some other default values introduced. It will be an iztype 9 (“ib”) file, with small reference time adjustments for micro/milliseconds precision issues. SAC headers nvhdr, level, lovrok, and iftype are always produced.