pik-piam / remind2

The remind2 package contains the REMIND-specific routines for data and model output manipulation.
0 stars 40 forks source link

compareScenarios() breaks on all kinds of places for SSP2EU/SSP5 NPi AMT comparison #551

Closed 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q closed 6 months ago

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q commented 6 months ago

image compScen-2024-02-28_14.35.39-H12-short.pdf

fbenke-pik commented 6 months ago

Looks to me like the error in the section "Steel Production Mix" in the screenshot is caused in a portion of code you added two years ago (https://github.com/pik-piam/remind2/commit/189fbf3b37092246c99b696bda8e6554a9ac1bc5).

Maintaining these notebooks is responsibility of the sector specialists adding the plots (especially if you use larger portions of custom plotting code, I don't think that this is what Christoph Schoetz had in mind when setting up cs2). It is a different story for bugs in shared libraries like mip, of course. They can be assigned to RSE.

fbenke-pik commented 6 months ago

That being said, this fails because there seems to be no data in either run for the two steel production variables you are trying to plot. Hence bin_distribute(setdiff(getScenarios(dPlot), 'historical'),5) crashes as the setdiff yields an empty character vector. I guess a simple safeguard for this case should do the trick to at least handle that case gracefully.

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q commented 6 months ago

Well, I care about the Industry stuff (naturally). I should have been more explicit about the "all kinds of places" part … image image image image image image image image image The other compare scenarios files I looked at have 680 pages (give or take). This one has 117.

orichters commented 6 months ago

Just seeing this by chance. David noticed that some recent AMT runs had problems with the reporting (that I was responsible for), and your case seems to be related to that. One might need to rerun the reporting on these ones with remind2 >= 1.135.2

/p/projects/remind/modeltests/remind/output (develop)$ wc -l SSP5-NPi-AMT_2024*/REMIND_generic_SSP5-NPi-AMT.mif
   54377 SSP5-NPi-AMT_2024-01-12_22.12.48/REMIND_generic_SSP5-NPi-AMT.mif
   54377 SSP5-NPi-AMT_2024-01-26_22.11.51/REMIND_generic_SSP5-NPi-AMT.mif
   54377 SSP5-NPi-AMT_2024-02-02_22.10.15/REMIND_generic_SSP5-NPi-AMT.mif
   24379 SSP5-NPi-AMT_2024-02-09_22.10.02/REMIND_generic_SSP5-NPi-AMT.mif
   24379 SSP5-NPi-AMT_2024-02-16_22.10.44/REMIND_generic_SSP5-NPi-AMT.mif
fbenke-pik commented 6 months ago

Thanks for the info @orichters I just reran reporting on the SSP5 Npi AMT run and this indeed seems to solve the problem. I no longer find any errors in the corresponding cs2 pdf.

fbenke-pik commented 6 months ago

@dklein-pik is there a convenient way to rerun reporting and cs2 for the recent AMT runs to make sure the problem is actually solved?

dklein-pik commented 6 months ago

Well, not particularly convenient, but the cs2 commands were written to the AMT logfile (/p/projects/remind/modeltests/amt_end.log), e.g.

Calling compareScenarios2 with /p/projects/remind/modeltests/remind/output/default-AMT_2024-02-23_22.05.58 and /p/projects/remind/modeltests/remind/output/default-AMT_2024-02-16_22.06.08
sbatch --qos=standby --job-name=comp_with_default-AMT_2024-02-16_22.06.08 --comment=compareScenarios2 --output=/p/projects/remind/modeltests/remind/output/default-AMT_2024-02-23_22.05.58/comp_with_default-AMT_2024-02-16_22.06.08.out --error=/p/projects/remind/modeltests/remind/output/default-AMT_2024-02-23_22.05.58/comp_with_default-AMT_2024-02-16_22.06.08.out --mail-type=END --time=200 --mem-per-cpu=8000 --wrap="Rscript scripts/cs2/run_compareScenarios2.R outputDirs=/p/projects/remind/modeltests/remind/output/default-AMT_2024-02-23_22.05.58,/p/projects/remind/modeltests/remind/output/default-AMT_2024-02-16_22.06.08 profileName=default outFileName=comp_with_default-AMT_2024-02-16_22.06.08; mv comp_with_default-AMT_2024-02-16_22.06.08.pdf /p/projects/remind/modeltests/remind/output/default-AMT_2024-02-23_22.05.58" 

Would it be ok to pick the right ones from there?