--- /dev/null
+# File: descriptive-32K.r
+
+rm(list = ls())
+#library(dplyr)
+
+## Following lines allow to construct the data file
+## totconso-par-indiv.txt.
+## They are very time&memory-consumming
+#library(data.table)
+#d10 <- fread("~/tmp/data/2010.csv")
+#tot <- d10[, list(tot= sum(CPP_PUISSANCE_BRUTE),
+# min= min(CPP_PUISSANCE_BRUTE),
+# max= max(CPP_PUISSANCE_BRUTE),
+# sd = sd( CPP_PUISSANCE_BRUTE)),
+# by = FK_CCU_ID]
+# write.table(file = "~/tmp/data/totconso-par-indiv.txt", tot)
+
+tot <- read.table("~/tmp/data/totconso-par-indiv.txt")
+synchro <- read.table("~/tmp/data/syncrone2010.txt")
+mat_synchro <- matrix(c(synchro$V1[1:2], synchro$V1) / 1e6,
+ ncol = 48,
+ byrow = TRUE)
+
+xHour <- seq(1/2, 24, length.out = 48)
+xDate <- seq.Date(from = as.Date("2010/1/1"),
+ to = as.Date("2011/1/1"),
+ length.out = 365 * 48 - 2)
+
+# Filter infra daily
+plot(xDate, filter(synchro$V1 / 1e6, rep(1 / 48, 48)),
+ type = 'l',
+ main = 'Synchrone 2010',
+ ylab = 'Charge (en Mwh)',
+ xlab = 'Time')
+
+# Daily
+matplot(xHour, scale(t(mat_synchro)), type = 'l', lty = 1,
+ col = rgb(0, 0, 0, .25),
+ main = 'Synchrone jounalière (norm.)',
+ xlab = 'Heures', ylab = 'Charge (en Mwh)')
+
+
+tot_order <- tot[order(tot$tot), ]
+max_order <- tot[order(tot$max), ]
+
+## Mesures aberrantes ?
+tail(cbind(max_order[,1], max_order[,-1] / 1e3))
+
+
+## I want to recuperate ids: 186733, 191819, 193174
+## which corresponds to places 1, 2481, 3478
+# identiants <- read.table('~/tmp/data/identifs.txt')
+# match(c(186733, 191819, 193174), identiants$V1)
+
+#c186733 <- d10[, FK_CCU_ID == 186733]
+#c191819 <- d10[, FK_CCU_ID == 191819]
+#c193174 <- d10[, FK_CCU_ID == 193174]
+
+c186733 <- read.csv("~/tmp/data/c186733.csv")[, 4] / 1e3
+
+mat_186733 <- matrix(c(c186733[1:2], c186733),
+ ncol = 48,
+ byrow = TRUE)
+
+# Filter infra daily
+plot(xDate, filter(c186733, rep(1 / 48, 48)),
+ type = 'l',
+ main = "Consommation individuelle (2010)",
+ ylab = 'Charge (en Mwh)',
+ xlab = 'Temps')
+
+# Daily (raw)
+matplot(xHour, t(mat_186733), type = 'l', lty = 1,
+ col = rgb(0, 0, 0, .25),
+ #main = "Consommation individuelle journalière "
+ xlab = 'Heures', ylab = 'Charge (en Mwh)')
+
+# Daily (standarized)
+matplot(xHour, scale(t(mat_186733)), type = 'l', lty = 1,
+ col = rgb(0, 0, 0, .25),
+ xlab = 'Heures', ylab = 'Charge (en Mwh)')