From: Benjamin Auder Date: Thu, 29 Jun 2017 15:27:41 +0000 (+0200) Subject: fix Data acquisition; TODO: check CV for local method X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/css/current/pieces/app_dev.php?a=commitdiff_plain;h=0730374e2981d7b950dced9f667713865b44b390;p=talweg.git fix Data acquisition; TODO: check CV for local method --- diff --git a/pkg/R/Data.R b/pkg/R/Data.R index 8aa149d..4b1e1f3 100644 --- a/pkg/R/Data.R +++ b/pkg/R/Data.R @@ -75,7 +75,7 @@ Data = R6::R6Class("Data", # Complete current cell private$.tvp[[L]]$time <- c(private$.tvp[[L]]$time, time) private$.tvp[[L]]$serie <- c(private$.tvp[[L]]$serie, value) - private$.tvp[[L]]$level_hat <- c(private$.tvp[[L]]$levem_hat, level_hat) + private$.tvp[[L]]$level_hat <- c(private$.tvp[[L]]$level_hat, level_hat) } } if (strftime( tail(private$.tvp[[length(private$.tvp)]]$time,1), diff --git a/pkg/R/getData.R b/pkg/R/getData.R index f1f8861..d0e69d7 100644 --- a/pkg/R/getData.R +++ b/pkg/R/getData.R @@ -62,11 +62,14 @@ getData = function(ts_data, exo_data, date_format="%d/%m/%Y %H:%M", limit=Inf) { time = c() serie = c() + level_hat = c() repeat { { time = c(time, ts_df[line,1]) serie = c(serie, ts_df[line,2]) + level_hat = c(level_hat, #in case of data file is incomplete... + ifelse(ncol(ts_df) > 2, ts_df[line,3], mean(serie,na.rm=TRUE))) line = line + 1 }; if (line >= nb_lines + 1 @@ -76,8 +79,7 @@ getData = function(ts_data, exo_data, date_format="%d/%m/%Y %H:%M", limit=Inf) } } - # TODO: 2 modes, "operational" and "testing"; would need PM10 predictions - data$append(time=time, value=serie, level_hat=mean(serie,na.rm=TRUE), + data$append(time=time, value=serie, level_hat=level_hat, exo=exo_df[i,2:(1+nb_exos)], exo_hat=exo_df[i,(1+nb_exos+1):(1+2*nb_exos)]) if (i >= limit) break