Commit 1d9e7675 authored by Bruno Bonte's avatar Bruno Bonte
Browse files

Specifying local water balance tests

	* for hru and hruplots for big hru and hruplots
	* Also increasing safeguard time sleep (long simulation but
hoppefully less errors)
parent 2080b02e
......@@ -34,8 +34,8 @@ 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 <- T
bigHrus <- F
# If orginial big Hrus are used, link must be made between cormas HRU plots and J2K big HRUS
if (bigHrus) {
source("clean-hrus-par.R") # create the plotsInHrus variable telling for each hruPlot in which big hru it is..
......@@ -193,18 +193,26 @@ library(gridExtra)
if (makeWaterBalance) {
storedWater <- rbind(storedWater, j2kWaterBalanceStorages())
# Testing local balance. Only during warming-up.
#localStoredWater <- rbind(localStoredWater, j2kLocalWaterBalanceStorages(selectedHrus = c(548, 554, 567, 634, 696)))
#localStoredWater <- rbind(localStoredWater, j2kLocalWaterBalanceStorages(selectedHrus = c(8665, 8670, 14463, 17024)))
if (bigHrus) {
localStoredWater <- rbind(localStoredWater, j2kLocalWaterBalanceStorages(selectedHrus = c(16637)))
} else {
localStoredWater <- rbind(localStoredWater, j2kLocalWaterBalanceStorages(selectedHrus = c(8560,16637,8563,11104,12464)))
}
}
# Making step by step j2k simu
Sys.sleep(0.05)
j2kMakeStep()
Sys.sleep(0.05)
if (makeWaterBalance) {
inOutWater <- rbind(inOutWater, j2kWaterBalanceFlows())
# Testing local balance. Only during warming-up.
#localInOutWater <- rbind(localInOutWater, j2kLocalWaterBalanceFlows(selectedHrus = c(548, 554, 567, 634, 696),
#lastHru = 567))
#localInOutWater <- rbind(localInOutWater, j2kLocalWaterBalanceFlows(selectedHrus = c(8665, 8670, 14463, 17024),
# lastHru = 17024))
if (bigHrus) {
localInOutWater <- rbind(localInOutWater, j2kLocalWaterBalanceFlows(selectedHrus = c(16637),
lastHru = 16637))
} else {
localInOutWater <- rbind(localInOutWater, j2kLocalWaterBalanceFlows(selectedHrus = c(8560,16637,8563,11104,12464),
lastHru = 16637))
}
}
}
......@@ -478,8 +486,8 @@ library(gridExtra)
mutate(deltaS = storageNextDay - storage) %>%
mutate(waterBalance = inWater - outWater) %>%
mutate(waterLoss = storageNextDay - storage - waterBalance) %>%
filter(day > 150) %>%
filter(day < 300) %>%
#filter(day > 250) %>%
#filter(day < 300) %>%
#mutate(cumWaterLoss = cumsum(waterLoss)) %>%
ggplot() +
geom_line(aes(x = day, y = waterLoss))
......
......@@ -22,3 +22,16 @@ write.table(valide_hrus,
dec= ".",
row.names = F)
hrus_big <- read.table("superjams/data/J2K_cowat/parameter/hru_cor_grand_buech.par",
skip = 5,
sep= "\t",
dec = ".") %>%
tbl_df() %>%
select(V1, V2, V6, V7, V9, V13, V14)
colnames(hrus_big) <- c("id","area","x","y","subbassin","to_poly","to_reach")
hrus_big %>% filter(area < 2000)
......@@ -6,7 +6,8 @@ library(stringr)
#hrus <- read.table("superjams/data/J2K_cowat/parameter/hru.par",
#hrus <- read.table("superjams/data/J2K_cowat/parameter/hru_cowat_10_ok2.par",
hrus <- read.table("superjams/data/J2K_cowat/parameter/hru_cowat_10_cor_grand_buech.par",
#hrus <- read.table("superjams/data/J2K_cowat/parameter/hru_cowat_10_cor_grand_buech.par",
hrus <- read.table("superjams/data/J2K_cowat/parameter/hru_cowat_smallminarea_grand_buech.par",
skip = 5,
sep= "\t",
dec = ".") %>%
......@@ -70,7 +71,7 @@ vertexAtributes <- vertexList$name %>% as.data.frame() %>%
mutate(area = replace_na(area,1000000))
#subnum = "north-west-hru-ploy"
subnum = "subbassin-GB"
subnum = "subbassin-GB-smallminarea-hru"
pdf(paste0("topology_", subnum,".pdf"), height = 16, width = 11) #en A3 pour tout le bassin
#pdf(paste0("topology_", subnum,".pdf"), paper ="a4")
plot(hruNtw,
......@@ -122,22 +123,27 @@ hrusSubbassins <- hrusSubbassins %>%
as.data.frame() %>%
tbl_df()
#hrusSubbassins %>% write.table("hrus-subassins-for-balance-test.csv",
# dec= ".",
# sep=";",
# row.names = F)
hrusSubbassins <- read.table("hrus-subassins-for-balance-test.csv",
hrusSubbassins %>% write.table("minareahrus-subassins-for-balance-test.csv",
dec= ".",
sep=";",
header = T) %>%
tbl_df()
row.names = F)
#hrusSubbassins <- read.table("hrus-subassins-for-balance-test.csv",
# dec= ".",
# sep=";",
# header = T) %>%
# tbl_df()
hrusSubbassins %>%
group_by(bassin) %>%
count() %>% filter(n< 10)
hrusSubbassins %>% filter(bassin == 51)
hrusSubbassins %>%
filter(bassin == 45) %>%
pull(Hrus) %>% paste(sep=",",collapse = ",")
plot(bassinsList[[45]],
edge.arrow.size=.2)
testVertexAtributes <- testVertexList$name %>% as.data.frame() %>%
mutate_("id"=".") %>%
......
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