-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprocess_sample_data.py
35 lines (22 loc) · 991 Bytes
/
process_sample_data.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
"""Pulls in sample data, processes it, and prepares the site to serve this
sample data.
"""
import pickle
import utils.analysis_utils as a_utils
from utils import plot_utils, plot_utils_mpl
filename = 'sample_data/reading_dump_09212019.pkl'
with open(filename, 'rb') as f:
recent_readings = pickle.load(f)
# current_data = a_utils.fetch_current_data(fresh=False)
# readings = a_utils.process_xml_data(current_data)
# recent_readings = a_utils.get_recent_readings(readings, 48)
critical_points = a_utils.get_critical_points(recent_readings)
plot_utils.plot_current_data_html(recent_readings)
plot_utils.plot_interactive_critical_forecast_html(recent_readings[:86])
# Plot a shortened set of points.
num_points = 86
if num_points:
recent_readings = recent_readings[:num_points]
critical_points = a_utils.get_critical_points(recent_readings)
plot_utils_mpl.plot_critical_forecast_mpl(recent_readings,
critical_points)