Kaynağa Gözat

Save figure instead of showing; download all data

Petra Lamborn 5 yıl önce
ebeveyn
işleme
467f694128
3 değiştirilmiş dosya ile 7 ekleme ve 5 silme
  1. 4
    2
      py/clustering.py
  2. 1
    1
      py/downkwh.py
  3. 2
    2
      py/util.py

+ 4
- 2
py/clustering.py Dosyayı Görüntüle

92
     link_color_func = lambda x: link_cols[x],
92
     link_color_func = lambda x: link_cols[x],
93
     color_threshold = None
93
     color_threshold = None
94
 )
94
 )
95
-plt.show()
95
+# plt.show()
96
+plt.savefig("../img/sample-9-dendro.png")
96
 
97
 
97
 sns.set()
98
 sns.set()
98
 
99
 
102
     fds = mdagg[mdagg.cluster == c]
103
     fds = mdagg[mdagg.cluster == c]
103
     sns.lineplot(x = 'read_time', y = 'kwh_tot_mean', color = cpal[c], ax = axes[i//3][i%3], data = fds)
104
     sns.lineplot(x = 'read_time', y = 'kwh_tot_mean', color = cpal[c], ax = axes[i//3][i%3], data = fds)
104
     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
     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 Dosyayı Görüntüle

10
 print(kwhdata.info())
10
 print(kwhdata.info())
11
 
11
 
12
 print("Pickling")
12
 print("Pickling")
13
-kwhdata.to_pickle("../data/2017-sample.pkl")
13
+kwhdata.to_pickle("../data/2017-all.pkl")

+ 2
- 2
py/util.py Dosyayı Görüntüle

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