datafetcher module

This module provides functionality for retrieving real-time and latest time history level data

datafetcher.dump(data, filename)

Save JSON object to file

datafetcher.fetch(url)

Fetch data from url and return fetched JSON object

datafetcher.fetch_flood_warnings(severity_level, use_cache=False)

Fetches the flood warnings issued from the API

datafetcher.fetch_latest_water_level_data(use_cache=False)

Fetch latest levels from all ‘measures’. Returns JSON object

datafetcher.fetch_measure_levels(measure_id, dt)

Fetch measure levels from latest reading and going back a period dt. Return list of dates and a list of values.

datafetcher.fetch_station_data(use_cache=True)

Fetch data from Environment agency for all active river level monitoring stations via a REST API and return retrieved data as a JSON object.

Fetched data is dumped to a cache file so on subsequent call it can optionally be retrieved from the cache file. This is faster than retrieval over the Internet and avoids excessive calls to the Environment Agency service.

datafetcher.fetch_stations_by_type(type)

Fetches the stations of other types issued from the put type = Groundwater for groundwater stations

datafetcher.fetch_test_station_data()

Returns data from a test json file which is not updated and therefore can be used to check functions against known results

Returns

json_object.

A json object containing data from station_data_test.json

Return type

data

datafetcher.fetch_warning_area(url)

fetches information on the area of a warning

datafetcher.fetch_warning_region(url)

fetches a geoJSON polygon for area over which a warning is active

datafetcher.load(filename)

Load JSON object from file