Skip to content
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

removing one of the cohort #39

Closed
trotsiuk opened this issue Jul 6, 2020 · 2 comments
Closed

removing one of the cohort #39

trotsiuk opened this issue Jul 6, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@trotsiuk
Copy link
Owner

trotsiuk commented Jul 6, 2020

This issue appears if one of the cohort is thinned to 0. Unfortunately, the last thinning for Picea able_1 provide NA, and cause all the simulation to be NA afterwards.

f_loc <- ""
 out_3PG <- run_3PG(site        = read_xlsx(f_loc, 'site'),
                    species     = read_xlsx(f_loc, 'species'),
                    climate     = prepare_climate(climate = read_xlsx(f_loc, 'climate'), from = read_xlsx(f_loc, sheet = 'site')$from, to = read_xlsx(f_loc, sheet = 'site')$to),
                    thinning    = read_xlsx(f_loc, 'thinning'),
                    parameters  = read_xlsx(f_loc, 'parameters'),
                    size_dist   = read_xlsx(f_loc, 'sizeDist'),
                    settings    = list(light_model = 2, transp_model = 2, phys_model = 2, height_model = 2, correct_bias = 1, calculate_d13c = 0),
                    check_input = TRUE, df_out = TRUE)

This issue is not occurring if I test with the internal data.

library(r3PG)
library(dplyr)
library(ggplot2)

d_thinning$stems_n <- c(500.1, 600.8, 0)

out_3PG <- run_3PG(
  site        = d_site, 
  species     = d_species, 
  climate     = d_climate, 
  thinning    = d_thinning,
  parameters  = d_parameters, 
  size_dist   = d_sizeDist,
  settings    = list(light_model = 2, transp_model = 2, phys_model = 2, 
    height_model = 1, correct_bias = 0, calculate_d13c = 0),
  check_input = TRUE, df_out = TRUE)

sel_var <- c('biom_stem', 'biom_foliage', 'biom_root', 'stems_n')

out_3PG %>%
  filter( variable %in% sel_var ) %>%
  ggplot( aes(date, value, color = species) ) +
  geom_line() +
  facet_wrap(~variable, scales = 'free') +
  theme_classic()

1019000_input.xlsx

@trotsiuk trotsiuk added bug Something isn't working question Further information is requested labels Jul 6, 2020
@trotsiuk trotsiuk self-assigned this Jul 6, 2020
@trotsiuk
Copy link
Owner Author

from @DavidForrester

if a cohort is removed from a simulation (by thinning or dying)
before the simulation is supposed to end, the simulation ends prematurely.
I have also added an example of this "1015002_input.xlsx".

1015003_input.xlsx

trotsiuk added a commit that referenced this issue Feb 4, 2021
…ed NA to the bias correction.

Therefore, we had to assign everything to sero, similar as with cohort that didn't regenerated yet.

#39
@trotsiuk trotsiuk removed the question Further information is requested label Feb 4, 2021
@trotsiuk
Copy link
Owner Author

trotsiuk commented Feb 4, 2021

DONE

@DavidForrester

@trotsiuk trotsiuk closed this as completed Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant