remindmodel / remind

REMIND - REgional Model of INvestments and Development
Other
97 stars 127 forks source link

inconsistencies in AR6 summation #1019

Closed orichters closed 6 months ago

orichters commented 1 year ago

Dear colleagues, because a user found an issue with inconsistent variables in NGFS data, I had a closer look with a bit of a systematic approach and did a summation check on a default run converted to an AR6 mif using piamInterfaces, using the summation_group_ar6.csv file from piamInterfaces. Results? see yourself (left is the AR6 mapping, right the remind2 variables that I extracted by applying the mapping but inversely).

Full results are here:

less /p/tmp/oliverr/remind/output/checkSummations.csv

solved: Primary Energy

Was just an error in the mapping, fix hopefully be fixed with https://github.com/pik-piam/piamInterfaces/pull/21

click to expand! This seems to be caused by the [summationgroup](https://github.com/pik-piam/piamInterfaces/blob/master/inst/summations/summation_groups_ar6.csv#L567-L568) defining `Primary Energy|Gas|Electricity` = `Primary Energy|Gas|Electricity|w/ CCS` + `Primary Energy|Gas|Electricity|w/o CCS`, while [the template](https://github.com/pik-piam/piamInterfaces/blob/659ca3dc68cf3176fc6b83e6ce787c97c5f36288/inst/templates/mapping_template_AR6.csv#L1994-L1996) also adds `PE|Gas|Heat`, (resp. `PE|Coal|Heat` and `PE|Biomass|Heat`) to it, which is not mapped to a `Primary Energy|Gas|Electricity|Heat` value. What would be correct? ``` Primary Energy|Biomass|Electricity ≠ PE|Biomass|Electricity + PE|Biomass|Heat ≠ + Primary Energy|Biomass|Electricity|w/ CCS + PE|Biomass|Electricity|w/ CC + Primary Energy|Biomass|Electricity|w/o CCS + PE|Biomass|Electricity|w/o CC Relative difference between -99.9% and -1.3%, absolute difference up to 9.55 Primary Energy|Coal|Electricity ≠ PE|Coal|Electricity + PE|Coal|Heat ≠ + Primary Energy|Coal|Electricity|w/ CCS + PE|Coal|Electricity|w/ CC + Primary Energy|Coal|Electricity|w/o CCS + PE|Coal|Electricity|w/o CC Relative difference between -100% and -1.3%, absolute difference up to 9.77 Primary Energy|Gas|Electricity ≠ PE|Gas|Electricity + PE|Gas|Heat ≠ + Primary Energy|Gas|Electricity|w/ CCS + PE|Gas|Electricity|w/ CC + Primary Energy|Gas|Electricity|w/o CCS + PE|Gas|Electricity|w/o CC Relative difference between -100% and -1%, absolute difference up to 10.81 ```

Emissions

Emissions|BC|AFOLU ≠                                                          Emi|BC|Land Use ≠
   + Emissions|BC|AFOLU|Agriculture                                              + Emi|BC|Land Use|Agriculture
   + Emissions|BC|AFOLU|Land                                                     +
Relative difference between -100% and -100%, absolute difference up to 2.26

Emissions|CH4 ≠                                                               Emi|CH4 ≠
   + Emissions|CH4|AFOLU                                                         + Emissions|CH4|Land
   + Emissions|CH4|Energy                                                        + Emi|CH4|Energy Supply and Demand
   + Emissions|CH4|Industrial Processes                                          +
   + Emissions|CH4|Other                                                         + Emi|CH4|Other
   + Emissions|CH4|Waste                                                         + Emi|CH4|+|Waste
Relative difference between -89.1% and -52.5%, absolute difference up to 349.13

Emissions|N2O ≠                                                               Emi|N2O ≠
   + Emissions|N2O|AFOLU                                                         + Emissions|N2O|Land
   + Emissions|N2O|Energy                                                        + Emi|N2O|Energy Supply and Demand
   + Emissions|N2O|Industrial Processes                                          + Emi|N2O|+|Industry
   + Emissions|N2O|Other                                                         + Emi|N2O|Other
   + Emissions|N2O|Waste                                                         + Emi|N2O|+|Waste
Relative difference between -95.4% and -50.9%, absolute difference up to 16244.06

solved: Final Energy

The current remind2 FE data with their pluses could not be made compatible with the AR6 mapping, so I deleted these summation groups.

Click to expand! ``` Final Energy|Industry|Solids ≠ FE|Industry|+|Solids ≠ + Final Energy|Industry|Solids|Biomass + FE|Industry|Solids|+|Biomass + Final Energy|Industry|Solids|Coal + FE|Industry|Solids|Coal Relative difference between -26.4% and 22.5%, absolute difference up to 1.14 Final Energy|Residential and Commercial|Solids ≠ FE|Buildings|+|Solids ≠ + Final Energy|Residential and Commercial|Solids|Biomass + FE|Buildings|Solids|+|Biomass + Final Energy|Residential and Commercial|Solids|Coal + FE|Buildings|Solids|Coal Relative difference between -16.2% and 38%, absolute difference up to 1.14 Final Energy|Transportation|Liquids ≠ FE|Transport|+|Liquids ≠ + Final Energy|Transportation|Liquids|Bioenergy + FE|Transport|Liquids|+|Biomass + Final Energy|Transportation|Liquids|Coal + FE|Transport|Liquids|Fossil|+|Coal + Final Energy|Transportation|Liquids|Fossil synfuel + + Final Energy|Transportation|Liquids|Natural Gas + + Final Energy|Transportation|Liquids|Oil + FE|Transport|Liquids|Fossil|+|Oil Relative difference between -3.7% and -1.3%, absolute difference up to 0.09 ```

solved: Investment|Energy Supply|Electricity

from both NAVIGATE and AR6 templates were not mapping Investment|Energy Supply|Electricity|Oil and Investment|Energy Supply|Electricity|Oil|w/ CCS, so oil was simply missing from the mif file I base my analysis on. If I take Oil temporarily out of the summation group, it fits. But of course I rather added it to the templates. in https://github.com/pik-piam/piamInterfaces/pull/21/files

Click to expand! ``` Investment|Energy Supply|Electricity ≠ Energy Investments|Electricity ≠ + Investment|Energy Supply|Electricity|Biomass + Energy Investments|Elec|Biomass + Investment|Energy Supply|Electricity|Coal + Energy Investments|Elec|Coal + Investment|Energy Supply|Electricity|Electricity Storage + Energy Investments|Elec|Storage + Investment|Energy Supply|Electricity|Gas + Energy Investments|Elec|Gas + Investment|Energy Supply|Electricity|Geothermal + Energy Investments|Elec|Geothermal + Investment|Energy Supply|Electricity|Hydro + Energy Investments|Elec|Hydro + Investment|Energy Supply|Electricity|Nuclear + Energy Investments|Elec|Nuclear + Investment|Energy Supply|Electricity|Ocean + + Investment|Energy Supply|Electricity|Oil + + Investment|Energy Supply|Electricity|Other + Energy Investments|Elec|Hydrogen + Investment|Energy Supply|Electricity|Solar + Energy Investments|Elec|Solar + Investment|Energy Supply|Electricity|Transmission and Distribution + Energy Investments|Elec|Grid + Investment|Energy Supply|Electricity|Wind + Energy Investments|Elec|Wind Relative difference between -10.6% and -1.1%, absolute difference up to 11.55 ``` here, `Investment|Energy Supply|Electricity|Fossil`, `Non-fossil`, `Non-Biomass Renewables` are not included in the summation check, but that seems reasonable as they are summations themselves. Maybe there is something wrong with [this sum](https://github.com/pik-piam/remind2/blob/62fdc91be2fa10340e5a99ad988955a9ddf65cd0/R/reportEnergyInvestment.R#L168-L170)? Maybe `Energy Investments|Elec|Storage` or `Energy Investments|Elec|Grid|…` matter? I don't know…

solved: Investment|Energy Supply|Liquids

This seems to be a problem in the mapping (https://github.com/pik-piam/piamInterfaces/issues/15) and should be fixed with https://github.com/pik-piam/piamInterfaces/pull/21

Click to expand!
``` Investment|Energy Supply|Liquids ≠ Energy Investments|Liquids ≠ + Investment|Energy Supply|Liquids|Biomass + Energy Investments|Liquids|Bio + Investment|Energy Supply|Liquids|Coal and Gas + Energy Investments|Liquids|Fossil + Investment|Energy Supply|Liquids|Oil + Energy Investments|Liquids|Oil Ref Relative difference between 1.2% and 100%, absolute difference up to 87.6 ```
nicobauer commented 1 year ago

On PE to Electricity and Heat. Depends on the definition. The approach to allocate all CHP inputs to the electricity input is OK. One could also use the co-production factor for heat to allocate between electricity and heat.

pweigmann commented 1 year ago

Note that this is based on an analysis of a mif file that went through the mapping, so what is exported to IIASA. And it is a bit confusing if that happens despite that fact we have an Other category.

But I am not sure if the solution is to use other as a dump to make the summation work. In some cases on the emission data we have the total and some sub-values from one source and other sub-values (e.g. Land-Use) from another. Other also exists as an AR6 category and I am not sure if it might create more confusion if we use it in a different way to balance out other inconsistencies.

fschreyer commented 1 year ago

On the Emi and FE variables. Is there a reason why we don't use the variable versions with + in the most recent AR6 mapping? They should sum up. I guess, in the case of emissions the problem is that Emissions|CH4|Land comes from Magpie. I don't know how the emissions reporting works/is supposed to work when Magpie is involved. @dklein-pik is the one who worked on that.

Why should PE|Biomass|Electricity + Heat be PE|Biomass|Electricity|w/ CC + w/o CC in the first place? Electricity and heat are two different sectors.

On the energy investments: This is a reporting function which has not been checked for consistency since the reporting overhaul and therefore does not have + variables so far. From looking at the code, I would guess that Energy Investments|Elec|Storage (this line) still needs to be added to Energy Investments|Electricity (this line).

robertpietzcker commented 1 year ago

On PE to Electricity and Heat. Depends on the definition. The approach to allocate all CHP inputs to the electricity input is OK. One could also use the co-production factor for heat to allocate between electricity and heat.

But here it looks like simply ALL of PE|Biomass|Heat is added to Primary Energy|Biomass|Electricity.

As there is no "Primary Energy|Biomass|Heat" AR6 variable reported by this mapping, I am pretty sure this is simply a copy-paste error and should be corrected.

(same for Primary Energy|Coal|Heat, Primary Energy|Gas|Heat, ...

orichters commented 1 year ago

I made clear above that I used the summation_group template in piamInterfaces to see which groups are assumed to sum to each other, and then used the mapping inversely to find out to which remind2 variables they correspond. This way, it could easily be seen that AR6 variable Primary Energy|Gas|Electricity is remind2 PE|Gas|Electricity + PE|Gas|Heat, but this is not reflected in the summation_group file (which may simply be outdated, which we should fix then…)

orichters commented 1 year ago

On the Emi and FE variables. Is there a reason why we don't use the variable versions with + in the most recent AR6 mapping? They should sum up. I guess, in the case of emissions the problem is that Emissions|CH4|Land comes from Magpie. I don't know how the emissions reporting works/is supposed to work when Magpie is involved. @dklein-pik is the one who worked on that.

I don't know. Maybe nobody adapted it.

Why should PE|Biomass|Electricity + Heat be PE|Biomass|Electricity|w/ CC + w/o CC in the first place? Electricity and heat are two different sectors.

Well, Heat is added to the Electricity part here. I wasn't sure whether it is nonsense, but @nicobauer seems to think it is fine. So then we just have to adapt the summation_groups_ar6.csv file to reflect this.

On the energy investments: This is a reporting function which has not been checked for consistency since the reporting overhaul and therefore does not have + variables so far. From looking at the code, I would guess that Energy Investments|Elec|Storage (this line) still needs to be added to Energy Investments|Electricity (this line).

Ok.

robertpietzcker commented 1 year ago

@orichters not sure to which comment you replied - if it is mine, I simply wanted to say "the summation of heat in the template is wrong, so please change it" - I think @nicobauer only commented that you can add CHP heat PE to electricity heat, but he didn't look into the concrete point. it may be that CHP heat input is added to electricity PE, but if this is the case, it should (and hopefully would) happen already in the REMIND PE|Electricity variable.

so if you have the time, it would be great if you could simply correct the AR6 mapping to that respect and make sure "PE|Biomas/Coal/Gas|Heat" is mapped to "Primary Energy|Biomass/Coal/Gas|Heat" (which is currently missing) and not to "Primary Energy|Biomass/Coal/Gas|Electricity"

orichters commented 1 year ago

Thanks, @robertpietzcker for the clarification. Maybe @christophbertram can explain why he added them and what was the rationale behind it.

christophbertram commented 1 year ago

Hm, not really sure what happened there, but the most plausible explanation it was just a stupid mistake, and I actually wanted to map "PE|Biomas/Coal/Gas|Heat" to "Primary Energy|Biomass/Coal/Gas|Heat"... so please go ahead correcting this....

orichters commented 1 year ago

@fschreyer: The Investment|Energy Supply|Electricity inconsistency seems to have a different cause: both NAVIGATE and AR6 template don't map Investment|Energy Supply|Electricity|Oil and Investment|Energy Supply|Electricity|Oil|w/ CCS, so oil is simply missing from the mif file I base my analysis on. If I take Oil temporarily out of the summation group, it fits. But of course I rather add it to the templates.

orichters commented 1 year ago

What about the remaining Emi problem. Maybe @dklein-pik, @fschreyer or @gabriel-abrahao have an idea how it can be fixed? Thanks!

gabriel-abrahao commented 1 year ago

I'm not familiar with piamInerfaces, but I noticed that there's nothing in the piam_variable column of Emissions|CH4|Industrial Processes in inst/templates/mapping_template_AR6.csv, even though it's part of the summation groups. Could this be the source of the problem?

239;Emissions|CH4|Energy|Supply;Mt CH4/yr;Emi|CH4|+|Energy Supply;Mt CH4/yr;;;;;CH4 emissions from fuel combustion and fugitive emissions from fuels: electricity and heat production and distribution (IPCC category 1A1a),other energy conversion (e.g. refineries,synfuel production,solid fuel processing,IPCC category 1Ab,1Ac),incl. pipeline transportation (IPCC category 1A3ei),fugitive emissions from fuels (IPCC category 1B) and emissions from carbon dioxide transport and storage (IPCC category 1C);
240;Emissions|CH4|Industrial Processes;Mt CH4/yr;;;;;;;CH4 emissions from industrial processes;x

Just FYI, I can keep looking into this later but I'll be out next week.

fschreyer commented 1 year ago

Well, I can comment on how I would imagine it when linked to Magpie:

For N2O the same just that:

Naming is not always super consistent on this like it is for Emi|CO2. But this is to some extend because we don't have emissions on all branches (e.g. distinguishing Emi||CH4|Energy|Supply/Demand does not make much sense if we don't have (or there are no) demand emissions anyways). But this could be improved.

gabriel-abrahao commented 1 year ago

I see a couple of odd things, maybe @strefler knows what's going on?

As far as I know, we don't represent industry CH4 emissions in REMIND (correct me if I'm wrong Jess, Simon), but we do represent emissions from fossil fuels extraction and that doesn't seem to be part of Emi|CH4|+|Energy Supply. Below is our summation.

Emi|CH4 = 
  Emi|CH4|+|Agriculture
  Emi|CH4|+|Energy Supply
  Emi|CH4|+|Extraction
  Emi|CH4|+|Land-Use Change
Emi|CH4|+|Waste

Also, Emi|CH4|Energy Supply and Demand (just the one for CH4) does not seem to be reported anymore. I can't find references for it in the latest remind2, and it's not on the MIFs of the latest AMT (/p/projects/remind/modeltests/output/SSP2EU-AMT-Base_2022-11-02_12.42.21). That would of course cause problems with the summation here, does anyone else know what could have happened?

fschreyer commented 1 year ago

As far as I know, we don't represent industry CH4 emissions in REMIND (correct me if I'm wrong Jess, Simon), but we do represent emissions from fossil fuels extraction and that doesn't seem to be part of Emi|CH4|+|Energy Supply

True, that's not a great distinction I made here (I am the one to blame for this code ;-)). In some projects you also only want the combustion part (IPCC sector 1A) for your energy supply without the fugitive emissions (IPCC sector 1B). IPCC distinguishes between combustion and fugitive on the level of energy emissions. But I agree that usually both is accounted together for many IAM projects and the naming could be better. Emi|CH4|Energy Supply|Combustion/Fugitive perhaps. Not sure how new project templates label that.

strefler commented 1 year ago

I think Emi|CH4|+|Extraction should be part of Emi|CH4|+|Energy Supply as it used to be. This differentiation doesn't make sense to me, and I think it is also covered in the variable definitions of the project templates

orichters commented 1 year ago

If you like to have a deeper look into what variables exists in the mappings and a mif file you have, I recommend

piamInterfaces::variableInfo("Emi|CH4", mif = "/p/tmp/oliverr/debugging/REMIND_generic_SSP2EU-AMT-Base.mif")

(you need piamInterfaces version > 0.0.26). It prints you all the relevant mappings, summations and further variables present in the mif file in a way humans can read it.

orichters commented 6 months ago

replaced by new issue for better overview: https://github.com/remindmodel/development_issues/issues/253