Skip to content

Commit

Permalink
Better logic for when to prune the stations
Browse files Browse the repository at this point in the history
Also catch if some service returns an invalid data response
  • Loading branch information
krischer authored and claudiodsf committed Jun 28, 2016
1 parent e9b21c6 commit 52d2d91
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions obspy/clients/fdsn/mass_downloader/download_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,7 @@ def filter_stations_based_on_minimum_distance(
# There are essentially two possibilities. If no station exists yet,
# it will choose the largest subset of stations satisfying the
# minimum inter-station distance constraint.
if not existing_stations and \
not any([_i.has_existing_time_intervals for _i in stations]):
if not existing_stations:
# Build k-d-tree and query for the neighbours of each point within
# the minimum distance.
kd_tree = utils.SphericalNearestNeighbour(stations)
Expand Down Expand Up @@ -1076,6 +1075,14 @@ def get_availability(self):
"Client '{0}' - Failed getting availability: %s".format(
self.client_name), str(e))
return
# This sometimes fires if a service returns some random stuff which
# is not a valid station file.
except Exception as e:
self.logger.error(
"Client '{0}' - Failed getting availability due to "
"unexpected exception: %s".format(self.client_name), str(e))
return

self.logger.info("Client '%s' - Successfully requested availability "
"(%.2f seconds)" % (self.client_name, end - start))

Expand Down

0 comments on commit 52d2d91

Please sign in to comment.