update electricity/storage preprocessing#615
Conversation
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)
…t to normal script for easier testing
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)
…ore similar to other sectors)
qubixes
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I'm getting a file not found error for "standard_data/storage_cost.csv". Is there still something missing?
There was a problem hiding this comment.
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?
| 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
|
Also, I guess the tests should be fixed up before merging! |
|
Addressed the requested changes and discussed offline with @qubixes — merging now. |
updated version of storage preprocessing