Skip to content

Commit

Permalink
Fixed #12
Browse files Browse the repository at this point in the history
  • Loading branch information
sbuis committed Feb 16, 2024
1 parent 3b0265a commit 73e78ae
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions R/stics_wrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -493,17 +493,20 @@ stics_wrapper <- function(model_options,
simulate <- tmp$simulate
varmod_modified <- tmp$varmod_modified

# For phenological stages, set the value obtained at the last date
# for all dates
# For phenological stages, replace the zeros by the following non-zero
# value (works even in case of simulations replicated on several years
# within a single USM)
if (length(tmp$sim_list) > 0) {
if (length(intersect(stages_list, names(sim_list[[ip]])) > 0)) {
sim_list[[ip]] <-
sim_list[[ip]] %>%
dplyr::mutate(
sim_list[[ip]],
dplyr::across(
dplyr::all_of(
intersect(stages_list, names(sim_list[[ip]]))),
~.x[length(.x)])
intersect(stages_list, names(.))
),
~dplyr::na_if(., 0)) %>%
tidyr::fill(everything(), .direction = "up")
)
}
}
Expand Down

0 comments on commit 73e78ae

Please sign in to comment.