Commit 35da655b authored by Bruno Bonte's avatar Bruno Bonte
Browse files

transfer surface from removed hruplots to tronquated hrus

	modifié :         output/compare-hru-plot-bilans.R
	modifié :         superjams/data/J2K_cowat/parameter/hru_cowat_smallminarea_grand_buech.par
	modifié :         tools/cleaning-hru-pars/cleaning-hru.R
parent 7f9b457b
......@@ -32,6 +32,14 @@ globalWaterSummary %>%
ggplot() +
geom_line(aes(y = diffRunOff, x = day))
globalWaterSummary %>%
select(day, runoff, hruType) %>%
spread(hruType, runoff) %>%
mutate(diffRunOff = (Big - WithHruPlots)) %>%
ggplot() +
geom_line(aes(y = diffRunOff, x = day))
# Local
localWaterSummaryBigH <- read.table(paste0("output/localwaterBalance-bigTRUE_GB.csv"),
header = T,
......
# Suppression par Bruno Bonte des hrus de surface < 10m2 depuis "hru_cowat_10_cor_gand_buech.par created 17 Mar 2021 by B.Richard: area correction"
# Suppression par Bruno Bonte des hrus de surface < 10m2 et report de la surface vers les hrus trounquees correspondantes (depuis "hru_cowat_10_cor_gand_buech.par created 17 Mar 2021 by B.Richard: area correction"
ID area elevation slope aspect x y watershed subbasin hgeoID landuseID soilID to_poly to_reach
0 0 0 0 0 0 0 0 0 0 0 0 0 0
999999 9999999 10000 90 360 9999999 9999999 999999 999999 9999 9999 9999 999999 999999
......
......@@ -4,6 +4,8 @@ library(dplyr)
library(tidyr)
library(stringr)
minArea <- 10
hrus <- read.table("superjams/data/J2K_cowat/parameter/hru_cowat_10_cor_grand_buech.par",
skip = 5,
sep= "\t",
......@@ -12,11 +14,29 @@ hrus <- read.table("superjams/data/J2K_cowat/parameter/hru_cowat_10_cor_grand_bu
#nb correspondance collonnes: V1, V2, V6, V7, V9, V13, V14
#id,area,x,y,subbassin,to_poly,to_reach
toosmall_hrus <- hrus %>%
filter(V2 < minArea) %>%
tbl_df()
valide_hrus <- hrus %>%
filter(V2 > 100) %>%
filter(V2 >= minArea) %>%
tbl_df()
write.table(valide_hrus,
areaToAdd <- toosmall_hrus %>%
select(V2, V13) %>%
rename(areaToAdd = V2, id = V13) %>%
group_by(id) %>%
summarise(areaToAdd = sum(areaToAdd)) %>%
filter(id >0)
corrected_hrus <- valide_hrus %>%
rename(id = V1) %>%
left_join(areaToAdd) %>%
mutate(areaToAdd = replace_na(0)) %>%
mutate(V2 = V2 + areaToAdd) %>%
select(-areaToAdd)
write.table(corrected_hrus,
"hru_cowat_withplots.par.dat",
sep = "\t",
dec= ".",
......
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