X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=code%2Fstage2%2Fsrc%2Fdescriptive-32K.r;fp=code%2Fstage2%2Fsrc%2Fdescriptive-32K.r;h=5e1b29bc2fb5bb9a216ea6cad07866d992ad8eb4;hb=48acd629923e19f1957fe34e21fe0530de8a46e0;hp=0000000000000000000000000000000000000000;hpb=ad642dc605bbbd0b3fa890c78fa8d634b1d6f703;p=epclust.git diff --git a/code/stage2/src/descriptive-32K.r b/code/stage2/src/descriptive-32K.r new file mode 100644 index 0000000..5e1b29b --- /dev/null +++ b/code/stage2/src/descriptive-32K.r @@ -0,0 +1,81 @@ +# 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)')