Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a re-write of the reportEmissions.R function, which additionally adds the option to calculate the land-use sink without the Grassi coefficients.
The primary focus of the re-write was to simplify the CO2 calculation's structure and then subsequent reporting. There is now a local function, .calcCO2, that takes as arguments ".lowpass", ".cumulative", and ".raw". The CO2 reports are thus now single calls to this function and the subsequent naming of the reporting variables.
A secondary aspect was simplifying the nitrogen reporting, also through the use of helper functions. This process revealed that peatland emissions had previously been left out of the
N2O|Direct|...
reporting variables (though was present in the larger N2O variable). This is now fixed.Testing
I tested this function by anti_joining this version of the reportEmissions function with the current piam magpie4 version for a MAgPIE .gdx file. The differences are:
Emissions|N2O|Direct|Land (Mt N2O/yr)
Now includes the previously unaccounted peatland emissions.Only the
N2O|Direct|...
variables are populated with non-zero values. The rest of these emissions are currently 0 for each of the reports.Land-carbon sink with and without Grassi emissions
I incorporate the following code to either replace the "MAgPIE-own" land-carbon sink with the Grassi coefficients:
And test this new code with some runs of Gabriel's, which varied the climate change, the RCP, the peak carbon budget, and afforestation. I don't completely understand the results. In particular, I wonder if there was something strange in his runs' afforestation settings, because it makes no difference in the end, in terms of CO2 emissions. That said, for the plots of indirect emissions it does seem that the land-carbon sink is working as expected.
Land-use Change
LanduseChange.pdf
Indirect
Indirect.pdf
Land
Land.pdf
Outstanding questions
storage
in the context of wood products is written over, without the older value of the variable ever being used. I'm not sure if this is desired behavior.