generated from CambridgeEngineering/PartIA-Flood-Warning-System
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Task2E.py
39 lines (25 loc) · 1.03 KB
/
Task2E.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import datetime
from floodsystem.datafetcher import fetch_measure_levels
from floodsystem.stationdata import build_station_list
from floodsystem.plot import plot_water_levels
from floodsystem.flood import stations_highest_rel_level
def run():
# Build list of stations
stations = build_station_list()
# Find 5 stations at which current relative water level is greatest
N = 5
highest_waterlevel_stations = stations_highest_rel_level(stations, N)
# Desired number of days to plot is 10
dt = 10
# Plot water levels over past 10 days for these stations
dateslist = []
levelslist = []
for station in highest_waterlevel_stations:
measure_id = station.measure_id
dates, levels = fetch_measure_levels(measure_id, datetime.timedelta(days=dt))
dateslist.append(dates)
levelslist.append(levels)
plot_water_levels(highest_waterlevel_stations, dateslist, levelslist)
if __name__ == "__main__":
print("*** Task 2E: CUED Part IA Flood Warning System ***")
run()