|
| 1 | +# {mocaredd}: Monte Carlo Simulations for REDD+ uncertainty analysis |
| 2 | + |
1 | 3 | <!-- badges: start --> |
| 4 | + |
2 | 5 | [](https://github.com/openforis/mocaredd/actions/workflows/R-CMD-check.yaml) |
| 6 | + |
3 | 7 | <!-- badges: end --> |
4 | 8 |
|
5 | | -**THIS TOOL IS UNDER DEVELOPMENT** |
6 | | -**Current development version 0.3.0** |
| 9 | +#### {mocaredd} is a free and opensource application that aims at making simulation-based uncertainty calculations for REDD+ easier to process, report and verify. |
| 10 | + |
| 11 | +It works by combining the strengths of spreadsheet tools (XLSX) for templating and a statistical language (R) for running the simulations, aggregating results and producing helpful visuals. |
| 12 | + |
| 13 | +<!-- new section --> |
| 14 | + |
| 15 | +## What for? |
| 16 | + |
| 17 | +In the context of the REDD+ mechanism (Reducing emission from Deforestation and forest Degradation "plus"), countries can receive result-based payments for emission reductions and removal increases of greenhouse gas (GHG) from the forestry sector. Emission reductions are estimated by quantifying the amount of greenhouse gas emissions between a reference level (i.e baseline) and a monitorig period. These estimates come with a level of uncertainty due to the sampling methods and models used to generate the estimations. |
| 18 | + |
| 19 | +High integrity REDD+ standards, that set rules for the quantification of emissions and removals, and their uncertainties, increasingly require the use of Monte Carlo simulations for REDD+ uncertainties. These simulations are often run in spreadsheet tools, but the lack of structure and inherent disadvantage of spreadsheets for this task (error prone, difficulty to handle large amount of data) is becoming a barrier for the quality, reproducibility and verification of uncertainties based on simulations. |
| 20 | + |
| 21 | +{mocaredd} provides a template for organizing data, and a tool that takes the data, runs Monte Carlo Simulations and produces improved estimates of and confidence intervals around greenhouse gas emissions and emission reductions from the forestry sector (REDD+). |
| 22 | + |
| 23 | +<!-- new section --> |
| 24 | + |
| 25 | +## How to run the application ? |
| 26 | + |
| 27 | +The application is available online (read-to-use) at: <https://openforis-shiny.shinyapps.io/mocaredd/> |
| 28 | + |
| 29 | +It can also be installed for offline use (require installing R and Rstudio, may require administrator permission). The app require R version 3.4 minimum. RStudio is recommended as Integrated Development Environment. With Windows machines, Rtools should also be installed: |
7 | 30 |
|
8 | | -<i> |
9 | | -Features: |
| 31 | +- [https://cloud.r-project.org/]() |
| 32 | +- [https://posit.co/download/rstudio-desktop/]() |
| 33 | +- [https://cran.r-project.org/bin/windows/Rtools/]() |
10 | 34 |
|
11 | | -- Download a demo template with user inputs, time periods, land use change areas, carbon elements. |
12 | | -- User filled template submission to the tool, |
13 | | -- Verification of template integrity, |
14 | | -- Build calculation chain from input data to greenhouse gas emission reductions (ER) |
15 | | -- Calculate arithmetic mean ERs from input data |
16 | | -- Run simulations for all variables and reproduce calculation chain for each simulation |
17 | | -- Calculate the median of simulated ERs as a better estimate than the arithmetic mean |
18 | | -- Calculate uncertainty as quantiles of simulations at the chosen level |
19 | | -- Show medians and confidence intervals at intermediate level (REDD+ activities, activity data and emission factors) |
| 35 | +R and Rstudio are installed, open R studio and run the folloing code in the terminal: |
20 | 36 |
|
21 | | -Planned features: |
| 37 | +``` |
| 38 | +if (!require(remotes)) install.packages("remotes") |
| 39 | +if (!require(mocaredd)) remotes::install_github("openforis/mocaredd@v1.0") |
22 | 40 |
|
23 | | -- Tutorial on filling in the template with examples for various country circumstances |
24 | | -- Additional template tab and calculations for annual processes (removals, soil organic carbon degradation) |
25 | | -- Sensitivity analysis for activity data vs emission factors, REDD+ activities, different land use changes |
26 | | -</i> |
| 41 | +mocaredd::shiny_run_mocaredd() |
| 42 | +``` |
27 | 43 |
|
| 44 | +<!-- new section --> |
28 | 45 |
|
29 | | -# {mocaredd}: Monte Carlo Simulations for REDD+ uncertainty analysis |
| 46 | +## Step-by-Step app workflow |
30 | 47 |
|
31 | | -Contains functions and a shiny app for (1) setting up, (2) running Monte Carlo Simulations and (3) producing improved estimates of and confidence intervals around greenhouse gas emissions and emission reductions from the forestry sector. |
| 48 | +1. The app provides a template spreadsheet to download, either directly in the app or here (see Resources below): |
32 | 49 |
|
33 | | -The apps takes an input XLSX file following a specific template meant to harmonize reporting of areas of land use transitions and associated carbon stocks. It then provides simulations, medians, percentage uncertainties and confidence intervals at various stages of aggregation from emissions related land use transitions to REDD+ activities and emission reductions between reference and monitoring periods. |
| 50 | +2. The user fills in the spreadsheet 4 tabs: |
34 | 51 |
|
35 | | -\ |
| 52 | + 1. **User inputs** (user_inputs). Helps offering great flexibility with a minimum number of parameters. |
36 | 53 |
|
37 | | -### Run the app |
| 54 | + 2. **Time periods** (time_periods). Describes the times periods covered by the data and how they are combined into reference or reporting. |
38 | 55 |
|
39 | | -#### Online (experimental) |
| 56 | + 3. **Land use transitions** (AD_lu_transitions). Describes the probability density functions (PDFs) for the land use change areas for each time period |
40 | 57 |
|
41 | | -https://gaelsola.shinyapps.io/mocaredd/ |
| 58 | + 4. **Carbon stocks** (c_stocks). Contains the probability density functions for all the carbon elements necessary to associate emission or removal factors to all land use changes and time periods. |
42 | 59 |
|
| 60 | +3. The user upload the filled template into the tool. |
43 | 61 |
|
44 | | -#### Locally on your computer. |
| 62 | +4. The app run checks: |
45 | 63 |
|
46 | | -Although a bit ore cumbersome, the installation of R and Rstudio is now straightforward for the mast majority of computers. |
| 64 | + 1. verifies that all connections between time periods, land use changes and carbon elements are correctly entered, |
47 | 65 |
|
48 | | -The app require R version 3.4 minimum. RStudio is recommended as Integrated Development Environment. |
49 | | -With Windows machines, Rtools should also be installed: |
| 66 | + 2. provides an overview of the data (number of time periods, carbon pools, method for forest degradation, etc.), |
50 | 67 |
|
51 | | -- [https://cloud.r-project.org/]() |
52 | | -- [https://posit.co/download/rstudio-desktop/]() |
53 | | -- [https://cran.r-project.org/bin/windows/Rtools/]() |
| 68 | + 3. calculates the arithmetic mean of aggregated emission reductions (no simulation yet). |
54 | 69 |
|
55 | | -Install the package and run the app: |
| 70 | + 4. makes land use change matrices in ha. |
56 | 71 |
|
57 | | - if (!require(remotes)) install.packages("remotes") |
58 | | - if (!require(mocaredd)) remotes::install_github("openforis/mocaredd@v0.3.0") |
59 | | - |
60 | | - mocaredd::shiny_run_mocaredd() |
| 72 | +5. If all checks are passed, the app runs the simulations: |
61 | 73 |
|
| 74 | + 1. for each PDF, the determined number of simulations is randomly generated, then |
62 | 75 |
|
| 76 | + 2. the carbon accounting chain of calculations is created based on the data uploaded, |
63 | 77 |
|
64 | | -### Workflow |
| 78 | + 3. the simulations are aggregated to emissions per land use change, emissions and removals per REDD+ activity and time period, emissions reduction and increased removals for each monitoring period in the data. |
65 | 79 |
|
66 | | -1. Input XSLX file following provided template. |
67 | | -1. Checks are run to ensure the entity codes are unique and matching between tables. |
68 | | -1. Simulations are produced and results can be seen as forest plots, simulations densities and comparison between simulations and arithmetic means for the final emission reductions. |
69 | | -1. Sensitivity analysis shows the impact of AE vs EF, REDD+ activities, time periods. |
| 80 | + 4. The improved estimates and their confidence intervals are reported as the median and quantiles of the simulations at each stage of the aggregation. |
70 | 81 |
|
| 82 | +6. A sensitivity analysis is run to provide the respective contributions of REDD+ activities, activity data and emission factors, and time periods to the overall uncertainty. |
71 | 83 |
|
72 | | -### Calculation steps |
| 84 | +<!-- new section --> |
73 | 85 |
|
74 | | -1. Check that the template is followed correctly and that the tables are correctly linked (keys link time to land use changes and land use changes to carbon stock elements) |
75 | | -2. Generate simulations for all probability distribution functions |
76 | | -3. Calculate carbon stocks based on carbon stock elements reported. |
77 | | -4. Calculate Emission factors for each land use change and time period |
78 | | -5. Calculate Emissions from IPCC formula Eij = EFij x ADij for each land use change i and time period j. |
79 | | -6. Aggregate Emissions per time period |
80 | | -7. Aggregate Emissions for the reference and monitoring periods |
81 | | -8. Calculate Emission Reductions as the difference between annualized emissions during the reference period and annualized emissions during each of the monitoring periods. |
| 86 | +## Resources |
82 | 87 |
|
| 88 | +- Online app: <https://openforis-shiny.shinyapps.io/mocaredd/> |
83 | 89 |
|
84 | | -### Template |
| 90 | +- Online documentation: <https://openforis.github.io/mocaredd/> |
85 | 91 |
|
86 | | -(ADD Link to a template from github here) |
| 92 | +- Template guidelines: <https://openforis.github.io/mocaredd/articles/tuto-template.html> |
87 | 93 |
|
88 | | -The template includes 4 tabs: |
| 94 | + - Template simple (2 time periods, 12 land use changes classes, 2 carbon pools, inc. simulations in Excel for comparison): [Example2-with-sims.xlsx](https://docs.google.com/spreadsheets/d/19ySu_L4aI3tepq9FbYksbBa0yNi4s49c/edit?usp=sharing&ouid=104053208207168605668&rtpof=true&sd=true) |
89 | 95 |
|
90 | | -#### User inputs (user_inputs) |
91 | | -They help offering great flexibility with a minimum number of parameters. |
| 96 | + - Template intermediate (4 time periods, 48 land use change classes, 4 carbon pools): [Example1-4pools.xlsx](https://docs.google.com/spreadsheets/d/1H9yfPCSfSELgW506OIHqS-15hJtTECHB/edit?usp=sharing&ouid=104053208207168605668&rtpof=true&sd=true) |
92 | 97 |
|
93 | | -- **trunc_pdf**: use truncated PDF to avoid negative simulated values were illogical (for ex. areas.). (Note for v2.0, currently only works for normal distributions). |
94 | | -- **n_iter**: number of iterations. Most standards require 10,000 simulations. |
95 | | -- **ran_seed**: rand seed for the simulation. If note specified, the first run sets a random seed and reports it for reproducing the same results. |
96 | | -- Carbon stocks are reported following many different methods and pools, to allow flexibility the next user inputs provide ways to customize what is reported and how. |
97 | | - - **c_unit**: for AGB abd BGB, is the unit dry matter (DM) or carbon (C)? |
98 | | - - **c_fraction**: Carbon fraction to convert dry matter to carbon, if c_unit is "DM". |
99 | | - - **c_fraction_se**: standard error of the carbon fraction |
100 | | - - **c_fraction_pdf**: probability distribution function of the carbon fraction. |
101 | | - - **dg_pool**: If degradation is a ratio of intact forest Cstock, list of pools separated by coma to which the ratio applies. |
102 | | - - **dg_ext**: Extension used in the land use IDs for degraded land uses, for example if Evergreen forest is coded "EV" and degraded evergreen forest "EV_deg", dg_ext is "_deg". Necessary to automatically link intact forest carbon stock with its degradation ratio. |
103 | | -- **ad_annual**: Is Activity Data reported annual or as a sum over the time period considered? (TRUE or FALSE). |
104 | | -- **conf_level**: Confidence level (1 - alpha) for the uncertainty calculations. |
| 98 | +- Github repository: <https://github.com/openforis/mocaredd> |
105 | 99 |
|
| 100 | +- Contact form: [Contact us](https://forms.gle/YZy4xmviSMvUT8DJ9) |
106 | 101 |
|
107 | | -#### Time periods (time_periods) |
| 102 | +<!-- new section --> |
108 | 103 |
|
109 | | -TBD |
| 104 | +## Planned features |
110 | 105 |
|
111 | | -#### land use transitions (AD_lu_transitions) |
| 106 | +- Improve the template guidelines with examples from real cases. |
| 107 | +- Improve the sensitivity analysis. |
| 108 | +- Develop the template tab and calculations for annual processes (removals, soil organic carbon). |
| 109 | +- Develop the template and calculations for bootstrap from raw data. |
| 110 | +- Add truncated PDFs support. |
| 111 | +- Add IPCC tier 1 uncertainties propagation around the arithmetic means. |
112 | 112 |
|
113 | | -TBD |
| 113 | +```{=html} |
| 114 | +<!-- |
114 | 115 |
|
115 | | -#### Carbon stocks (c_stocks) |
| 116 | +Current features: |
116 | 117 |
|
117 | | -TBD |
| 118 | +- Download a demo template with user inputs, time periods, land use change areas, carbon elements. |
| 119 | +- User filled template submission to the tool, |
| 120 | +- Verification of template integrity, |
| 121 | +- Build calculation chain from input data to greenhouse gas emission reductions (ER) |
| 122 | +- Calculate arithmetic mean ERs from input data |
| 123 | +- Run simulations for all variables and reproduce calculation chain for each simulation |
| 124 | +- Calculate the median of simulated ERs as a better estimate than the arithmetic mean |
| 125 | +- Calculate uncertainty as quantiles of simulations at the chosen level |
| 126 | +- Show medians and confidence intervals at intermediate level (REDD+ activities, activity data and emission factors) |
| 127 | +- Show sansitivity analysis |
118 | 128 |
|
| 129 | +--> |
| 130 | +``` |
0 commit comments