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

Rewrite of reportEmissions.R #48

Closed
wants to merge 1 commit into from
Closed

Conversation

mscrawford
Copy link
Contributor

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:

  1. Emissions|N2O|Direct|Land (Mt N2O/yr) Now includes the previously unaccounted peatland emissions.
  2. This list of emissions now exists in the final reporting object:
 [1] Emissions|NH3|Land|+|Peatland (Mt NH3/yr)                 
 [2] Emissions|NH3|Land|Peatland|+|Managed (Mt NH3/yr)         
 [3] Emissions|NO2|Land|+|Peatland (Mt NO2/yr)                 
 [4] Emissions|NO2|Land|Peatland|+|Managed (Mt NO2/yr)         
 [5] Emissions|NO3-|Land|+|Peatland (Mt NO3-/yr)               
 [6] Emissions|NO3-|Land|Peatland|+|Managed (Mt NO3-/yr)       
 [7] Emissions|N2O|Direct|Land (Mt N2O/yr)                     
 [8] Emissions|N2O|Direct|Land|+|Peatland (Mt N2O/yr)          
 [9] Emissions|N2O|Direct|Land|Peatland|+|Managed (Mt N2O/yr)  
[10] Emissions|N2O|Indirect|Land|+|Peatland (Mt N2O/yr)        
[11] Emissions|N2O|Indirect|Land|Peatland|+|Managed (Mt N2O/yr)

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:

# Replace indirect emissions from climate change on managed land with the Grassi coefficients?
if (grassi) {
    climateChange <- landCarbonSink(gdx, level = "regglo", cumulative = .cumulative)
} else {
    climateChange <- dimSums(co2[, , "cc"], dim = 3)
}

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

  1. I'm not sure if Grassi should be an argument to the larger function or have its own reporting variables in the final reporting document. On one side, unless we are going to be using these values it may be potentially confusing. On the other hand, the only way to retrieve the "MAgPIE-own" land-use sink with this implementation is to call reportEmissions.R by hand. Certainly not the most convenient method.
  2. On L115 the value for 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant