Created
February 14, 2017 16:36
-
-
Save lbillingham/be09a5fb261568d6b45e8c8a11ee4fcc to your computer and use it in GitHub Desktop.
what observatory data do we have in the BGS WDC web app?. front end at http://wdc.bgs.ac.uk/dataportal/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url_base = r'http://app.geomag.bgs.ac.uk/wdc/' | |
station_resource = 'stations' | |
stations_url = url_base + station_resource | |
response = requests.get(stations_url) | |
# dictionary with IAGA codes as primary keys | |
stations = response.json() | |
station = 'ESK' | |
lat = 'latitude' | |
lon = 'longitude' | |
elev = 'elevation' | |
cadence = 'hour' | |
assert station in stations.keys() | |
stn_data = stations.get(station) | |
print('{}: lat {}, lon {}, elev {}'.format( | |
station, | |
stn_data.get(lat), | |
stn_data.get(lon), | |
stn_data.get(elev) | |
)) | |
assert cadence in stn_data.get('dataAvailability'), \ | |
'{}-ly data exist in WDC for {}'.format(cadence, station) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment