Skip to content
Snippets Groups Projects
Commit 7943cc15 authored by Svajunas Plunge's avatar Svajunas Plunge
Browse files

plot_qtile updated

parent 45810f3f
No related branches found
No related tags found
No related merge requests found
......@@ -110,15 +110,28 @@ print_avannual_qtile <- function(sim_verify,
plot_qtile <- function(sim_verify, exclude_lum = c("urhd_lum", "urmd_lum", "urml_lum",
"urld_lum", "ucom_lum", "uidu_lum",
"utrn_lum", "uins_lum", "urbn_lum")){
df <- print_avannual_qtile(sim_verify, exclude_lum)
df <- sim_verify$hru_wb_aa %>%
rename(id = unit) %>%
left_join(., sim_verify$lum_mgt, by = "id") %>%
filter(tile != 'null')
hru_frac <- paste0(as.character(round(100*count(df)/count(sim_verify$hru_wb_aa),2)), " % HRUs are drained in this catchment.")
df <- df %>%
filter(!lu_mgt %in% exclude_lum) %>%
select(id, qtile, lu_mgt, mgt, soil) %>%
arrange(qtile, id)
fig <- ggplot(df, aes(x=qtile)) +
geom_histogram(aes(y=..density..), color="black", fill="blue", breaks = seq(min(df$qtile), max(df$qtile), 10))+
geom_histogram(aes(y=after_stat(density)), color="black", fill="blue", breaks = seq(min(df$qtile), max(df$qtile), 10))+
geom_density(alpha=.3, fill="white", linewidth = 1, color = "grey25", linetype = "twodash")+
labs(title = "Tile drain flow density mm/year")+
labs(title = "Tile drain flow density mm/year",
subtitle = hru_frac,
caption = "Data in the figure represents only HRUs with active tile drainage.")+
theme_bw()+
theme(panel.border = element_blank(),
axis.line = element_line(color='black'),
axis.title.x=element_blank())
return(fig)
}
......@@ -6,7 +6,7 @@
</style>
---
title: "Your title"
title: "Jeziorka catchment"
author: "name surname"
affiliation: "your affiliation"
email: "your@email"
......@@ -41,7 +41,7 @@ add_kill_op(model_path)
##Running loop to get and save run_swat_verification function output for different plant stress options
for(ns in c(0:2)){
saveRDS(run_swat_verification(project_path = model_path, outputs = c('wb', 'mgt', 'plt'),
nostress = ns, keep_folder = TRUE), file = rpath[[ns]])}
nostress = ns, keep_folder = TRUE), file = rpath[[ns+1]])}
```
Before starting model verification `run_swat_verification()`results should be loaded in the memory. The first two steps require function results without plant stresses activate (`nostress = 1`).
......@@ -149,7 +149,7 @@ if(length(mgt_report$schedule)>=sel_nb){
Selected case can be examined in figures plotting selected HRU variables. Following variables are available for plotting.
- *lai m^2/m^2 |average leaf area index during timestep*
- *lai m^2^/m^2^ |average leaf area index during timestep*
- *bioms kg/ha |average total plant biomass during timestep*
- *yield kg/ha |harvested biomass yield (dry weight) during timestep*
- *residue kg/ha |average surface residue cover during timestep*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment