Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions responseCacher/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import requests

from obspy import read_inventory
from obspy.core import UTCDateTime
from config import config

if __name__ == "__main__":
Expand Down Expand Up @@ -73,6 +74,11 @@
else:
segment_length = 3600

t0 = starttime
t1 = endtime
starttime = (UTCDateTime(starttime)+1.0).isoformat()
endtime = (UTCDateTime(endtime)-1.0).isoformat()

# Prepare to read inventory using ObsPy
requestOptions = (
config["API_URL"],
Expand All @@ -88,6 +94,9 @@
except:
continue

starttime = t0
endtime = t1

# Verify that only one channel is returned
contents = inventory.get_contents()
if len(contents["networks"]) != 1 or len(contents["stations"]) != 1 or len(contents["channels"]) != 1:
Expand All @@ -96,6 +105,7 @@
# Get the first response object
response = inventory[0][0][0].response


# Call evalresp to evaluate the response
# NFFT must be same as in Welch's method!
# We use 13 segments with 75% overlap
Expand Down