From a7d16e5b8a669c3b9c4d6826076d0f07f89fd6e1 Mon Sep 17 00:00:00 2001 From: "Kasper D. Fischer" Date: Wed, 23 Feb 2022 15:17:08 +0100 Subject: [PATCH] fix scripts/mkGeolocationTable.py * increase query limit to 10 * increase min_delay_seconds of RateLimiter to 2 seconds --- scripts/mkGeolocationTable.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/mkGeolocationTable.py b/scripts/mkGeolocationTable.py index 5621746..c5125fd 100755 --- a/scripts/mkGeolocationTable.py +++ b/scripts/mkGeolocationTable.py @@ -52,7 +52,7 @@ def mkGeolocationTable(file=''): from geopy.exc import GeocoderServiceError ## constants - URL = 'https://photon.komoot.io/reverse?lon={lng:.3f}&lat={lat:.3f}&limit=5' + URL = 'https://photon.komoot.io/reverse?lon={lng:.3f}&lat={lat:.3f}&limit=10' NAMESPACES = {'sc3': 'http://geofon.gfz-potsdam.de/ns/seiscomp3-schema/0.7', 'qml': 'http://quakeml.org/xmlns/bed/1.2'} @@ -70,7 +70,7 @@ def mkGeolocationTable(file=''): # parse event.xml DOM = ET.parse(stdin).getroot() geolocator = Photon() - reverse_geolocate = RateLimiter(geolocator.reverse, min_delay_seconds=1) + reverse_geolocate = RateLimiter(geolocator.reverse, min_delay_seconds=2) # iterate over all events count = 0 @@ -88,7 +88,7 @@ def mkGeolocationTable(file=''): else: logging.info('Processing event {id}'.format(id=publicID)) try: - locations = reverse_geolocate("{lat:.3f}, {lng:.3f}".format(lat=lat, lng=lng),exactly_one=False,limit=5) + locations = reverse_geolocate("{lat:.3f}, {lng:.3f}".format(lat=lat, lng=lng),exactly_one=False,limit=10) except GeocoderServiceError: logging.warning('Reverse Geolocation failed. Skipping event.') continue