-
Notifications
You must be signed in to change notification settings - Fork 0
Using USGS API
As of March 31, 2017:
Here's the URL for the data received from USGS for discharge and gage height: example
Parsing the data can be a little confusing because there are dictionaries within lists within dictionaries. Many lists are single element many dictionaries only contain one pair. Here's how we navigate to Discharge data:
Verifying which measurement with the parameter code and finding it
response = request.get(url)
time_series = response.json()["value"]["timeSeries"]
param_code = time_series["variable"]["variableCode"][0]["value"]
Here param_code
was 00060
which maps to Discharge.
Going into actual data:
values = time_series["values"][0]["value"]
values
yields a list of dictionaries, inside which contains the value, time stamp and qualifier.
GitHubs
Nick Dant | https://github.com/NickDant
Naomi Martinez | https://github.com/dnmartinez
David Shi | https://github.com/dshimo
Sid Srikumar | https://github.com/sid9102
Christy Tran | https://github.com/ChristyTran