$ conda config --add channels conda-forge$ conda install obspy$ conda update obspyRead only a portion of the SAC file to implement a function similar to the cut command in SAC:
#!/usr/bin/env python# -*- coding: utf-8 -*-from obspy import readfrom obspy.io.sac.util import get_sac_reftimest = Stream()for file in sorted(glob.glob("*.SAC")): tr = read(file)[0] reftime = get_sac_reftime(tr.stats.sac) starttime = reftime + tr.stats.sac.t0 - 10 endtime = reftime + tr.stats.sac.t0 + 10 st += tr.slice(starttime, endtime)