Warming drives large-scale shifts in post-disturbance vegetation dynamics and expansion of deciduous trees in the boreal forest in a dynamic vegetation model.
This repository contains code and data needed to reproduce the data analysis and figures of the paper Warming drives large-scale shifts in post-disturbance vegetation dynamics and expansion of deciduous trees in the boreal forest in a dynamic vegetation model. by Layritz et al., currently under review in * JGR Biogeosciences*
Per default, this repository only contains the data that directly feeds into the plots. To reproduce upstream analyses and appendix plots, the original database and auxillary data needs to be downloaded from https://doi.org/10.5281/zenodo.13731857.
This will describe the workflow to reproduce all findings bottom up
The data underlying all figures of the main article can be found in data/final. The scripts to create the figures can be found in code/*.plot.R
To reproduce the data analysis, raw data files need to be downloaded from Zenodo (https://doi.org/10.5281/zenodo.13731857)
-
Patch level LPJ-GUESS output stored in a duckdb database (lives in root directory)
-
Other raw data (lives in
data/raw)- Grid cell level LPJ-GUESS output
- Climate data used to force LPJ-GUESS and for statistical analyses (lives in
data/raw)
-
Input and Output of random forest model (lives in
data/random_forest) -
add data to zenodo
This involves running the script family 2*.R in order and then the *_final.R script for the plot of interest. (This runs locally on my machine but does need some RAM, so I can't guarantee it will run on yours.)
The script to do so is 01_create_database.R. If you want to reproduce, please contact me for the original data. (If you're future me: Original data is on hard drive <3)
The code lies in code/python. 01_Prepare_data.ipynb creates zarr files. 02_Run_models_parallel.py runs model. template_start_rf.sbatch starts all models on the cluster.
Note that some data is not contained in the repository. The tree indicates where they need to live after downloading to make the worklow runs through. Working directory should be handled by the here() package but might need adaption.
├── code 📁
│ └── 00_Validation.R📄 intial assesment if aboveground carbon is the correct order of magnitude
│ └── 01_Create_database.R📄 creates duckdb database
│ └── 02*.R📄 creates processed data from database and raw data
│ └── *_final.R📄 creates final data from processed
│ └── *_plot.R📄 create figures from final data
│ └── X*.R📄 create appendix figures
│ └── util.R📄 various helper functions for plotting
├── data 📁 model output on various steps of processing
│ └── raw 📁 raw data. This is not contained in the repository but needs to be obtained from zenodo
│ └── *_pft 📁 raw LPJ-GUESS output
│ └── climate_data 📁 Climate data
│ └── random_forest 📁 input and output data of random forest model
│ └── external 📁 External data not generated in this study
│ └── processed 📁 *intermediate data. This is not contain the the repository but needs to be created with **_processed.R📄
│ └── final 📁 The data directly underlying the figures, generated with *_processed_final.R
│ └── shp 📁 The shapefiles used for plotting maps.
├── plots 📁 Contains all the plots of the paper. The plots are generated by the scripts *_plot.R.
├── *.duckdb: DuckDB database 🦆 Patch data database. This is not contained in the repository and needs to be downloaded from zenodo
This analysis was originally performed on the Leibniz Center for Supercomputing RStudioCloud using R Version 4.4.1 (2024-06-14) running under Ubuntu 22.04.3. See below for packages and version. Claude Sonnet 4.6 was used to refactor code for revision of paper and testing reproducibility of all workflows, but not during original analysis.
rnaturalearthdata (1.0.0) rnaturalearth (1.0.1) ggnewscale (0.5.0) scico (1.5.0) cowplot (1.1.3) MASS (7.3-60.2) duckdb (1.0.0) DBI (1.2.3) terra(1.7-78) sf (1.0-16) lubridate (1.9.3) forcats (1.0.0) stringr (1.5.1) dplyr (1.1.4) purrr (1.0.2) readr (2.1.5) tidyr (1.3.1) tibble (3.2.1) ggplot2 (3.5.1) tidyverse (2.0.0) zoo (1.8-12) splines