-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.html
77 lines (75 loc) · 3.11 KB
/
stats.html
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
layout: default
title: "Drafty: Stats"
---
<h1>Summary Stats</h1>
{% assign num_rows = site.data.all | size | times: 1.0 %}
{% assign end_index = num_rows | minus: 1 | round %}
{% assign total_temp_diff = 0.0 %}
{% assign num_rows_with_outdoor_temp = 0.0 %}
{% assign total_hum_diff = 0.0 %}
{% assign num_rows_with_outdoor_hum = 0.0 %}
{% assign max_temp = site.data.all[0].temp_f | times: 1.0 %}
{% assign max_temp_time = site.data.all[0].time %}
{% assign min_temp = site.data.all[0].temp_f | times: 1.0 %}
{% assign min_temp_time = site.data.all[0].time %}
{% assign max_hum = site.data.all[0].humidity | times: 1.0 %}
{% assign max_hum_time = site.data.all[0].time %}
{% assign min_hum = site.data.all[0].humidity | times: 1.0 %}
{% assign min_hum_time = site.data.all[0].time %}
{% for row in site.data.all %}
{% assign temp = row.temp_f | times: 1.0 %}
{% if temp > max_temp %}
{% assign max_temp = temp %}
{% assign max_temp_time = row.time %}
{% endif %}
{% if temp < min_temp %}
{% assign min_temp = temp %}
{% assign min_temp_time = row.time %}
{% endif %}
{% assign hum = row.humidity | times: 1.0 %}
{% if hum > max_hum %}
{% assign max_hum = hum %}
{% assign max_hum_time = row.time %}
{% endif %}
{% if hum < min_hum %}
{% assign min_hum = hum %}
{% assign min_hum_time = row.time %}
{% endif %}
{% if row.nws_temp_f %}
{% assign num_rows_with_outdoor_temp = num_rows_with_outdoor_temp | plus: 1 %}
{% assign indoor_temp = row.temp_f | times: 1.0 %}
{% assign outdoor_temp = row.nws_temp_f | times: 1.0 %}
{% assign temp_diff = indoor_temp | minus: outdoor_temp | abs %}
{% assign total_temp_diff = total_temp_diff | plus: temp_diff %}
{% endif %}
{% if row.nws_humidity %}
{% assign num_rows_with_outdoor_hum = num_rows_with_outdoor_hum | plus: 1 %}
{% assign indoor_hum = row.humidity | times: 1.0 %}
{% assign outdoor_hum = row.nws_humidity | times: 1.0 %}
{% assign hum_diff = indoor_hum | minus: outdoor_hum | abs %}
{% assign total_hum_diff = total_hum_diff | plus: hum_diff %}
{% endif %}
{% endfor %}
{% assign avg_temp_diff = total_temp_diff | divided_by: num_rows_with_outdoor_temp | round: 1 %}
{% assign avg_hum_diff = total_hum_diff | divided_by: num_rows_with_outdoor_hum | round: 1 %}
<dl>
<dt>Minimum Temperature</dt>
<dd>{{ min_temp }}°F ({{ min_temp_time | date: "%B %e, %Y, %r" }})</dd>
<dt>Maximum Temperature</dt>
<dd>{{ max_temp }}°F ({{ max_temp_time | date: "%B %e, %Y, %r" }})</dd>
<dt>Average Deviation from Outdoor Temperature</dt>
<dd>{{ avg_temp_diff }}°F</dd>
<dt>Minimum Humidity</dt>
<dd>{{ min_hum }}% ({{ min_hum_time | date: "%B %e, %Y, %r" }})</dd>
<dt>Maximum Humidity</dt>
<dd>{{ max_hum }}% ({{ max_hum_time | date: "%B %e, %Y, %r" }})</dd>
<dt>Average Deviation from Outdoor Humidity</dt>
<dd>{{ avg_hum_diff }}%</dd>
<dt>Total Number of Readings</dt>
<dd>{{ num_rows | round }}</dd>
<dt>Date of First Reading</dt>
<dd>{{ site.data.all[0].time | date: "%B %e, %Y" }}</dd>
<dt>Date of Last Reading</dt>
<dd>{{ site.data.all[end_index].time | date: "%B %e, %Y" }}</dd>
</dl>