pik-piam/remind2

Steel Primary and Secondary don't sum up to total for 2010 and 2015

Closed this issue · 5 comments

Shows up in checkSummation logs. How to reproduce

gdx <- "/p/projects/remind/modeltests/remind/output/SSP2EU-Base-AMT_2023-09-01_22.08.50/fulldata.gdx"
output <- remind2::reportFE(gdx)
prim <- output[,,"FE|Industry|Steel|++|Primary (EJ/yr)"]
sec <- output[,,"FE|Industry|Steel|++|Secondary (EJ/yr)"]
tot <- output[,,"FE|Industry|+++|Steel (EJ/yr)"]

Now, abs(tot - prim - sec) is smaller than 1e-14 except for 2010 and 2015:

(tot-prim-sec)[, c(2010, 2015), ]
        ttot
all_regi         y2010         y2015
     LAM -5.802134e-04  4.019396e-04
     OAS -4.167843e-05 -1.064893e-04
     SSA -2.356056e-05  6.938894e-18
     EUR -2.627722e-04  2.775558e-16
     NEU -1.409450e-05  7.801600e-06
     MEA -2.202686e-05 -1.179612e-16
     REF -1.119489e-03 -5.551115e-17
     CAZ -1.227636e-04 -6.938894e-17
     CHA -1.441973e-03 -8.960015e-05
     IND -3.563202e-05  2.665842e-05
     JPN  8.326673e-17  6.796558e-06
     USA -2.948931e-04  8.326673e-17
     GLO -3.959096e-03  2.471067e-04

Maybe this can be fixed. Tagging @0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q who should at least know who can fix that…

So, there is some problem on the REMIND side. Until that is cleared I cannot tell whether there is one on the remind2 side as well or not.

Also, the |+|-notation sucks, because it severely limits the ability to write meaningful summation tests.

  all_regi ttot                                          data      value
1      LAM 2010             FE|Industry|Steel|+|Gases (EJ/yr) 0.28316392
2      LAM 2010           FE|Industry|Steel|+|Liquids (EJ/yr) 0.03453896
3      LAM 2010            FE|Industry|Steel|+|Solids (EJ/yr) 0.77349480
4      LAM 2010    FE|Industry|Steel|Gases|+|Hydrogen (EJ/yr) 0.00000000
5      LAM 2010 FE|Industry|Steel|Primary|Electricity (EJ/yr) 0.04391427
6      LAM 2010                                         Total 1.13511196
7      LAM 2010          FE|Industry|Steel|++|Primary (EJ/yr) 1.13277815

What kind of summation check do you need? Should actually be really easy like this:

diff <- piamInterfaces::checkSummations(yourmif, summationsFile = "/p/tmp/oliverr/debugging/summation_steel.csv", logFile = NULL)

What kind of summation check do you need? Should actually be really easy like this:

I do not need a summation check, I need a (lots of, actually) summation tests within the remind2 package. But

              FE|Industry|Steel|+|Gases (EJ/yr)
+           FE|Industry|Steel|+|Liquids (EJ/yr)
+            FE|Industry|Steel|+|Solids (EJ/yr)
+    FE|Industry|Steel|Gases|+|Hydrogen (EJ/yr)
+ FE|Industry|Steel|Primary|Electricity (EJ/yr)
=          FE|Industry|Steel|++|Primary (EJ/yr)

cannot be represented by the |+| structure (without a lot of otherwise pointless duplication of variables).

Please set up a file similar to /p/tmp/oliverr/debugging/summation_steel.csv with the checks you want and I'm sure we can add them to the remind2 tests (and maybe replace the + structure soon with it).

Is that fixed? Does not show up anymore in /p/tmp/oliverr/remind/output/SSP2EU-NDC_2023-09-14_00.14.50/log.txt

(tot-prim-sec)[, c(2010, 2015), ]
all_regi         y2010         y2015
     LAM  1.582068e-15 -1.942890e-16
     OAS -1.165734e-15  1.387779e-15
     SSA  1.370432e-16  4.163336e-17
     EUR -3.330669e-16 -7.771561e-16
     NEU -2.914335e-16  2.636780e-16
     MEA  5.342948e-16  1.838807e-16
     REF -6.106227e-16 -5.551115e-16
     CAZ  1.249001e-16  1.110223e-16
     CHA -1.076916e-14 -9.880985e-15
     IND -8.049117e-16 -7.494005e-16
     JPN -8.326673e-16 -9.436896e-16
     USA -5.828671e-16  1.387779e-16
     GLO -1.110223e-14 -1.021405e-14