Code Duplication    Length = 35-36 lines in 2 locations

src/egon/data/datasets/DSM_cts_ind.py 2 locations

@@ 319-354 (lines=36) @@
316
    return dsm
317
318
319
def ind_sites_vent_data_import_individual(ind_vent_share, wz):
320
    """
321
    Import industry sites necessary to identify DSM-potential.
322
        ----------
323
    ind_vent_share: float
324
        Share of considered application in industry demand
325
    wz: int
326
        Wirtschaftszweig to be considered within industry sites
327
    """
328
329
    # import load data
330
331
    sources = config.datasets()["DSM_CTS_industry"]["sources"][
332
        "ind_sites_loadcurves_individual"
333
    ]
334
335
    dsm = db.select_dataframe(
336
        f"""
337
        SELECT site_id, bus_id as bus, scn_name, p_set FROM
338
        {sources['schema']}.{sources['table']}
339
        WHERE wz = {wz}
340
        """
341
    )
342
343
    # calculate share of timeseries for ventilation
344
345
    timeseries = dsm["p_set"].copy()
346
347
    for index, liste in timeseries.items():
348
        share = [float(item) * ind_vent_share for item in liste]
349
        timeseries.loc[index] = share
350
351
    dsm["p_set"] = timeseries.copy()
352
353
    return dsm
354
355
356
def calc_ind_site_timeseries(scenario):
357
    # calculate timeseries per site
@@ 282-316 (lines=35) @@
279
    return dsm
280
281
282
def ind_sites_vent_data_import(ind_vent_share, wz):
283
    """
284
    Import industry sites necessary to identify DSM-potential.
285
        ----------
286
    ind_vent_share: float
287
        Share of considered application in industry demand
288
    wz: int
289
        Wirtschaftszweig to be considered within industry sites
290
    """
291
292
    # import load data
293
294
    sources = config.datasets()["DSM_CTS_industry"]["sources"][
295
        "ind_sites_loadcurves"
296
    ]
297
298
    dsm = db.select_dataframe(
299
        f"""
300
        SELECT bus, scn_name, p_set FROM
301
        {sources['schema']}.{sources['table']}
302
        WHERE wz = {wz}
303
        """
304
    )
305
306
    # calculate share of timeseries for ventilation
307
308
    timeseries = dsm["p_set"].copy()
309
310
    for index, liste in timeseries.items():
311
        share = [float(item) * ind_vent_share for item in liste]
312
        timeseries.loc[index] = share
313
314
    dsm["p_set"] = timeseries.copy()
315
316
    return dsm
317
318
319
def ind_sites_vent_data_import_individual(ind_vent_share, wz):