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

adjusted plot_variable_at_harvkill

parent 09026583
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,9 @@ add_kill_op <- function(project_path){ ...@@ -19,7 +19,9 @@ add_kill_op <- function(project_path){
i <- grep("hvkl", mgt_sch)[1] i <- grep("hvkl", mgt_sch)[1]
kill_line <- str_replace(mgt_sch[i], "hvkl", "kill") %>% kill_line <- str_replace(mgt_sch[i], "hvkl", "kill") %>%
str_replace(c("forest_cut|grain1|grain|grass_bag|grass_mulch|hay_cut_high|hay_cut_low|orchard|peanuts| str_replace(c("forest_cut|grain1|grain|grass_bag|grass_mulch|hay_cut_high|hay_cut_low|orchard|peanuts|
silage|stover_high|stover_los|stover_med|tuber|vegetables"), "null") silage|stover_high|stover_los|stover_med|tuber|vegetables"), "null") %>%
str_replace_all("[:digit:]", "0") %>%
str_replace("0.00000", "0.00001") ## Kill operation at 0.00001 HU, same day as harvest.
mgt_sch[i] <- str_replace(mgt_sch[i], "hvkl", "harv") mgt_sch[i] <- str_replace(mgt_sch[i], "hvkl", "harv")
mgt_sch <- insert_line_at(mgt_sch, kill_line, insert_after=i) mgt_sch <- insert_line_at(mgt_sch, kill_line, insert_after=i)
l <- l+1 l <- l+1
......
...@@ -29,6 +29,17 @@ plot_variable_at_harvkill <- function(sim_verify, variable, years = 1900:2100) { ...@@ -29,6 +29,17 @@ plot_variable_at_harvkill <- function(sim_verify, variable, years = 1900:2100) {
ungroup() %>% ungroup() %>%
filter(n == 2, operation == 'HARVEST') filter(n == 2, operation == 'HARVEST')
##Just in case dates of harvest and kill differ a bit
if(dim(tbl_harv)[1] == 0){
tbl_harv <- sim_verify$mgt_out %>%
filter(year %in% years) %>%
filter(operation %in% c('HARVEST', 'KILL')) %>%
group_by(hru,year, mon) %>%
mutate(n = n()) %>%
ungroup() %>%
filter(n == 2, operation == 'HARVEST')
}
if(variable == 'phu') { if(variable == 'phu') {
tbl_harv <- tbl_harv %>% tbl_harv <- tbl_harv %>%
select(op_typ, phuplant) %>% select(op_typ, phuplant) %>%
......
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