Code Duplication    Length = 32-33 lines in 2 locations

src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py 2 locations

@@ 1175-1207 (lines=33) @@
1172
    log.info("Profile share exported to DB!")
1173
1174
1175
def cts_heat():
1176
    """
1177
    Calculate cts electricity demand share of hvmv substation profile
1178
     for buildings.
1179
    """
1180
    log = start_logging()
1181
    log.info("Start logging!")
1182
    with db.session_scope() as session:
1183
        cells_query = session.query(CtsBuildings)
1184
1185
    df_cts_buildings = pd.read_sql(
1186
        cells_query.statement, cells_query.session.bind, index_col=None
1187
    )
1188
    log.info("CTS buildings from DB imported!")
1189
1190
    df_demand_share_2035 = calc_building_demand_profile_share(
1191
        df_cts_buildings, scenario="eGon2035", sector="heat"
1192
    )
1193
    log.info("Profile share for egon2035 calculated!")
1194
    df_demand_share_100RE = calc_building_demand_profile_share(
1195
        df_cts_buildings, scenario="eGon100RE", sector="heat"
1196
    )
1197
    log.info("Profile share for egon100RE calculated!")
1198
    df_demand_share = pd.concat(
1199
        [df_demand_share_2035, df_demand_share_100RE],
1200
        axis=0,
1201
        ignore_index=True,
1202
    )
1203
1204
    write_table_to_postgres(
1205
        df_demand_share, EgonCtsHeatDemandBuildingShare, drop=True
1206
    )
1207
    log.info("Profile share exported to DB!")
1208
1209
1210
def get_cts_electricity_peak_load():
@@ 1141-1172 (lines=32) @@
1138
    log.info("CTS buildings exported to DB!")
1139
1140
1141
def cts_electricity():
1142
    """
1143
    Calculate cts electricity demand share of hvmv substation profile
1144
     for buildings.
1145
    """
1146
    log = start_logging()
1147
    log.info("Start logging!")
1148
    with db.session_scope() as session:
1149
        cells_query = session.query(CtsBuildings)
1150
1151
    df_cts_buildings = pd.read_sql(
1152
        cells_query.statement, cells_query.session.bind, index_col=None
1153
    )
1154
    log.info("CTS buildings from DB imported!")
1155
    df_demand_share_2035 = calc_building_demand_profile_share(
1156
        df_cts_buildings, scenario="eGon2035", sector="electricity"
1157
    )
1158
    log.info("Profile share for egon2035 calculated!")
1159
    df_demand_share_100RE = calc_building_demand_profile_share(
1160
        df_cts_buildings, scenario="eGon100RE", sector="electricity"
1161
    )
1162
    log.info("Profile share for egon100RE calculated!")
1163
    df_demand_share = pd.concat(
1164
        [df_demand_share_2035, df_demand_share_100RE],
1165
        axis=0,
1166
        ignore_index=True,
1167
    )
1168
1169
    write_table_to_postgres(
1170
        df_demand_share, EgonCtsElectricityDemandBuildingShare, drop=True
1171
    )
1172
    log.info("Profile share exported to DB!")
1173
1174
1175
def cts_heat():