Commit 7f9b457b authored by Bruno Bonte's avatar Bruno Bonte
Browse files

Comparing sucessfully hru and hru-plots waterbalance on GB jams model

parent 1d9e7675
......@@ -34,7 +34,7 @@ library(gridExtra)
makeWaterBalance <- T; if (makeWaterBalance) { storedWater <- NULL; inOutWater <-NULL ;localStoredWater <- NULL; localInOutWater <-NULL}
# If original big Hrus are used (not hru plot and thus no cormas)
bigHrus <- F
bigHrus <- T
# If orginial big Hrus are used, link must be made between cormas HRU plots and J2K big HRUS
if (bigHrus) {
......@@ -474,11 +474,23 @@ library(gridExtra)
localStorages <- localStoredWater %>% tbl_df()
localInOut <- localInOutWater %>% tbl_df()
localWaterSummary <- cbind (localStorages, localInOut) %>% tbl_df() %>% mutate(day = row_number())
# Quick saveing of global and local agreggated water-balances values
waterSummary %>%
write.table(paste0("output/globalwaterBalance-big", bigHrus, "_GB.csv"),
row.names = F,
sep = ";",
dec=".")
localWaterSummary %>%
write.table(paste0("output/localwaterBalance-big", bigHrus, "_GB.csv"),
row.names = F,
sep = ";",
dec=".")
#Plotting global water loss for verification
waterSummary %>%
arrange(day) %>%
#filter(day > nbDays) %>%
mutate(inWater = rain + snow) %>%
mutate(outWater = etact + runoff) %>%
mutate(storage = hruStorage + reachStorage) %>%
......@@ -486,15 +498,12 @@ library(gridExtra)
mutate(deltaS = storageNextDay - storage) %>%
mutate(waterBalance = inWater - outWater) %>%
mutate(waterLoss = storageNextDay - storage - waterBalance) %>%
#filter(day > 250) %>%
#filter(day < 300) %>%
#mutate(cumWaterLoss = cumsum(waterLoss)) %>%
ggplot() +
geom_line(aes(x = day, y = waterLoss))
#Plotting local water loss for verification
localWaterSummary %>%
arrange(day) %>%
#filter(day > nbDays) %>%
mutate(inWater = rain + snow) %>%
mutate(outWater = etact + outflow) %>%
mutate(storage = hruStorage) %>%
......@@ -507,15 +516,8 @@ library(gridExtra)
mutate(cumWaterLoss = cumsum(waterLoss)) %>%
ggplot() +
geom_line(aes(x = day, y = waterLoss, color = "loss")) +
ggtitle("Bilan Hrus 11104p, 8563p, 12464p, 8560p, 16637t")
# geom_line(aes(x = day, y = - outWater, color = "outWater")) +
# geom_line(aes(x = day, y = deltaS, color = "deltaS")) +
# geom_line(aes(x = day, y = - etact, color = "et")) +
# geom_line(aes(x = day, y = - outflow, color = "outflow")) +
# geom_line(aes(x = day, y = inWater, color = "inWater")) +
#geom_line(aes(x = day, y = snow, color = "snow")) +
# geom_line(aes(x = day, y = rain, color = "rain"))
ggtitle("Bilan Hrus 8560p,16637t,8563p,11104p,12464p")
# Graphique intuitif pour voir si le bilan est correct
#(à l'echelle du bassin)
# Pour toute la durée de simulation incluant la pré-chauffe
......
library(ggplot2)
library(dplyr)
library(tidyr)
library(stringr)
# Global
globalWaterSummaryBigH <- read.table(paste0("output/globalwaterBalance-bigTRUE_GB.csv"),
header = T,
sep = ";",
dec=".") %>%
tbl_df() %>%
mutate(hruType = "Big")
globalWaterSummaryWithPlots <- read.table(paste0("output/globalwaterBalance-bigFALSE_GB.csv"),
header = T,
sep = ";",
dec=".") %>%
tbl_df() %>%
mutate(hruType = "WithHruPlots")
globalWaterSummary <- union(globalWaterSummaryBigH, globalWaterSummaryWithPlots)
globalWaterSummary %>%
ggplot() +
geom_line(aes(y = runoff, x = day, color = hruType))
globalWaterSummary %>%
select(day, runoff, hruType) %>%
spread(hruType, runoff) %>%
filter(day > 100) %>%
mutate(diffRunOff = (Big - WithHruPlots) / Big * 100) %>%
ggplot() +
geom_line(aes(y = diffRunOff, x = day))
# Local
localWaterSummaryBigH <- read.table(paste0("output/localwaterBalance-bigTRUE_GB.csv"),
header = T,
sep = ";",
dec=".") %>%
tbl_df() %>%
mutate(hruType = "Big")
localWaterSummaryWithPlots <- read.table(paste0("output/localwaterBalance-bigFALSE_GB.csv"),
header = T,
sep = ";",
dec=".") %>%
tbl_df() %>%
mutate(hruType = "WithHruPlots")
localWaterSummary <- union(localWaterSummaryBigH, localWaterSummaryWithPlots)
localWaterSummary %>%
ggplot() +
geom_line(aes(y = outflow, x = day, color = hruType))
localWaterSummary %>%
select(day, outflow, hruType) %>%
spread(hruType, outflow) %>%
filter(day > 100) %>%
mutate(diffoutFlow = (Big - WithHruPlots) / Big * 100) %>%
ggplot() +
geom_line(aes(y = diffoutFlow, x = day))
#Plotting global water loss for verification
waterSummary %>%
arrange(day) %>%
mutate(inWater = rain + snow) %>%
mutate(outWater = etact + runoff) %>%
mutate(storage = hruStorage + reachStorage) %>%
mutate(storageNextDay = lead(storage)) %>%
mutate(deltaS = storageNextDay - storage) %>%
mutate(waterBalance = inWater - outWater) %>%
mutate(waterLoss = storageNextDay - storage - waterBalance) %>%
ggplot() +
geom_line(aes(x = day, y = waterLoss))
\ No newline at end of file
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