Created
June 8, 2021 07:38
-
-
Save diodon/bbde3c3529d6d2d94bf129b76232e6d2 to your computer and use it in GitHub Desktop.
Finding the AIMS weather station ID is necessary to get data from the instruments. This function returns the station name, ID and its metadata URL
This file contains hidden or 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
| ## Get AIMS weather Station ID, name and metadata record link | |
| import json | |
| import requests | |
| import prettytable | |
| AIMSurl = "https://api.aims.gov.au/weather/latestreadings" | |
| WSjson = json.loads(requests.get(AIMSurl).text) | |
| tbl = prettytable.PrettyTable(['Station Name', "Station ID", "Metadata url"]) | |
| for station in range(len(WSjson)): | |
| tbl.add_row([WSjson[station]['site_name'], WSjson[station]['site_id'], WSjson[station]['metadata']]) | |
| print(tbl) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment