Code Duplication    Length = 35-35 lines in 2 locations

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

@@ 232-266 (lines=35) @@
229
            warning=False,
230
        )
231
232
        if (
233
            sum_output.output_capacity_mw.sum() == 0
234
            and sum_input.input_capacity_mw.sum() == 0
235
        ):
236
            print(
237
                f"No capacity for carrier '{carrier}' needed to be "
238
                f"distributed. Everything is fine"
239
            )
240
241
        elif (
242
            sum_input.input_capacity_mw.sum() > 0
243
            and sum_output.output_capacity_mw.sum() == 0
244
        ):
245
            print(
246
                f"Error: Capacity for carrier '{carrier}' was not distributed"
247
                f" at all!"
248
            )
249
250
        elif (
251
            sum_output.output_capacity_mw.sum() > 0
252
            and sum_input.input_capacity_mw.sum() == 0
253
        ):
254
            print(
255
                f"Error: Eventhough no input capacity was provided for carrier"
256
                f" '{carrier}' a capacity got distributed!"
257
            )
258
259
        else:
260
            sum_input["error"] = (
261
                (sum_output.output_capacity_mw - sum_input.input_capacity_mw)
262
                / sum_input.input_capacity_mw
263
            ) * 100
264
            g = sum_input["error"].values[0]
265
266
            print(f"{carrier}: " + str(round(g, 2)) + " %")
267
268
    # Section to check loads
269
@@ 159-193 (lines=35) @@
156
            warning=False,
157
        )
158
159
        if (
160
            sum_output.output_capacity_mw.sum() == 0
161
            and sum_input.input_capacity_mw.sum() == 0
162
        ):
163
            logger.info(
164
                f"No capacity for carrier '{carrier}' needed to be"
165
                f" distributed. Everything is fine"
166
            )
167
168
        elif (
169
            sum_input.input_capacity_mw.sum() > 0
170
            and sum_output.output_capacity_mw.sum() == 0
171
        ):
172
            logger.info(
173
                f"Error: Capacity for carrier '{carrier}' was not distributed "
174
                f"at all!"
175
            )
176
177
        elif (
178
            sum_output.output_capacity_mw.sum() > 0
179
            and sum_input.input_capacity_mw.sum() == 0
180
        ):
181
            logger.info(
182
                f"Error: Eventhough no input capacity was provided for carrier"
183
                f"'{carrier}' a capacity got distributed!"
184
            )
185
186
        else:
187
            sum_input["error"] = (
188
                (sum_output.output_capacity_mw - sum_input.input_capacity_mw)
189
                / sum_input.input_capacity_mw
190
            ) * 100
191
            g = sum_input["error"].values[0]
192
193
            logger.info(f"{carrier}: " + str(round(g, 2)) + " %")
194
195
    # Section to check storage units
196