Commit 555069b7 authored by Matteo DE FELICE's avatar Matteo DE FELICE

Added black to HRD source

parent c472e543
......@@ -8,23 +8,15 @@ shinyServer(function(input, output, session) {
output$main_plot <- renderPlot({
# TODO Date is variable -> especially length out
res = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Reservoirs') %>%
mutate(date = seq(as_datetime('2016-01-01'), as_datetime('2016-12-31'), length.out = 366))
mutate(date = seq(as_datetime('2016-01-01'), as_datetime('2016-12-31'), length.out = 731))
hrgen = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Hydro power generation') %>%
mutate(date = seq(as_datetime('2016-01-01'), as_datetime('2016-12-31'), length.out = 366))
mutate(date = seq(as_datetime('2016-01-01'), as_datetime('2016-12-31'), length.out = 731))
gen = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Generation') %>%
mutate(date = seq(as_datetime('2016-01-01'), as_datetime('2016-12-31'), length.out = 366))
mutate(date = seq(as_datetime('2016-01-01'), as_datetime('2016-12-31'), length.out = 731))
wv = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Water value') %>%
mutate(date = seq(as_datetime('2016-01-01'), as_datetime('2016-12-31'), length.out = 366))
mutate(date = seq(as_datetime('2016-01-01'), as_datetime('2016-12-31'), length.out = 731))
# Load ENTSOE Data
es_entsoe_2015_2017 <- read_excel("data/Copy of Water Reservoirs and Hydro Storage Plants_201412290000-201801010000.xlsx",
range = "A10:D61",
col_types = c("text", "numeric", "numeric",
"numeric"),
col_names = c('week','entsoe-2015', 'entsoe-2016', 'entsoe-2017')) %>%
mutate(date = seq(as_datetime('2016-01-01'), as_datetime('2016-12-31'), length.out = 52)) %>%
gather(variable, value, -week, -date) %>%
mutate(value = value / 1000) %>%
select(-week)
entsoe_storage = read_rds('data/ENTSOE-Storage-2015-2018.rds')
# Average water value ---------------------------------------------------------------------
if (input$plot_type == 'awv') {
sel <-
......@@ -66,6 +58,7 @@ shinyServer(function(input, output, session) {
}
# Generation mix ----------------------------------------------------------------------------
else if (input$plot_type == 'gen_mix') {
sel_zone = select(gen, date, contains(paste0(input$zone, '_')))
print(names(sel_zone))
......@@ -77,7 +70,8 @@ shinyServer(function(input, output, session) {
'WTON' = 'chartreuse2',
'WTOF' = 'chartreuse3',
'BIO' = 'darkolivegreen1',
'COMC' = 'brown')
'COMC' = 'brown',
'HRD' = 'black')
g = sel_zone %>%
gather(source, generation, -date) %>%
mutate(source_type = str_split(source, '_', simplify = TRUE)[,2]) %>%
......@@ -96,17 +90,22 @@ shinyServer(function(input, output, session) {
}
# Reservoir levels single ------------------------------------------------------------------
else if (input$plot_type == 'res_single') {
browser()
res_zone = select(res, date, contains(paste0(input$zone, '_')))
res_data = res %>% gather(zone, reservoir, -date, -X__1) %>%
select(-X__1)
res_zone = select(res, date, value = contains(paste0(input$zone, '_HPHS')),
value = contains(paste0(input$zone, '_HDAM'))) %>%
mutate(day_of_the_year = yday(date))
g = ggplot(res_data, aes(x = date, y = reservoir, color = zone, group = zone)) +
geom_line(size = 0.5) +
scale_y_log10() +
entsoe_data = entsoe_storage %>%
filter(country == input$zone)
g = ggplot(res_zone, aes(x = day_of_the_year, y = value)) +
geom_line(size = 2) +
ylab('GWh/day') +
theme(axis.text.x = element_text(size = 4, angle = 45, hjust = 1))
if (nrow(entsoe_data) > 0) {
g = g +
geom_line(data = entsoe_data, aes(x = day_of_the_year, y = value, color = as.factor(year)))
}
print(g)
# Reservoir levels all ------------------------------------------------------------------
} else if (input$plot_type == 'res_all') {
......
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