From 8885f666af0c5bb1be7629522257eab35a896e8b Mon Sep 17 00:00:00 2001 From: "Kasper D. Fischer" Date: Tue, 25 Nov 2014 09:53:29 +0000 Subject: [PATCH 1/2] Get the right city name if town is provided instead of city. --- scripts/mkGeolocationTable.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/mkGeolocationTable.py b/scripts/mkGeolocationTable.py index 73d7c23..fd2a891 100755 --- a/scripts/mkGeolocationTable.py +++ b/scripts/mkGeolocationTable.py @@ -41,7 +41,7 @@ def mkGeolocationTable(file=''): import warnings import urllib2 as URL import json as JSON - + # constants namespaces = {'sc3': 'http://geofon.gfz-potsdam.de/ns/seiscomp3-schema/0.7', 'qml': 'http://quakeml.org/xmlns/bed/1.2'} @@ -81,12 +81,22 @@ def mkGeolocationTable(file=''): response = URL.urlopen(url) if ( response.msg == 'OK' ): data = JSON.loads(response.read()) + city = [] try: try: city = data['address']['city'] except: - warnings.warn('Using county instead of city for event {0} at {1} N / {2} E (URL: {3})'.format(publicID, lat, lng, url)) - city = data['address']['county'] + warnings.warn('Request {3} for event {0} at {1} N / {2} E did not provide city attribute\n\t(Response: {4})'.format(publicID, lat, lng, url, data)) + try: + city = data['address']['town'] + warnings.warn('Using attribute town ({1}) for event {0}'.format(publicID, city)) + except: + try: + city = data['address']['county'] + warnings.warn('Using attribute county ({1}) for event {0}'.format(publicID, city)) + except: + warnings.warn('Skipping event') + continue countryCode = data['address']['country_code'].upper() if ( countryCode == 'DE' ): geolocationTable[publicID] = city.encode('utf-8') From 22f656a5fe46c3cc7c9bf0159d4f2a037753383d Mon Sep 17 00:00:00 2001 From: "Kasper D. Fischer" Date: Fri, 19 Dec 2014 08:14:05 +0000 Subject: [PATCH 2/2] Added Haltern 3.6 (2014-11-15) and Vechta 3.0 (2014-12-19) events. --- www/specialevents.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/specialevents.js b/www/specialevents.js index 74ba07b..bcf0bef 100644 --- a/www/specialevents.js +++ b/www/specialevents.js @@ -1,5 +1,7 @@ /* $Id$ */ var specialEvents = [ + //'bug2014ytlk', // Vechta 3.0 + //'bug2014wjwx', // Haltern 3.6 //'bug2014ldts', // Darmstadt //'bug2014kowj', // Vogtland 5.0 //'bug2014jptq', // Seeheim-Jugenheim