Commit 589542a5 authored by jbracher's avatar jbracher
Browse files

Correcting ensemble code (avoid writing out incomplete ensembles)

parent b0c15993
......@@ -35,12 +35,20 @@ mean_ensemble <- aggregate(cbind(q0.025, q0.25, q0.5, q0.75, q0.975) ~ forecast_
# restrict to DAX for now:
#mean_ensemble <- subset(mean_ensemble, target == "DAX")
# write out:
write.csv(mean_ensemble, file = paste0("../", wt, "/", date, "_mean_ensemble.csv"))
if(all(c("DAX", "temperature", "wind") %in% mean_ensemble$target)){
write.csv(mean_ensemble, file = paste0("../", wt, "/", date, "_mean_ensemble.csv"))
}else{
warning("Not all targets found in mean ensemble, not writing out.")
}
# compute median ensemble:
median_ensemble <- aggregate(cbind(q0.025, q0.25, q0.5, q0.75, q0.975) ~ forecast_date + target + horizon, data = all_forecasts, FUN = median, na.rm = TRUE)
#median_ensemble <- subset(median_ensemble, target == "DAX")
# write out:
write.csv(median_ensemble, file = paste0("../", wt, "/", date, "_median_ensemble.csv"))
if(all(c("DAX", "temperature", "wind") %in% mean_ensemble$target)){
write.csv(median_ensemble, file = paste0("../", wt, "/", date, "_median_ensemble.csv"))
}else{
warning("Not all targets found in median ensemble, not writing out.")
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment