Code Duplication    Length = 32-33 lines in 2 locations

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

@@ 1130-1162 (lines=33) @@
1127
    log.info("Profile share exported to DB!")
1128
1129
1130
def cts_heat():
1131
    """
1132
    Calculate cts electricity demand share of hvmv substation profile
1133
     for buildings.
1134
    """
1135
    log = start_logging()
1136
    log.info("Start logging!")
1137
    with db.session_scope() as session:
1138
        cells_query = session.query(CtsBuildings)
1139
1140
    df_cts_buildings = pd.read_sql(
1141
        cells_query.statement, cells_query.session.bind, index_col=None
1142
    )
1143
    log.info("CTS buildings from DB imported!")
1144
1145
    df_demand_share_2035 = calc_building_demand_profile_share(
1146
        df_cts_buildings, scenario="eGon2035", sector="heat"
1147
    )
1148
    log.info("Profile share for egon2035 calculated!")
1149
    df_demand_share_100RE = calc_building_demand_profile_share(
1150
        df_cts_buildings, scenario="eGon100RE", sector="heat"
1151
    )
1152
    log.info("Profile share for egon100RE calculated!")
1153
    df_demand_share = pd.concat(
1154
        [df_demand_share_2035, df_demand_share_100RE],
1155
        axis=0,
1156
        ignore_index=True,
1157
    )
1158
1159
    write_table_to_postgres(
1160
        df_demand_share, EgonCtsHeatDemandBuildingShare, drop=True
1161
    )
1162
    log.info("Profile share exported to DB!")
1163
1164
1165
def get_cts_electricity_peak_load():
@@ 1096-1127 (lines=32) @@
1093
    log.info("CTS buildings exported to DB!")
1094
1095
1096
def cts_electricity():
1097
    """
1098
    Calculate cts electricity demand share of hvmv substation profile
1099
     for buildings.
1100
    """
1101
    log = start_logging()
1102
    log.info("Start logging!")
1103
    with db.session_scope() as session:
1104
        cells_query = session.query(CtsBuildings)
1105
1106
    df_cts_buildings = pd.read_sql(
1107
        cells_query.statement, cells_query.session.bind, index_col=None
1108
    )
1109
    log.info("CTS buildings from DB imported!")
1110
    df_demand_share_2035 = calc_building_demand_profile_share(
1111
        df_cts_buildings, scenario="eGon2035", sector="electricity"
1112
    )
1113
    log.info("Profile share for egon2035 calculated!")
1114
    df_demand_share_100RE = calc_building_demand_profile_share(
1115
        df_cts_buildings, scenario="eGon100RE", sector="electricity"
1116
    )
1117
    log.info("Profile share for egon100RE calculated!")
1118
    df_demand_share = pd.concat(
1119
        [df_demand_share_2035, df_demand_share_100RE],
1120
        axis=0,
1121
        ignore_index=True,
1122
    )
1123
1124
    write_table_to_postgres(
1125
        df_demand_share, EgonCtsElectricityDemandBuildingShare, drop=True
1126
    )
1127
    log.info("Profile share exported to DB!")
1128
1129
1130
def cts_heat():