@@ -193,7 +193,6 @@ def cull_pairs(pairs, keep_list_fn):
193
193
194
194
startTime = UTCDateTime (start_time )
195
195
endTime = UTCDateTime (end_time )
196
- stationsCache = defaultdict (list )
197
196
for pair in proc_stations [rank ]:
198
197
netsta1 , netsta2 = pair
199
198
@@ -212,7 +211,9 @@ def get_loccha(cha1, cha2):
212
211
cha1 and cha2 -- e.g. ['.SHZ', '00.BHZ'], ['01.HHZ']
213
212
"""
214
213
result = [[], []]
215
- for chidx , (netsta , cha , ds ) in enumerate (zip ((netsta1 , netsta2 ), (cha1 , cha2 ), (ds1 , ds2 ))):
214
+ for chidx , (netsta , cha , ds ) in enumerate (zip ((netsta1 , netsta2 ),
215
+ (cha1 , cha2 ),
216
+ (ds1 , ds2 ))):
216
217
if ('*' in cha1 ):
217
218
cha = cha .replace ('*' , '.*' ) # hack to capture simple regex comparisons
218
219
# end if
@@ -225,12 +226,14 @@ def get_loccha(cha1, cha2):
225
226
226
227
net , sta = netsta .split ('.' )
227
228
228
- if ((start_time , end_time , net , sta ) in stationsCache ):
229
- stations = stationsCache [(start_time , end_time , net , sta )]
230
- else :
231
- stations = ds .fds .get_stations (start_time , end_time , net , sta )
232
- stationsCache [(start_time , end_time , net , sta )] = stations
233
- # end if
229
+ # find a list of entries where network and station names match and
230
+ # start- and end-times overlap with data coverage. Note that this is
231
+ # an approximate estimate and an actual cross-correlation may not be
232
+ # computed due to gaps in data
233
+ stations = ds .nslc_coverage [(ds .nslc_coverage ['net' ] == net ) & \
234
+ (ds .nslc_coverage ['sta' ] == sta ) & \
235
+ (ds .nslc_coverage ['max_et' ] >= startTime .timestamp ) & \
236
+ (ds .nslc_coverage ['min_st' ] <= endTime .timestamp )]
234
237
235
238
loc_pref = location_preferences_dict [netsta ]
236
239
ulocs = set ()
0 commit comments