Skip to content

update electricity/storage preprocessing#615

Merged
judith-tettenborn merged 40 commits into
developmentfrom
storage_dev
May 29, 2026
Merged

update electricity/storage preprocessing#615
judith-tettenborn merged 40 commits into
developmentfrom
storage_dev

Conversation

@judith-tettenborn

Copy link
Copy Markdown
Contributor

updated version of storage preprocessing

  1. pumped hydropower storage (PHS) calculation updated (closer in line with historical projections)
  2. transformed code to xarray format
  3. created option to model behind-the-meter storage separatly, but will not be used at the moment.
  4. storage market shares are not longer calculated from prescribed prices, but prescribed directly via input files
  5. when calculating the remaining storage demand (after subtraction of PHS), a floor is implemented from 2010 onwards, ensuring at least some battery storage will be needed, even in case of high PHS deployment (they fulfill different needs in the electricity system; this is backed up by literature)
  6. removed input parameter scenario, year_start, year_end from electricity preprocessing to align it with buildings and vehicles preprocessing

adapting aggregate_sum(): to handle no relations found (in fct find_one_relation()),
added boolean to make one ValueError optional, now it is possible to
aggregate even if not all defined output coordinates have a relation in
the input array coordinates.
knowledgegraph IMAGE regions: deleted/renamed duplicate Nodes (e.g. "USA" is region
name, but was also country name which throws errors, now it's only region
name)
1. PHS calculation updated (closer in line with historical projections)
2. transformed code to xarray format
3. created option to model behind-the-meter storage separatly, but will not be used at the moment.
4. storage market shares are not longer calculated from prescribed prices, but prescribed directly via input
files
5. when calculating the remaining storage demand (after subtraction of PHS), a floor is implemented
from 2010 onwards, ensuring at least some battery storage will be needed, even in case of high PHS
deployment (they fulfill different needs in the electricity system; this is backed up by literature)
@judith-tettenborn judith-tettenborn requested a review from qubixes May 25, 2026 16:56
@judith-tettenborn judith-tettenborn mentioned this pull request May 26, 2026

@qubixes qubixes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is getting quite a lot to review, and of course I don't have all the details of what the code is trying to get done. I have made some general comments on the code, so I hope at least that helps.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting a file not found error for "standard_data/storage_cost.csv". Is there still something missing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is strange, it does exist within "data/raw/electricity/standard_data/". When I run the batteries.ipynb where it is used (it is not used anymore in the storage preprocessing, where it was used previously), the preprocessing and model runs without problem. Where do you get this error?

Comment thread imagematerials/electricity/utils.py Outdated
Comment thread imagematerials/electricity/utils.py Outdated
factor_phs_growth_rel_demand: float = 0.5,
mean_discharge_duration: float = 10,
flag_phs: str = "phs_low"):
""" Derive installed pumped hydro storage (PHS) power and energy capacity across IMAGE regions

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be good to look at all the docstrings and see whether they follow the PEP5 guidelines. The problem is that if you don't do that, they might look nice when reading the code, but they won't render properly or at all. You can use ruff to check your docstrings. And as a general note, the extra tabs for alignment and enumerations will give sphinx a lot of trouble.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is growing a little bit uncontrollably, so I think it should at least be split up, and perhaps some of it should be stored in data (.json) files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should separate the class knowledge graph from the instances or just move all instances to .json files?
I made an attempt to move the image_region_knowledge_graph to a .json file (in data/raw/knowledge_graphs/). It seems to work, could you have a look?

@qubixes

qubixes commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Also, I guess the tests should be fixed up before merging!

@judith-tettenborn

Copy link
Copy Markdown
Contributor Author

Addressed the requested changes and discussed offline with @qubixes — merging now.

@judith-tettenborn judith-tettenborn merged commit c82b01c into development May 29, 2026
1 check passed
@judith-tettenborn judith-tettenborn deleted the storage_dev branch May 29, 2026 09:12
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.

2 participants