Beispiel #1
0
def run():
    stations = build_station_list()
    update_water_levels(stations)
    highest_stations = stations_highest_rel_level(stations, 5)

    dt = 10

    for s in highest_stations:
        dates, levels = fetch_measure_levels(s[0].measure_id, dt=datetime.timedelta(days=dt))
        # print(dates, levels)
        plot_water_level_with_fit(s[0], dates, levels, 4)
Beispiel #2
0
def run():
    # Build list of stations
    stations = build_station_list()

    # Update latest level data for all stations
    update_water_levels(stations)

    # Print station and latest level for first 5 stations in list
    names = ['Bourton Dickler', 'Surfleet Sluice', 'Gaw Bridge',
             'Hemingford','Swindon']
    for station in stations:
        if station.name in names:
            print("Station name and current level: {}, {}".format(station.name,
                                                                  station.latest_level))
def test_update_level():
    """Test update to latest water level"""

    # Build list of stations
    stations = build_station_list()
    for station in stations:
        assert station.latest_level == None

    # Update latest level data for all stations
    update_water_levels(stations)
    counter = 0
    for station in stations:
        if station.latest_level is not None:
            counter += 1

    assert counter > 0
def run():
    stations = build_station_list()
    update_water_levels(stations)
    output = analysis_station(stations, "severe")
    print(output)
def run():
    stations = build_station_list()
    update_water_levels(stations)
    dangerous_stations = station_level_over_threshold(stations,0.8)
    print (list(map(lambda s: [s[0].name, s[1]], dangerous_stations)))