| 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 |
||
| 180 | def fix_subnetworks(scn_name): |
||
| 181 | |||
| 182 | # Missing 220kV line to Lübeck Siems |
||
| 183 | # add 220kV bus at substation Lübeck Siems |
||
| 184 | add_bus(10.760835327266625, 53.90974536547805, 220, scn_name) |
||
| 185 | # add 220/380kV transformer at substation Lübeck Siems |
||
| 186 | add_trafo(10.760835327266625, 53.90974536547805, 220, 380, scn_name) |
||
| 187 | |||
| 188 | # add 220kV line from Umspannwerk Lübeck to Lübeck Siems |
||
| 189 | add_line( |
||
| 190 | 10.760835327266625, # Lübeck Siems |
||
| 191 | 53.90974536547805, |
||
| 192 | 10.640952461335745, # Umspannwerk Lübeck |
||
| 193 | 53.91944427801032, |
||
| 194 | 220, |
||
| 195 | scn_name, |
||
| 196 | 3, |
||
| 197 | ) |
||
| 198 | |||
| 199 | # Missing 220kV line from Audorf to Kiel |
||
| 200 | add_line( |
||
| 201 | # Audorf |
||
| 202 | 9.726992766257577, |
||
| 203 | 54.291420962253234, |
||
| 204 | # Kiel |
||
| 205 | 9.9572075, |
||
| 206 | 54.321589, |
||
| 207 | 220, |
||
| 208 | scn_name, |
||
| 209 | 6, |
||
| 210 | ) |
||
| 211 | |||
| 212 | if settings()["egon-data"]["--dataset-boundary"] == "Everything": |
||
| 213 | |||
| 214 | # Missing line from USW Uchtelfangen to 'Kraftwerk Weiher' |
||
| 215 | add_line( |
||
| 216 | 7.032657738999395, # Kraftwerk Weiher |
||
| 217 | 49.33473737285781, |
||
| 218 | 6.996454674906, # Umspannwerk Uchtelfangen |
||
| 219 | 49.3754149606116, |
||
| 220 | 220, |
||
| 221 | scn_name, |
||
| 222 | 6, |
||
| 223 | ) |
||
| 224 | |||
| 225 | # Missing 380kV line near Elsfleth |
||
| 226 | add_line( |
||
| 227 | # Line |
||
| 228 | 8.419326700000001, |
||
| 229 | 53.229867000000006, |
||
| 230 | # Schaltanlage Elsfleth/West |
||
| 231 | 8.402976949446648, |
||
| 232 | 53.2371468322213, |
||
| 233 | 380, |
||
| 234 | scn_name, |
||
| 235 | 6, |
||
| 236 | ) |
||
| 237 | |||
| 238 | # Missing 380kV line near Magdala |
||
| 239 | add_line( |
||
| 240 | # Line north south |
||
| 241 | 11.4298432, |
||
| 242 | 50.9117467, |
||
| 243 | # Line east |
||
| 244 | 11.4295305, |
||
| 245 | 50.9115176, |
||
| 246 | 380, |
||
| 247 | scn_name, |
||
| 248 | 3, |
||
| 249 | ) |
||
| 250 | |||
| 251 | # Missing 220kV line near Frimmersdorf |
||
| 252 | add_line( |
||
| 253 | # Line west |
||
| 254 | 6.585418000000001, |
||
| 255 | 51.0495723, |
||
| 256 | # Line east |
||
| 257 | 6.5867616, |
||
| 258 | 51.0520915, |
||
| 259 | 220, |
||
| 260 | scn_name, |
||
| 261 | 6, |
||
| 262 | ) |
||
| 263 | |||
| 264 | # Missing 220kV line from Wolmirstedt to Stendal |
||
| 265 | add_line( |
||
| 266 | # Wolmirstedt |
||
| 267 | 11.637225336209951, |
||
| 268 | 52.26707328151311, |
||
| 269 | # Stendal |
||
| 270 | 11.7689, |
||
| 271 | 52.505533, |
||
| 272 | 220, |
||
| 273 | scn_name, |
||
| 274 | 6, |
||
| 275 | ) |
||
| 276 | |||
| 277 | # Plattling |
||
| 278 | # Update way for osmTGmod in |
||
| 279 | # 'LINESTRING (12.85328076018362 48.76616932172957, |
||
| 280 | # 12.85221826521118 48.76597882857125, |
||
| 281 | # 12.85092755963579 48.76451816626182, |
||
| 282 | # 12.85081583430311 48.76336597271223, |
||
| 283 | # 12.85089191559093 48.76309793961921, |
||
| 284 | # 12.85171674549663 48.76313124988151, |
||
| 285 | # 12.85233496021983 48.76290980724934, |
||
| 286 | # 12.85257485139349 48.76326650768988, |
||
| 287 | # 12.85238077788078 48.76354965879587, |
||
| 288 | # 12.85335698387775 48.76399030383004, |
||
| 289 | # 12.85444925633996 48.76422235417385, |
||
| 290 | # 12.853289544662 48.76616304929393)' |
||
| 291 | |||
| 292 | # Lamspringe 380kV lines |
||
| 293 | drop_line( |
||
| 294 | 9.988215035677026, |
||
| 295 | 51.954230057487926, |
||
| 296 | 9.991477300000001, |
||
| 297 | 51.939711, |
||
| 298 | 380, |
||
| 299 | scn_name, |
||
| 300 | ) |
||
| 301 | |||
| 302 | drop_line( |
||
| 303 | 9.995589, |
||
| 304 | 51.969716000000005, |
||
| 305 | 9.988215035677026, |
||
| 306 | 51.954230057487926, |
||
| 307 | 380, |
||
| 308 | scn_name, |
||
| 309 | ) |
||
| 310 | |||
| 311 | drop_line( |
||
| 312 | 9.982829, |
||
| 313 | 51.985980000000005, |
||
| 314 | 9.995589, |
||
| 315 | 51.969716000000005, |
||
| 316 | 380, |
||
| 317 | scn_name, |
||
| 318 | ) |
||
| 319 | |||
| 320 | drop_line( |
||
| 321 | 10.004865, |
||
| 322 | 51.999120000000005, |
||
| 323 | 9.982829, |
||
| 324 | 51.985980000000005, |
||
| 325 | 380, |
||
| 326 | scn_name, |
||
| 327 | ) |
||
| 328 | |||
| 329 | drop_line( |
||
| 330 | 10.174395, |
||
| 331 | 52.036448, |
||
| 332 | 9.988215035677026, |
||
| 333 | 51.954230057487926, |
||
| 334 | 380, |
||
| 335 | scn_name, |
||
| 336 | ) |
||
| 337 | |||
| 338 | drop_line( |
||
| 339 | 10.195144702845797, |
||
| 340 | 52.079851837273964, |
||
| 341 | 10.174395, |
||
| 342 | 52.036448, |
||
| 343 | 380, |
||
| 344 | scn_name, |
||
| 345 | ) |
||
| 346 | |||
| 347 | drop_trafo(9.988215035677026, 51.954230057487926, 110, 380, scn_name) |
||
| 348 | |||
| 349 | drop_bus(9.988215035677026, 51.954230057487926, 380, scn_name) |
||
| 350 | drop_bus(9.991477300000001, 51.939711, 380, scn_name) |
||
| 351 | drop_bus(9.995589, 51.969716000000005, 380, scn_name) |
||
| 352 | drop_bus(9.982829, 51.985980000000005, 380, scn_name) |
||
| 353 | drop_bus(10.174395, 52.036448, 380, scn_name) |
||
| 354 | drop_bus(10.195144702845797, 52.079851837273964, 380, scn_name) |
||
| 355 | |||
| 356 | drop_bus(10.004865, 51.999120000000005, 380, scn_name) |
||
| 357 | |||
| 358 | # Umspannwerk Vieselbach |
||
| 359 | # delete isolated bus and trafo |
||
| 360 | drop_bus(11.121774798935334, 51.00038603925895, 380, scn_name) |
||
| 361 | drop_trafo(11.121774798935334, 51.00038603925895, 220, 380, scn_name) |
||
| 362 | |||
| 363 | # Umspannwerk Waldlaubersheim |
||
| 364 | # delete isolated bus and trafo |
||
| 365 | drop_bus(7.815993836091339, 49.92211102637183, 380, scn_name) |
||
| 366 | drop_trafo(7.815993836091339, 49.92211102637183, 110, 380, scn_name) |
||
| 367 | |||
| 372 |