| Conditions | 2 |
| Total Lines | 187 |
| Code Lines | 114 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | """The central module containing all code dealing with fixing ehv subnetworks |
||
| 188 | def fix_subnetworks(scn_name): |
||
| 189 | |||
| 190 | # Missing 220kV line to Lübeck Siems |
||
| 191 | # add 220kV bus at substation Lübeck Siems |
||
| 192 | add_bus(10.760835327266625, 53.90974536547805, 220, scn_name) |
||
| 193 | # add 220/380kV transformer at substation Lübeck Siems |
||
| 194 | add_trafo(10.760835327266625, 53.90974536547805, 220, 380, scn_name) |
||
| 195 | |||
| 196 | # add 220kV line from Umspannwerk Lübeck to Lübeck Siems |
||
| 197 | add_line( |
||
| 198 | 10.760835327266625, # Lübeck Siems |
||
| 199 | 53.90974536547805, |
||
| 200 | 10.640952461335745, # Umspannwerk Lübeck |
||
| 201 | 53.91944427801032, |
||
| 202 | 220, |
||
| 203 | scn_name, |
||
| 204 | 3, |
||
| 205 | ) |
||
| 206 | |||
| 207 | # Missing 220kV line from Audorf to Kiel |
||
| 208 | add_line( |
||
| 209 | # Audorf |
||
| 210 | 9.726992766257577, |
||
| 211 | 54.291420962253234, |
||
| 212 | # Kiel |
||
| 213 | 9.9572075, |
||
| 214 | 54.321589, |
||
| 215 | 220, |
||
| 216 | scn_name, |
||
| 217 | 6, |
||
| 218 | ) |
||
| 219 | |||
| 220 | if settings()["egon-data"]["--dataset-boundary"] == "Everything": |
||
| 221 | |||
| 222 | # Missing line from USW Uchtelfangen to 'Kraftwerk Weiher' |
||
| 223 | add_line( |
||
| 224 | 7.032657738999395, # Kraftwerk Weiher |
||
| 225 | 49.33473737285781, |
||
| 226 | 6.996454674906, # Umspannwerk Uchtelfangen |
||
| 227 | 49.3754149606116, |
||
| 228 | 220, |
||
| 229 | scn_name, |
||
| 230 | 6, |
||
| 231 | ) |
||
| 232 | |||
| 233 | # Missing 380kV line near Elsfleth |
||
| 234 | add_line( |
||
| 235 | # Line |
||
| 236 | 8.419326700000001, |
||
| 237 | 53.229867000000006, |
||
| 238 | # Schaltanlage Elsfleth/West |
||
| 239 | 8.402976949446648, |
||
| 240 | 53.2371468322213, |
||
| 241 | 380, |
||
| 242 | scn_name, |
||
| 243 | 6, |
||
| 244 | ) |
||
| 245 | |||
| 246 | # Missing 380kV line near Magdala |
||
| 247 | add_line( |
||
| 248 | # Line north south |
||
| 249 | 11.4298432, |
||
| 250 | 50.9117467, |
||
| 251 | # Line east |
||
| 252 | 11.4295305, |
||
| 253 | 50.9115176, |
||
| 254 | 380, |
||
| 255 | scn_name, |
||
| 256 | 3, |
||
| 257 | ) |
||
| 258 | |||
| 259 | # Missing 220kV line near Frimmersdorf |
||
| 260 | add_line( |
||
| 261 | # Line west |
||
| 262 | 6.585418000000001, |
||
| 263 | 51.0495723, |
||
| 264 | # Line east |
||
| 265 | 6.5867616, |
||
| 266 | 51.0520915, |
||
| 267 | 220, |
||
| 268 | scn_name, |
||
| 269 | 6, |
||
| 270 | ) |
||
| 271 | |||
| 272 | # Missing 220kV line from Wolmirstedt to Stendal |
||
| 273 | add_line( |
||
| 274 | # Wolmirstedt |
||
| 275 | 11.637225336209951, |
||
| 276 | 52.26707328151311, |
||
| 277 | # Stendal |
||
| 278 | 11.7689, |
||
| 279 | 52.505533, |
||
| 280 | 220, |
||
| 281 | scn_name, |
||
| 282 | 6, |
||
| 283 | ) |
||
| 284 | |||
| 285 | # Plattling |
||
| 286 | # Update way for osmTGmod in |
||
| 287 | # 'LINESTRING (12.85328076018362 48.76616932172957, |
||
| 288 | # 12.85221826521118 48.76597882857125, |
||
| 289 | # 12.85092755963579 48.76451816626182, |
||
| 290 | # 12.85081583430311 48.76336597271223, |
||
| 291 | # 12.85089191559093 48.76309793961921, |
||
| 292 | # 12.85171674549663 48.76313124988151, |
||
| 293 | # 12.85233496021983 48.76290980724934, |
||
| 294 | # 12.85257485139349 48.76326650768988, |
||
| 295 | # 12.85238077788078 48.76354965879587, |
||
| 296 | # 12.85335698387775 48.76399030383004, |
||
| 297 | # 12.85444925633996 48.76422235417385, |
||
| 298 | # 12.853289544662 48.76616304929393)' |
||
| 299 | |||
| 300 | # Lamspringe 380kV lines |
||
| 301 | drop_line( |
||
| 302 | 9.988215035677026, |
||
| 303 | 51.954230057487926, |
||
| 304 | 9.991477300000001, |
||
| 305 | 51.939711, |
||
| 306 | 380, |
||
| 307 | scn_name, |
||
| 308 | ) |
||
| 309 | |||
| 310 | drop_line( |
||
| 311 | 9.995589, |
||
| 312 | 51.969716000000005, |
||
| 313 | 9.988215035677026, |
||
| 314 | 51.954230057487926, |
||
| 315 | 380, |
||
| 316 | scn_name, |
||
| 317 | ) |
||
| 318 | |||
| 319 | drop_line( |
||
| 320 | 9.982829, |
||
| 321 | 51.985980000000005, |
||
| 322 | 9.995589, |
||
| 323 | 51.969716000000005, |
||
| 324 | 380, |
||
| 325 | scn_name, |
||
| 326 | ) |
||
| 327 | |||
| 328 | drop_line( |
||
| 329 | 10.004865, |
||
| 330 | 51.999120000000005, |
||
| 331 | 9.982829, |
||
| 332 | 51.985980000000005, |
||
| 333 | 380, |
||
| 334 | scn_name, |
||
| 335 | ) |
||
| 336 | |||
| 337 | drop_line( |
||
| 338 | 10.174395, |
||
| 339 | 52.036448, |
||
| 340 | 9.988215035677026, |
||
| 341 | 51.954230057487926, |
||
| 342 | 380, |
||
| 343 | scn_name, |
||
| 344 | ) |
||
| 345 | |||
| 346 | drop_line( |
||
| 347 | 10.195144702845797, |
||
| 348 | 52.079851837273964, |
||
| 349 | 10.174395, |
||
| 350 | 52.036448, |
||
| 351 | 380, |
||
| 352 | scn_name, |
||
| 353 | ) |
||
| 354 | |||
| 355 | drop_trafo(9.988215035677026, 51.954230057487926, 110, 380, scn_name) |
||
| 356 | |||
| 357 | drop_bus(9.988215035677026, 51.954230057487926, 380, scn_name) |
||
| 358 | drop_bus(9.991477300000001, 51.939711, 380, scn_name) |
||
| 359 | drop_bus(9.995589, 51.969716000000005, 380, scn_name) |
||
| 360 | drop_bus(9.982829, 51.985980000000005, 380, scn_name) |
||
| 361 | drop_bus(10.174395, 52.036448, 380, scn_name) |
||
| 362 | drop_bus(10.195144702845797, 52.079851837273964, 380, scn_name) |
||
| 363 | |||
| 364 | drop_bus(10.004865, 51.999120000000005, 380, scn_name) |
||
| 365 | |||
| 366 | # Umspannwerk Vieselbach |
||
| 367 | # delete isolated bus and trafo |
||
| 368 | drop_bus(11.121774798935334, 51.00038603925895, 380, scn_name) |
||
| 369 | drop_trafo(11.121774798935334, 51.00038603925895, 220, 380, scn_name) |
||
| 370 | |||
| 371 | # Umspannwerk Waldlaubersheim |
||
| 372 | # delete isolated bus and trafo |
||
| 373 | drop_bus(7.815993836091339, 49.92211102637183, 380, scn_name) |
||
| 374 | drop_trafo(7.815993836091339, 49.92211102637183, 110, 380, scn_name) |
||
| 375 | |||
| 380 |