Code Duplication    Length = 32-33 lines in 2 locations

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

@@ 1148-1180 (lines=33) @@
1145
    log.info("Profile share exported to DB!")
1146
1147
1148
def cts_heat():
1149
    """
1150
    Calculate cts electricity demand share of hvmv substation profile
1151
     for buildings.
1152
    """
1153
    log = start_logging()
1154
    log.info("Start logging!")
1155
    with db.session_scope() as session:
1156
        cells_query = session.query(CtsBuildings)
1157
1158
    df_cts_buildings = pd.read_sql(
1159
        cells_query.statement, cells_query.session.bind, index_col=None
1160
    )
1161
    log.info("CTS buildings from DB imported!")
1162
1163
    df_demand_share_2035 = calc_building_demand_profile_share(
1164
        df_cts_buildings, scenario="eGon2035", sector="heat"
1165
    )
1166
    log.info("Profile share for egon2035 calculated!")
1167
    df_demand_share_100RE = calc_building_demand_profile_share(
1168
        df_cts_buildings, scenario="eGon100RE", sector="heat"
1169
    )
1170
    log.info("Profile share for egon100RE calculated!")
1171
    df_demand_share = pd.concat(
1172
        [df_demand_share_2035, df_demand_share_100RE],
1173
        axis=0,
1174
        ignore_index=True,
1175
    )
1176
1177
    write_table_to_postgres(
1178
        df_demand_share, EgonCtsHeatDemandBuildingShare, drop=True
1179
    )
1180
    log.info("Profile share exported to DB!")
1181
1182
1183
def get_cts_electricity_peak_load():
@@ 1114-1145 (lines=32) @@
1111
    log.info("CTS buildings exported to DB!")
1112
1113
1114
def cts_electricity():
1115
    """
1116
    Calculate cts electricity demand share of hvmv substation profile
1117
     for buildings.
1118
    """
1119
    log = start_logging()
1120
    log.info("Start logging!")
1121
    with db.session_scope() as session:
1122
        cells_query = session.query(CtsBuildings)
1123
1124
    df_cts_buildings = pd.read_sql(
1125
        cells_query.statement, cells_query.session.bind, index_col=None
1126
    )
1127
    log.info("CTS buildings from DB imported!")
1128
    df_demand_share_2035 = calc_building_demand_profile_share(
1129
        df_cts_buildings, scenario="eGon2035", sector="electricity"
1130
    )
1131
    log.info("Profile share for egon2035 calculated!")
1132
    df_demand_share_100RE = calc_building_demand_profile_share(
1133
        df_cts_buildings, scenario="eGon100RE", sector="electricity"
1134
    )
1135
    log.info("Profile share for egon100RE calculated!")
1136
    df_demand_share = pd.concat(
1137
        [df_demand_share_2035, df_demand_share_100RE],
1138
        axis=0,
1139
        ignore_index=True,
1140
    )
1141
1142
    write_table_to_postgres(
1143
        df_demand_share, EgonCtsElectricityDemandBuildingShare, drop=True
1144
    )
1145
    log.info("Profile share exported to DB!")
1146
1147
1148
def cts_heat():