From e15003c5f8f8ac1d8858bc3497c0e1ea002e60e9 Mon Sep 17 00:00:00 2001 From: ogalanis Date: Thu, 25 Aug 2022 13:09:41 +0300 Subject: [PATCH 1/2] Avoid duplicating responses when there are multiple consecutive epochs --- responseCacher/cache.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/responseCacher/cache.py b/responseCacher/cache.py index a004cc0..b1d4802 100644 --- a/responseCacher/cache.py +++ b/responseCacher/cache.py @@ -16,6 +16,7 @@ import requests from obspy import read_inventory +from obspy.core import UTCDateTime from config import config if __name__ == "__main__": @@ -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"], From f5148bb815964f27afb14beb3025440146c90592 Mon Sep 17 00:00:00 2001 From: ogalanis Date: Tue, 6 Sep 2022 12:12:37 +0300 Subject: [PATCH 2/2] restore starttime/endtime after the response request --- responseCacher/cache.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/responseCacher/cache.py b/responseCacher/cache.py index b1d4802..79e871f 100644 --- a/responseCacher/cache.py +++ b/responseCacher/cache.py @@ -94,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: @@ -102,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