-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BiomeE output contains repeated cID
since splitting does not generate a new cID
#280
Comments
Promised MWE: MWE (for test-driven-development) # Test gs_leuning simulation:
new_biomee_gs_leuning_output <- runread_biomee_f(
biomee_gs_leuning_drivers,
makecheck = TRUE,
parallel = FALSE)
new_biomee_gs_leuning_output_cohort <- new_biomee_gs_leuning_output |>
unnest_wider(data, simplify = FALSE) |>
unnest(output_annual_cohorts)
new_biomee_gs_leuning_output_cohort |>
group_by(year) |>
summarise(cohort_IDs = paste0(cID, collapse=","),
has_duplicated_cID = any(duplicated(cID))) |>
tail()
# Test p_model transient simulation over 250 years (remove spinup to understand what happens):
new_biomee_p_model_drivers <- biomee_p_model_drivers
forcing_2009 <- new_biomee_p_model_drivers$forcing[[1]]
new_forcing <- forcing_2009
base_year <- lubridate::year(new_forcing$date[1])
for (it in 1:250){
add_year_forcing <- forcing_2009
lubridate::year(add_year_forcing$date) <- base_year + it
new_forcing <- bind_rows(new_forcing, add_year_forcing)
}
new_biomee_p_model_drivers$forcing[[1]] <- new_forcing
new_biomee_p_model_drivers$params_siml[[1]]$spinup <- TRUE # NOTE if we set this to FALSE this gives gibberish output
new_biomee_p_model_drivers$params_siml[[1]]$spinupyears <- 0
new_biomee_p_model_drivers$params_siml[[1]]$nyeartrend <- nrow(new_biomee_p_model_drivers$forcing[[1]])/365
new_biomee_p_model_output <- runread_biomee_f(
new_biomee_p_model_drivers,
makecheck = TRUE,
parallel = FALSE)
new_biomee_p_model_output_cohort <- new_biomee_p_model_output |>
unnest_wider(data, simplify = FALSE) |>
select(sitename, output_annual_cohorts) |>
unnest(output_annual_cohorts)
# new_biomee_p_model_output_cohort |> print(n=100)
# new_biomee_p_model_output_cohort |> group_by(cID) |> summarise(years = paste0(year, collapse=","))
new_biomee_p_model_output_cohort |> group_by(year) |>
summarise(cohort_IDs = paste0(cID, collapse=","),
has_duplicated_cID = any(duplicated(cID))) |> print(n=50) # duplication starts in year 38
# # A tibble: 251 × 3
# year cohort_IDs has_duplicated_cID
# <dbl> <chr> <lgl>
# 1 1 1 FALSE
# 2 2 1 FALSE
# 3 3 1 FALSE
# 4 4 1 FALSE
# 5 5 1 FALSE
# 6 6 1 FALSE
# 7 7 1 FALSE
# 8 8 1 FALSE
# 9 9 1 FALSE
# 10 10 1,2 FALSE
# 11 11 1,2 FALSE
# 12 12 1,2 FALSE
# 13 13 1,2,3 FALSE
# 14 14 1,2,3 FALSE
# 15 15 1,2,3,4 FALSE
# 16 16 1,2,3,4 FALSE
# 17 17 1,2,3,4,5 FALSE
# 18 18 1,2,3,4,5,6 FALSE
# 19 19 1,2,3,4,5,7 FALSE
# 20 20 1,2,3,4,5,7,8 FALSE
# 21 21 1,2,3,4,5,7,9 FALSE
# 22 22 1,2,3,4,5,7,9,10 FALSE
# 23 23 1,2,3,4,5,7,9,11 FALSE
# 24 24 1,2,3,4,5,7,9,11,12 FALSE
# 25 25 1,2,3,5,7,9,11,13 FALSE
# 26 26 1,2,3,5,7,9,11,13,14 FALSE
# 27 27 1,2,3,5,7,9,11,13,15 FALSE
# 28 28 1,2,3,5,7,9,11,13,15,16 FALSE
# 29 29 1,2,3,5,7,9,11,13,15,17 FALSE
# 30 30 1,2,3,5,9,11,13,15,17,18 FALSE
# 31 31 1,2,3,5,9,11,13,15,17,19 FALSE
# 32 32 1,2,3,5,9,11,13,15,17,19,20 FALSE
# 33 33 1,2,3,5,9,11,13,15,17,19,21 FALSE
# 34 34 1,2,3,5,9,11,15,17,19,21,22 FALSE
# 35 35 1,2,3,5,9,11,15,17,19,21,23 FALSE
# 36 36 1,2,3,5,9,11,15,17,19,21,23,24 FALSE
# 37 37 1,2,5,9,11,15,17,19,21,23,24,25 FALSE
# 38 38 1,2,5,9,11,15,19,21,21,23,25 TRUE
# 39 39 1,2,5,11,15,15,19,21,23,25 TRUE
new_biomee_p_model_output_cohort |> group_by(year) |>
summarise(cohort_IDs = paste0(cID, collapse=","),
has_duplicated_cID = any(duplicated(cID))) |> tail() # now only cohort 25 remains duplicated
# # A tibble: 6 × 3
# year cohort_IDs has_duplicated_cID
# <dbl> <chr> <lgl>
# 1 246 25,25,25,25,25,25 TRUE
# 2 247 25,25,25,25,25 TRUE
# 3 248 25,25,25,25,25 TRUE
# 4 249 25,25,25,25,25 TRUE
# 5 250 25,25,25,25,25 TRUE
# 6 251 25,25,25,25,25 TRUE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The column
cID
in the BiomeE model output contains repeated values for single years.I would expect each cID to appear only once for each year.
Below MWE indicates, that upon splitting of cohorts no new cIDs are generated.
Thus we end up with multiple times the same ID for distinct cohorts.
relayer_cohorts()
ccID
and increaseMaxCohortID
, instead of copying over the old one (Should we rename this tonextFreeCcID
?)rsofun/src/vegetation_biomee.mod.f90
Line 1271 in c50d858
vegn_mergecohorts()
(can we make it so thatccID
of the larger one remains?)ccID
spinup <- FALSE
(Note thatcohort is at 8188
. One-off error?The text was updated successfully, but these errors were encountered: