Skip to content

Commit f211598

Browse files
committed
format
1 parent c19e960 commit f211598

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/andromede/pypsa_converter/pypsa_converter.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ def _pypsa_network_assertion(self) -> None:
162162
]
163163
== "co2_emissions"
164164
)
165+
165166
def _rename_buses(self) -> None:
166167
### Rename PyPSA buses, to delete spaces
167168
if len(self.pypsa_network.buses) > 0:
@@ -177,7 +178,8 @@ def _rename_buses(self) -> None:
177178
for col in ["bus", "bus0", "bus1"]:
178179
if col in df.columns:
179180
df[col] = df[col].str.replace(" ", "_")
180-
181+
182+
181183
def _pypsa_network_preprocessing(self) -> None:
182184
###Add fictitious carrier
183185
self.pypsa_network.add(
@@ -191,9 +193,9 @@ def _pypsa_network_preprocessing(self) -> None:
191193
] = self.pypsa_network.carriers.index.values
192194
self._rename_buses()
193195

194-
def _rename_pypsa_components(self, component_type: str)-> None:
196+
def _rename_pypsa_components(self, component_type: str) -> None:
195197
df = getattr(self.pypsa_network, component_type)
196-
if len(df)==0:
198+
if len(df) == 0:
197199
return
198200
### Rename PyPSA components, to make sure that the names are uniques (used as id in the Gems model)
199201
prefix = component_type[:-1]
@@ -202,9 +204,9 @@ def _rename_pypsa_components(self, component_type: str)-> None:
202204
for _, val in dictionnary.items():
203205
val.columns = prefix + "_" + val.columns.str.replace(" ", "_")
204206

205-
def _fix_capacities(self, component_type: str, capa_str:str)-> None:
207+
def _fix_capacities(self, component_type: str, capa_str:str) -> None:
206208
df = getattr(self.pypsa_network, component_type)
207-
if len(df)==0:
209+
if len(df) == 0:
208210
return
209211
### Adding min and max capacities to non-extendable objects
210212
for field in [capa_str + "_min", capa_str + "_max"]:
@@ -231,7 +233,7 @@ def _preprocess_pypsa_components(
231233
)
232234
self._rename_pypsa_components(component_type)
233235
if extendable:
234-
self._fix_capacities(component_type,capa_str)
236+
self._fix_capacities(component_type, capa_str)
235237

236238

237239
def _register_pypsa_components(self) -> None:

tests/pypsa_converter/test_advanced_pypsa_cases.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,3 @@ def test_case_gemspy() -> None:
211211
pypsa_gemspy_benchmark("base_s_6_elec_lvopt_.nc", 0.4, True)
212212
pypsa_gemspy_benchmark("base_s_6_elec_lvopt_.nc", 0.3, True)
213213
pypsa_gemspy_benchmark("simple.nc", 1.0, False)
214-

0 commit comments

Comments
 (0)