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

Resolved cohort outputs issue #211

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions R/run_biomee_f_bysite.R
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,10 @@ run_biomee_f_bysite <- function(
init_Nmineral = as.numeric(init_soil$init_Nmineral),
N_input = as.numeric(init_soil$N_input),
n = as.integer(nrow(forcing)), # n here is for hourly (forcing is hourly), add n for daily and annual outputs
n_daily = as.integer(n_daily), # n here is for hourly (forcing is hourly), add n for daily and annual outputs
n_annual = as.integer(runyears), # n here is for hourly (forcing is hourly), add n for daily and annual outputs
#n_annual_cohorts = as.integer(params_siml$nyeartrend), # n here is for hourly (forcing is hourly), add n for daily and annual outputs
n_annual_cohorts = as.integer(runyears), # n here is for hourly (forcing is hourly), add n for daily and annual outputs
n_daily = as.integer(n_daily),
n_annual = as.integer(runyears),
n_annual_cohorts = as.integer(params_siml$nyeartrend), # to get cohort outputs after spinup year
#n_annual_cohorts = as.integer(runyears), # to get cohort outputs from year 1
forcing = as.matrix(forcing)
)

Expand Down
10 changes: 9 additions & 1 deletion src/sofun_r.f90
Original file line number Diff line number Diff line change
Expand Up @@ -768,10 +768,18 @@ subroutine biomee_f( &
!----------------------------------------------------------------
! Output output_annual_cohorts (without subroutine)
!----------------------------------------------------------------
if (.not. myinterface%steering%spinup) then ! To get outputs only after spinupyears

! To get outputs only after spinupyears make if below and
! also in run_biomee_f_bysite.R make n_annual_cohorts = as.integer(params_siml$nyeartrend)

if (.not. myinterface%steering%spinup) then

idx = yr - myinterface%params_siml%spinupyears

! To get outputs for all runyears idx=yr and also in run_biomee_f_bysite.R make n_annual_cohorts = as.integer(runyears)

!idx = yr

output_annual_cohorts_year(idx, :) = dble(out_biosphere%annual_cohorts(:)%year)
output_annual_cohorts_cID(idx, :) = dble(out_biosphere%annual_cohorts(:)%cID)
output_annual_cohorts_PFT(idx, :) = dble(out_biosphere%annual_cohorts(:)%PFT)
Expand Down
Loading