Commit de469bc5 authored by Dorchies David's avatar Dorchies David
Browse files

feat: add station names

- also reduce discretisation of prob to 5%

Refs #14, #15
parent 1f57c314
......@@ -49,7 +49,7 @@ calcInstantRisk <- function(con, ruleset, date, storages, n = 10L) {
NULL
}
})
names(l) <- paste(objectives$station, objectives$level, "Q",
names(l) <- paste(station_names[objectives$station], objectives$level, "Q",
ifelse(objectives$flood, "<", ">"),
objectives$threshold, "m3/s")
df <- data.frame(id_objective = seq.int(nrow(objectives)),
......
......@@ -17,7 +17,7 @@ calcRiskHeatMap <- function(con, ruleset, station, level, lake) {
dataLength <- length(which(cdf$id_cal_day == calday))
if(dataLength > 1) {
l <- approx(cdf$V[cdf$id_cal_day == calday], cdf$prob[cdf$id_cal_day == calday], discretStorage, rule = 2)
data.frame(julian = i, day = calday, V = l$x, prob = round(l$y, digits = 1))
data.frame(julian = i, day = calday, V = l$x, prob = round(l$y *20)/20)
} else if(dataLength == 1){
data.frame(julian = i, day = calday, V = discretStorage, prob = 0)
} else {
......
......@@ -13,7 +13,7 @@ mod_one_objective_focus_ui <- function(id){
rulesets <- seq(length(rvgest::rulesets$rules))
names(rulesets) <- paste0(rulesets, ". ", rvgest::rulesets$rules)
stations <- unique(rvgest::objectives$station)
names(stations) <- stations
names(stations) <- station_names
levels <- unique(rvgest::objectives$level)
names(levels) <- levels
tagList(
......@@ -67,7 +67,6 @@ mod_one_objective_focus_server <- function(id, con, SGL_RT_storage){
names(levels) <- paste(objectives$level, "Q",
ifelse(objectives$flood, "<", ">"),
objectives$threshold, "m3/s")
golem::print_dev(levels)
updateSelectInput(session, inputId = "level", choices = levels)
})
......
station_names <- strsplit("Arcis-sur-Aube
Mery-sur-Seine
Nogent-sur-Seine
Gurgy (Yonne)
Courlon-sur-Yonne
Alfortville (Seine)
Chalons-sur-Marne
Noisiel (Marne)
Paris (Seine)", "\n")[[1]]
names(station_names) <- unique(rvgest::objectives$station)
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