We can combine quite a bit of the cost multiplier functions (update_marginal_costs(...) and update_capital_costs(...)). Specifically, the logic that maps each generator to a state, as it needs to extract out the state label from the bus dataframe. If this logic is packaged into its own function, it may be useful later in the workflow as well :)
Suggested Solution
Here is the code that I think should be simplified.
Feature Request
We can combine quite a bit of the cost multiplier functions (
update_marginal_costs(...)
andupdate_capital_costs(...)
). Specifically, the logic that maps each generator to a state, as it needs to extract out the state label from the bus dataframe. If this logic is packaged into its own function, it may be useful later in the workflow as well :)Suggested Solution
Here is the code that I think should be simplified.
https://github.com/PyPSA/pypsa-usa/blob/6f37e32de0b19b349e6ba134e1bcfa0f48e5b93a/workflow/scripts/add_electricity.py#L312-L420
Moreover, here is the portion that I think should be extracted into its own funtion
https://github.com/PyPSA/pypsa-usa/blob/6f37e32de0b19b349e6ba134e1bcfa0f48e5b93a/workflow/scripts/add_electricity.py#L315-L324
Additional Info
No response