Browse Source

Save figure instead of showing; download all data

Petra Lamborn 5 years ago
parent
commit
bce871d1f8
3 changed files with 7 additions and 5 deletions
  1. 4
    2
      py/clustering.py
  2. 1
    1
      py/downkwh.py
  3. 2
    2
      py/util.py

+ 4
- 2
py/clustering.py View File

@@ -92,7 +92,8 @@ dendrogram(
92 92
     link_color_func = lambda x: link_cols[x],
93 93
     color_threshold = None
94 94
 )
95
-plt.show()
95
+# plt.show()
96
+plt.savefig("../img/sample-9-dendro.png")
96 97
 
97 98
 sns.set()
98 99
 
@@ -102,4 +103,5 @@ for i, c in enumerate(clabs):
102 103
     fds = mdagg[mdagg.cluster == c]
103 104
     sns.lineplot(x = 'read_time', y = 'kwh_tot_mean', color = cpal[c], ax = axes[i//3][i%3], data = fds)
104 105
     axes[i//3][i%3].fill_between(fds.read_time.dt.to_pydatetime(), fds.kwh_tot_CI_low, fds.kwh_tot_CI_high, alpha = 0.1, color = cpal[c])
105
-plt.show()
106
+# plt.show()
107
+plt.savefig("../img/sample-9-panedtrends.png")

+ 1
- 1
py/downkwh.py View File

@@ -10,4 +10,4 @@ kwhdata = getkwh('2017-01-01', '2018-01-01', '2017-01-01 00:30:00', '2018-01-01
10 10
 print(kwhdata.info())
11 11
 
12 12
 print("Pickling")
13
-kwhdata.to_pickle("../data/2017-sample.pkl")
13
+kwhdata.to_pickle("../data/2017-all.pkl")

+ 2
- 2
py/util.py View File

@@ -79,7 +79,7 @@ def getkwh(datestart, dateend, timestart, timeend, subset):
79 79
             SELECT read_time 
80 80
             FROM GENERATE_SERIES(%(tsstart)s::timestamp, %(tsend)s::timestamp, 
81 81
                 '30 minutes'::interval) read_time
82
-        ) AS tsdata CROSS JOIN public.icp_sample
82
+        ) AS tsdata CROSS JOIN public.best_icp
83 83
     ) AS comb
84 84
     LEFT JOIN
85 85
     (
@@ -97,7 +97,7 @@ def getkwh(datestart, dateend, timestart, timeend, subset):
97 97
              and   a.read_date <  to_date(%(dateend)s,'yyyy-mm-dd')
98 98
              and   a.content_code  ~ ('UN|CN|EG')
99 99
              AND   a.icp_id IN (
100
-                SELECT icp_id FROM public.icp_sample
100
+                SELECT icp_id FROM public.best_icp
101 101
              )
102 102
             GROUP BY 1, 2, 3
103 103
         ) AS coup_tall