Skip to content

Groundwork luluc (Biomee) #277

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

Closed
wants to merge 107 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
bf3fc83
Implement dummy LULUC data structures
Dec 12, 2024
b291292
- Reworked internal data structures as groundwork for LULUC.
Dec 13, 2024
17efa3d
Merge branch 'master' into preparation_luluc
marcadella Dec 13, 2024
cd5ef56
Fix doc
Dec 13, 2024
a7c1929
Fix doc
Dec 13, 2024
f5db742
Wraper cleanup
Dec 13, 2024
3e8dfad
Simplify interface (init_soil)
Dec 16, 2024
8369003
Simplify interface (params_tile)
Dec 16, 2024
54e30b8
Simplify interface (params_species)
Dec 16, 2024
6f15d42
Add name to init_lu
Dec 16, 2024
9c018ea
Fix doc
Dec 16, 2024
c1ef978
Remove unused code
Dec 17, 2024
3f0110a
Simplify interface
Dec 17, 2024
2ac4016
Fix doc
Dec 17, 2024
c3d3e19
Minor
Dec 17, 2024
596b5be
Implement LULUC outputs
Dec 17, 2024
c9559ff
Fix issue with parallel run (due to flattening of arrays of dim 1) an…
Dec 18, 2024
e170e8d
Fix doc and make deprecated falgs less verbose.
Dec 19, 2024
f0d9bb1
Fix issue with runread_biomee not being able to deal with missing col…
Dec 19, 2024
687e4a5
Fix unit test hanging because spinup was engaged.
Dec 19, 2024
a85c6cb
Split sofun_r in two separate modules
Dec 19, 2024
657173e
Major refactoring:
Dec 19, 2024
6554b32
Fix test being verbose.
Dec 19, 2024
08ee685
Fix broken biomee p-model test
Dec 19, 2024
d668b70
Protect state from alteration in biosphere_annual
Dec 19, 2024
c6cbf8b
Remove unused code in get_steering
Jan 6, 2025
3657355
Code refactoring:
Jan 6, 2025
a686cfd
Implement outer loop for LULUC (so far, no effect on the pools)
Jan 6, 2025
943ef05
fixup! Implement outer loop for LULUC (so far, no effect on the pools)
Jan 6, 2025
30bd8f8
Add year in land use output, and fill in spinup too.
Jan 6, 2025
f5e4363
Add site info to myinterface to quiet down compile warning
Jan 6, 2025
cd67858
Add one vegn tile per LU, keeping memory separated for each.
Jan 7, 2025
4699699
Minor: cleanup units and initializations
Jan 7, 2025
a47212c
Minor: some more cleanup
Jan 7, 2025
a9574ca
Refactoring: use myinterface to get parameters rather than copying th…
Jan 7, 2025
77e0e12
Refactoring: minor clean-up (removed unused function reset_vegn_initial)
Jan 8, 2025
4e13ad9
Refactoring: minor clean-up
Jan 8, 2025
e86dcaf
Refactoring: minor clean-up
Jan 8, 2025
783339b
Factorize diagnostics out of cohorts
Jan 8, 2025
089d8f8
Removed flag update_annualLAImax as implementation was mutating param…
Jan 8, 2025
ed45512
Update news
Jan 9, 2025
3a39dc7
Refactoring: use function do generate derived variables rather using …
Jan 9, 2025
08591f8
Refactoring: factorize fast_fluxes in cohort
Jan 9, 2025
a03df9f
Refactoring: move cohort type to its own file. Functionalize in prepa…
Jan 9, 2025
7228c52
Refactoring: removed static variables in gpp
Jan 10, 2025
383b907
Refactoring: Move zeroing cohort function to cohort file
Jan 10, 2025
2bdaa30
Refactoring: Use OOP in cohorts
Jan 10, 2025
309f9ec
Refactoring: Use linked lists
Jan 14, 2025
1b558c4
Refactoring: renamed remove -> remove_cohort
Jan 15, 2025
a217707
Add capacity to sort cohorts by both increasing or decreasing height.
Jan 15, 2025
099fafe
Fix bug in annual_diagnostic
Jan 15, 2025
adab581
Fix initilizations: it is important to not initialise local variables…
Jan 15, 2025
b88992e
Fix bug during reproduction assigning wrong value to plabl
Jan 15, 2025
69782ea
Make implementation cohort independent. Does not change the output bu…
Jan 16, 2025
82d95db
Actually the previous commit changes slightly the outputs for p-model…
Jan 16, 2025
a109b44
Make implementation cohort independent. Does not change the output bu…
Jan 16, 2025
dcd219d
Actually the previous commit changes slightly the outputs for p-model…
Jan 16, 2025
e427398
Minor
Jan 16, 2025
831416e
Quick fix cohorts order
Jan 16, 2025
ea64564
Fix vegn_reproduction (wrong seed cumul computation)
Jan 17, 2025
86bb262
Make cohort_can_be_merge symmetric
Jan 17, 2025
b38c8c0
Add possibility to add to the tail
Jan 17, 2025
e3be2c4
Rename next -> heap
Jan 17, 2025
7ab8f77
Simplify implementation of relayer (avoid copying cohorts when not ne…
Jan 17, 2025
9fcd6d0
Fix issue when number of cohorts goes beyon the allowed number. Grace…
Jan 20, 2025
216c43e
Fix issue with inserting cohorts in tail
Jan 20, 2025
37d2a69
Fix issue with relayer not sorting by height (was happening after set…
Jan 20, 2025
6ad081f
Update the outputs (minor changes)
Jan 20, 2025
398e2ac
Merge branch 'preparation_luluc_linked_list' into preparation_luluc
Jan 20, 2025
858b168
Remove the fortran tests from project as it breaks CRAN checks (not a…
Jan 20, 2025
9a3c9ae
Just moving test calibaration biomee out of the way to check where th…
Jan 21, 2025
948159e
Removing gs leuning to check if p-model works
Jan 21, 2025
a51b9fc
Fix segfault
Jan 21, 2025
c1fd08b
Fix segfault
Jan 21, 2025
6ded769
Minor
Jan 21, 2025
7201b62
Factorize allometric variables as functions
Jan 21, 2025
66defa8
Replace obsolete ccID with the cohort's uid
Jan 21, 2025
5dc21ab
Reset uid at start of simulation
Jan 22, 2025
4cdab0d
Generic implementation of sort_cohort
Jan 22, 2025
041cc0a
Implement relayer in place and remove option to insert at the tail (w…
Jan 22, 2025
79cbc43
Implement killed_heap
Jan 23, 2025
882ecf7
Split abstract linked list
Jan 24, 2025
61a45db
Use pointer comparison rather than uid
Jan 24, 2025
3c2fea3
Make uid private
Jan 24, 2025
3501f64
Add cohort_pool type as a linked list wrapper
Jan 24, 2025
51d21d0
Minor: rename some methods
Jan 24, 2025
5dd2576
make cohort stacks private
Jan 24, 2025
db1a3e4
fix issue with duplicated uids (in cohort_list and killed_cohort_list)
Jan 24, 2025
7fb03c8
Minor
Jan 24, 2025
a1a6517
Implement deadtree diagnostics
Jan 24, 2025
77fecb8
Refactoring: clearer separation between vegetation tile and vegetatio…
Jan 27, 2025
c124a12
Re-generate outputs. No major difference. See comment in test-model-r…
Jan 27, 2025
6b392b6
Minor: remove un-necessary zeroing in gpp
Jan 27, 2025
ef7708f
Fix issue with deadtree pools being mis-labeled
Jan 27, 2025
7025aff
Factorize thetaS and water supply. Remove some unused variables.
Jan 28, 2025
350f3b9
Remove unused
Jan 28, 2025
b597148
Simplify vegn tile
Jan 28, 2025
7b76373
Minor refactoring
Jan 29, 2025
9af94d2
Simplify working with pools. Minor output changes
Jan 29, 2025
58530fe
Simplify working with pools.
Jan 29, 2025
ec356e6
Minor refactoring: add pure qualifiers
Jan 30, 2025
47d2cfa
Removed unused and error prone biomee interfaces.
Jan 30, 2025
d661070
Add output mappings
Jan 31, 2025
c9f0044
Refactoring class names and populate input interface using member pro…
Jan 31, 2025
b1cd50f
Minor refactoring
Jan 31, 2025
cfd8ba4
Minor refactoring: add comments
Feb 3, 2025
275f92d
Update upload-artifact version to v4 (compulsory)
Feb 3, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

* new BiomeE behavior to recycle last year of forcing if requested simulation time span (`nyeartrend`) is longer than
available forcing data
* Breaking change: biomee drivers' `init_cohort$init_n_cohorts` column has been phased out and must not be present in
* Breaking changes in biomee drivers
* `init_cohort$init_n_cohorts` column has been phased out and must not be present in
drivers to protect against data corruption.
* `update_annualLAImax` flag was removed and the behavior is now slightly altered since `LAImax` and `underLAImax` are set and kept constant at the start of the simulation:
* `LAImax` takes value `max(LAI_light, 0.5)`
* `underLAImax` takes value `min(LAImax, 1.2)`

# rsofun v5.0.0

Expand Down
18 changes: 3 additions & 15 deletions R/cost_likelihood_biomee.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ cost_likelihood_biomee <- function(
){

# predefine variables for CRAN check compliance
GPP <- LAI <- Density12 <- plantC <- error <- NULL
GPP <- LAI <- Density12 <- plantC <- NULL

# Add changed model parameters to drivers, overwriting where necessary.
drivers$params_species[[1]]$phiRL[] <- par[1]
Expand All @@ -65,21 +65,9 @@ cost_likelihood_biomee <- function(
parallel = FALSE
)

# did we spin up
spin_up <- drivers$params_siml[[1]]$spinup

# drop spinup years if activated
# see below
if (spin_up){
spin_up_years <- drivers$params_siml[[1]]$spinupyears + 1
} else {
spin_up_years <- 0
}

# Aggregate variables from the model df taking the last 500 yrs
# if spun up
# Aggregate variables from the model df taking the last 50 yrs (up to)
df <- df$data[[1]]$output_annual_tile |>
utils::tail(500 - spin_up_years) |>
utils::tail(50) |>
dplyr::summarise(
GPP = mean(GPP),
LAI = stats::quantile(LAI, probs = 0.95, na.rm=TRUE),
Expand Down
26 changes: 11 additions & 15 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,14 @@
#' \item{params_siml}{Simulation parameters as a data.frame, including
#' the following data:
#' \describe{
#' \item{spinup}{Flag indicating whether this simulation does spin-up.}
#' \item{spinupyears}{Number of spin-up years.}
#' \item{spinup}{Flag indicating whether this simulation does spin-up (deprecated).}
#' \item{spinupyears}{Number of spin-up years. Set to 0 for no spinup.}
#' \item{recycle}{Number of first N years of forcing data.frame that are recycled for spin-up.}
#' \item{firstyeartrend}{Year of first transient year (AD) (optional). Is only used to set years in output data frames. Defaults to 0 if not provided.}
#' \item{nyeartrend}{Number of transient years (optional). Determines the length of simulation output after spin-up. Defaults to number of years contained in the forcing data. (If longer than forcing data, last year of forcing is repeated until the end (spin-down).)}
#' \item{steps_per_day}{Time resolution of the forcing (day-1).}
#' \item{do_U_shaped_mortality}{Flag indicating whether U-shaped
#' mortality is used.}
#' \item{update_annualLAImax}{Flag indicating whether updating
#' LAImax according to mineral N in soil.}
#' \item{do_closedN_run}{Flag indicating whether doing N closed
#' runs to recover N balance enforcing 0.2 kg N m-2 in the inorganic N pool.}
#' \item{code_method_photosynth}{String specifying the method of photosynthesis
Expand Down Expand Up @@ -285,7 +283,7 @@
#' \item{betaOFF}{Critical soil moisture for phenology offset.}
#' \item{seedlingsize}{Initial size of seedlings, in kg C per individual.}
#' \item{LNbase}{Basal leaf N per unit area, in kg N m\eqn{^{-2}}.}
#' \item{lAImax}{Maximum crown LAI (leaf area index).}
#' \item{lAImax}{Maximum crown LAI (leaf area index) (not used, see LAI_light).}
#' \item{Nfixrate0}{Reference N fixation rate (kg N kg C\eqn{^{-1}} root).}
#' \item{NfixCost0}{Carbon cost of N fixation (kg C kg N\eqn{^{-1}}).}
#' \item{phiCSA}{Ratio of sapwood area to leaf area.}
Expand Down Expand Up @@ -356,16 +354,14 @@
#' Dataset. https://doi.org/10.18140/FLX/1440134
"biomee_validation"

#' rsofun BiomeE (P-model) output data
#'
#' Example output dataset from a BiomeE-model run (p-model)
#' See \code{\link{run_biomee_f_bysite}} for a detailed
#' description of the outputs.
"biomee_p_model_output"

#' rsofun BiomeE (gs_leuning) output data
#'
#' Example output dataset from a BiomeE-model run (gs_leuning)
#' See \code{\link{run_biomee_f_bysite}} for a detailed
#' description of the outputs.
#' Example output dataset from a BiomeE-model run using divers \code{\link{biomee_gs_leuning_drivers}}
#' See \code{\link{run_biomee_f_bysite}} for a detailed description of the outputs.
"biomee_gs_leuning_output"

#' rsofun BiomeE (P-model) output data
#'
#' Example output dataset from a BiomeE-model run using divers \code{\link{biomee_p_model_drivers}}
#' See \code{\link{run_biomee_f_bysite}} for a detailed description of the outputs.
"biomee_p_model_output"
Loading
Loading