pypsa-eur icon indicating copy to clipboard operation
pypsa-eur copied to clipboard

Fixing energy totals rescale function

Open toniseibold opened this issue 1 year ago • 2 comments

Changes proposed in this Pull Request

Closes https://github.com/PyPSA/pypsa-eur/issues/985. Bug fix in the function rescale_idees_from_eurostat(): So far, the sum of agriculture and transport did not add up to total agriculture and total transport since there are two different rescaling factors for electricity and total.

@lindnemi: the sectors residential and services is not adding up since it's taking data from JRC IDEES from multiple sheets.

Minor changes so no change in the environment, configuration and release notes.

Checklist

  • [x] I tested my contribution locally and it seems to work fine.
  • [x] Code and workflow changes are sufficiently documented.
  • [x] Changed dependencies are added to envs/environment.yaml.
  • [x] Changes in configuration options are added in all of config.default.yaml.
  • [x] Changes in configuration options are also documented in doc/configtables/*.csv.
  • [x] A release note doc/release_notes.rst is added.

toniseibold avatar Mar 25 '24 14:03 toniseibold

@toniseibold watch out the warning regarding the assignment of values after a .loc and getitem https://github.com/PyPSA/pypsa-eur/actions/runs/8422950562/job/23063439670#step:8:1124

Instead of

  energy.loc[country, :]["total road"]  =

you should probably go for

  energy.loc[country, "total road"] =

FabianHofmann avatar Mar 26 '24 12:03 FabianHofmann

Thanks @FabianHofmann - missed that one.

toniseibold avatar Mar 26 '24 20:03 toniseibold

I had to make some changes, but they were difficult to trace, so no worries!

https://github.com/PyPSA/pypsa-eur/commit/f25c594a07d21ea207421dd35b168707b7342433

The "total" includes electricity for the transport sector, so the entries with "electricity" shouldn't be included in the sum. The mismatch in the totals seemed to come from the missing entry "total heavy duty road freight" in the rescaling.

fneum avatar May 20 '24 13:05 fneum