Passed
Pull Request — dev (#1375)
by
unknown
02:18
created

data.datasets.final_validations   B

Complexity

Total Complexity 2

Size/Duplication

Total Lines 1787
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 1296
dl 0
loc 1787
rs 8.8
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B FinalValidations.__init__() 0 1684 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A notasks() 0 13 1
1
"""
2
Dataset for cross-cutting validations that run at the end of the pipeline.
3
4
This module provides the FinalValidations dataset which contains validation rules
5
that check data consistency across multiple datasets. These validations should run
6
after all data generation is complete, but before the final validation report.
7
"""
8
9
from egon.data.datasets import Dataset
10
from egon.data.validation.rules.custom.sanity import (
11
    CH4StoresCapacity,
12
    H2SaltcavernStoresCapacity,
13
    GasBusesIsolated,
14
    GasBusesCount,
15
    GasOnePortConnections,
16
    CH4GridCapacity,
17
    GasLinksConnections,
18
    GasLoadsCapacity,
19
    GasGeneratorsCapacity,
20
    ElectricityCapacityComparison,
21
    HeatDemandValidation,
22
    ElectricalLoadSectorBreakdown,
23
)
24
from egon_validation import (
25
    ArrayCardinalityValidation,
26
    ElectricalLoadAggregationValidation,
27
    RowCountValidation,
28
    DataTypeValidation,
29
    NotNullAndNotNaNValidation,
30
    WholeTableNotNullAndNotNaNValidation,
31
    ValueSetValidation,
32
    SRIDUniqueNonZero
33
)
34
35
36
def notasks():
37
    """
38
    Placeholder task function.
39
40
    This dataset has no data generation tasks - it only runs validation rules
41
    defined in the validation dict. The validation framework automatically creates
42
    validation tasks from the rules.
43
44
    Returns
45
    -------
46
    None
47
    """
48
    return None
49
50
51
class FinalValidations(Dataset):
52
    """
53
    Cross-cutting validations that run at the end of the pipeline.
54
55
    This dataset contains validation rules that check data consistency across
56
    multiple datasets and should run after all data generation is complete.
57
58
    The validations are organized by category and run automatically as part of
59
    the dataset's validation tasks. Results are collected by ValidationReport.
60
61
    *Dependencies*
62
      Should depend on all datasets whose data is validated by the rules
63
      defined here. At minimum:
64
      * CH4Storages - for CH4 store capacity validation
65
      * HydrogenStoreEtrago - for H2 saltcavern store validation
66
      * Add more as you add validation rules
67
68
    *Validation Results*
69
      Results are written to validation_runs/{run_id}/tasks/FinalValidations.validate.*/
70
      and collected by the ValidationReport dataset
71
72
    *Adding New Validations*
73
      To add new cross-cutting validations:
74
      1. Create the validation rule class in validation/rules/custom/sanity/
75
      2. Import it at the top of this file
76
      3. Add instances to the appropriate category in the validation dict below
77
      4. Update dependencies to include datasets that provide the data being validated
78
79
    Example
80
    -------
81
    To add a new gas grid validation:
82
83
    ```python
84
    from egon.data.validation.rules.custom.sanity import CH4GridCapacity
85
86
    # In the validation dict:
87
    "gas_stores": [
88
        # ... existing rules ...
89
        CH4GridCapacity(
90
            table="grid.egon_etrago_link",
91
            rule_id="SANITY_CH4_GRID_CAPACITY",
92
            scenario="eGon2035"
93
        ),
94
    ]
95
    ```
96
    """
97
98
    #:
99
    name: str = "FinalValidations"
100
    #:
101
    version: str = "0.0.1.dev"
102
103
    def __init__(self, dependencies):
104
        super().__init__(
105
            name=self.name,
106
            version=self.version,
107
            dependencies=dependencies,
108
            tasks=(notasks,),  # No data tasks - only validation tasks
109
            validation={
110
                # Gas store capacity validations
111
                # These check that CH4 and H2 store capacities match expected values
112
                "gas_stores": [
113
                    # CH4 stores - eGon2035
114
                    CH4StoresCapacity(
115
                        table="grid.egon_etrago_store",
116
                        rule_id="SANITY_CH4_STORES_CAPACITY_EGON2035",
117
                        scenario="eGon2035",
118
                        rtol=0.02
119
                    ),
120
                    # CH4 stores - eGon100RE
121
                    CH4StoresCapacity(
122
                        table="grid.egon_etrago_store",
123
                        rule_id="SANITY_CH4_STORES_CAPACITY_EGON100RE",
124
                        scenario="eGon100RE",
125
                        rtol=0.02
126
                    ),
127
                    # H2 saltcavern stores - eGon2035
128
                    H2SaltcavernStoresCapacity(
129
                        table="grid.egon_etrago_store",
130
                        rule_id="SANITY_H2_SALTCAVERN_STORES_CAPACITY_EGON2035",
131
                        scenario="eGon2035",
132
                        rtol=0.02
133
                    ),
134
                    # H2 saltcavern stores - eGon100RE
135
                    H2SaltcavernStoresCapacity(
136
                        table="grid.egon_etrago_store",
137
                        rule_id="SANITY_H2_SALTCAVERN_STORES_CAPACITY_EGON100RE",
138
                        scenario="eGon100RE",
139
                        rtol=0.02
140
                    ),
141
                ],
142
143
                # Gas grid bus validations
144
                # These check that gas buses are properly connected and counts match expectations
145
                "gas_grid": [
146
                    # Check for isolated CH4 buses - eGon2035
147
                    GasBusesIsolated(
148
                        table="grid.egon_etrago_bus",
149
                        rule_id="SANITY_GAS_BUSES_ISOLATED_CH4_EGON2035",
150
                        scenario="eGon2035",
151
                        carrier="CH4"
152
                    ),
153
                    # Check for isolated H2_grid buses - eGon2035
154
                    GasBusesIsolated(
155
                        table="grid.egon_etrago_bus",
156
                        rule_id="SANITY_GAS_BUSES_ISOLATED_H2_GRID_EGON2035",
157
                        scenario="eGon2035",
158
                        carrier="H2_grid"
159
                    ),
160
                    # Check for isolated H2_saltcavern buses - eGon2035
161
                    GasBusesIsolated(
162
                        table="grid.egon_etrago_bus",
163
                        rule_id="SANITY_GAS_BUSES_ISOLATED_H2_SALTCAVERN_EGON2035",
164
                        scenario="eGon2035",
165
                        carrier="H2_saltcavern"
166
                    ),
167
                    # NOTE: eGon100RE gas bus isolated checks are commented out
168
                    # because they are also commented out in the original sanity_checks.py
169
                    # (lines 1435-1439). Uncomment when eGon100RE gas bus data is ready.
170
                    # # Check for isolated CH4 buses - eGon100RE
171
                    # GasBusesIsolated(
172
                    #     table="grid.egon_etrago_bus",
173
                    #     rule_id="SANITY_GAS_BUSES_ISOLATED_CH4_EGON100RE",
174
                    #     scenario="eGon100RE",
175
                    #     carrier="CH4"
176
                    # ),
177
                    # # Check for isolated H2_grid buses - eGon100RE
178
                    # GasBusesIsolated(
179
                    #     table="grid.egon_etrago_bus",
180
                    #     rule_id="SANITY_GAS_BUSES_ISOLATED_H2_GRID_EGON100RE",
181
                    #     scenario="eGon100RE",
182
                    #     carrier="H2_grid"
183
                    # ),
184
                    # # Check for isolated H2_saltcavern buses - eGon100RE
185
                    # GasBusesIsolated(
186
                    #     table="grid.egon_etrago_bus",
187
                    #     rule_id="SANITY_GAS_BUSES_ISOLATED_H2_SALTCAVERN_EGON100RE",
188
                    #     scenario="eGon100RE",
189
                    #     carrier="H2_saltcavern"
190
                    # ),
191
                    # Check CH4 bus count - eGon2035
192
                    GasBusesCount(
193
                        table="grid.egon_etrago_bus",
194
                        rule_id="SANITY_GAS_BUSES_COUNT_CH4_EGON2035",
195
                        scenario="eGon2035",
196
                        carrier="CH4",
197
                        rtol=0.10
198
                    ),
199
                    # Check H2_grid bus count - eGon2035
200
                    GasBusesCount(
201
                        table="grid.egon_etrago_bus",
202
                        rule_id="SANITY_GAS_BUSES_COUNT_H2_GRID_EGON2035",
203
                        scenario="eGon2035",
204
                        carrier="H2_grid",
205
                        rtol=0.10
206
                    ),
207
                    # NOTE: eGon100RE gas bus count checks are commented out
208
                    # because sanity_check_gas_buses() is only called for eGon2035 (line 1943)
209
                    # # Check CH4 bus count - eGon100RE
210
                    # GasBusesCount(
211
                    #     table="grid.egon_etrago_bus",
212
                    #     rule_id="SANITY_GAS_BUSES_COUNT_CH4_EGON100RE",
213
                    #     scenario="eGon100RE",
214
                    #     carrier="CH4",
215
                    #     rtol=0.10
216
                    # ),
217
                    # # Check H2_grid bus count - eGon100RE
218
                    # GasBusesCount(
219
                    #     table="grid.egon_etrago_bus",
220
                    #     rule_id="SANITY_GAS_BUSES_COUNT_H2_GRID_EGON100RE",
221
                    #     scenario="eGon100RE",
222
                    #     carrier="H2_grid",
223
                    #     rtol=0.10
224
                    # ),
225
                    # Check CH4 grid capacity - eGon2035
226
                    CH4GridCapacity(
227
                        table="grid.egon_etrago_link",
228
                        rule_id="SANITY_CH4_GRID_CAPACITY_EGON2035",
229
                        scenario="eGon2035",
230
                        rtol=0.10
231
                    ),
232
                    # Check CH4 grid capacity - eGon100RE
233
                    CH4GridCapacity(
234
                        table="grid.egon_etrago_link",
235
                        rule_id="SANITY_CH4_GRID_CAPACITY_EGON100RE",
236
                        scenario="eGon100RE",
237
                        rtol=0.10
238
                    ),
239
                ],
240
241
                # Gas one-port component connection validations
242
                # These check that loads, generators, and stores are connected to valid buses
243
                "gas_one_port": [
244
                    # LOADS - eGon2035
245
                    # CH4_for_industry loads in Germany must connect to CH4 buses
246
                    GasOnePortConnections(
247
                        table="grid.egon_etrago_load",
248
                        rule_id="SANITY_GAS_ONE_PORT_LOAD_CH4_FOR_INDUSTRY_DE_EGON2035",
249
                        scenario="eGon2035",
250
                        component_type="load",
251
                        component_carrier="CH4_for_industry",
252
                        bus_conditions=[("CH4", "= 'DE'")]
253
                    ),
254
                    # CH4 loads abroad must connect to CH4 buses outside Germany
255
                    GasOnePortConnections(
256
                        table="grid.egon_etrago_load",
257
                        rule_id="SANITY_GAS_ONE_PORT_LOAD_CH4_ABROAD_EGON2035",
258
                        scenario="eGon2035",
259
                        component_type="load",
260
                        component_carrier="CH4",
261
                        bus_conditions=[("CH4", "!= 'DE'")]
262
                    ),
263
                    # H2_for_industry loads must connect to H2_grid in DE or AC abroad
264
                    GasOnePortConnections(
265
                        table="grid.egon_etrago_load",
266
                        rule_id="SANITY_GAS_ONE_PORT_LOAD_H2_FOR_INDUSTRY_EGON2035",
267
                        scenario="eGon2035",
268
                        component_type="load",
269
                        component_carrier="H2_for_industry",
270
                        bus_conditions=[("H2_grid", "= 'DE'"), ("AC", "!= 'DE'")]
271
                    ),
272
273
                    # GENERATORS - eGon2035
274
                    # CH4 generators must connect to CH4 buses (any country)
275
                    GasOnePortConnections(
276
                        table="grid.egon_etrago_generator",
277
                        rule_id="SANITY_GAS_ONE_PORT_GENERATOR_CH4_EGON2035",
278
                        scenario="eGon2035",
279
                        component_type="generator",
280
                        component_carrier="CH4",
281
                        bus_conditions=[("CH4", "")]  # Any CH4 bus, no country filter
282
                    ),
283
284
                    # STORES - eGon2035
285
                    # CH4 stores must connect to CH4 buses (any country)
286
                    GasOnePortConnections(
287
                        table="grid.egon_etrago_store",
288
                        rule_id="SANITY_GAS_ONE_PORT_STORE_CH4_EGON2035",
289
                        scenario="eGon2035",
290
                        component_type="store",
291
                        component_carrier="CH4",
292
                        bus_conditions=[("CH4", "")]  # Any CH4 bus, no country filter
293
                    ),
294
                    # H2_underground stores must connect to H2_saltcavern buses (any country)
295
                    GasOnePortConnections(
296
                        table="grid.egon_etrago_store",
297
                        rule_id="SANITY_GAS_ONE_PORT_STORE_H2_UNDERGROUND_EGON2035",
298
                        scenario="eGon2035",
299
                        component_type="store",
300
                        component_carrier="H2_underground",
301
                        bus_conditions=[("H2_saltcavern", "")]  # Any H2_saltcavern bus, no country filter
302
                    ),
303
                    # H2_overground stores must connect to H2_saltcavern or H2_grid in DE
304
                    GasOnePortConnections(
305
                        table="grid.egon_etrago_store",
306
                        rule_id="SANITY_GAS_ONE_PORT_STORE_H2_OVERGROUND_EGON2035",
307
                        scenario="eGon2035",
308
                        component_type="store",
309
                        component_carrier="H2_overground",
310
                        bus_conditions=[("H2_saltcavern", "= 'DE'"), ("H2_grid", "= 'DE'")]
311
                    ),
312
                ],
313
314
                # Gas link connection validations
315
                # These check that gas links have both bus0 and bus1 connected to existing buses
316
                "gas_links": [
317
                    # CH4 links - eGon2035
318
                    GasLinksConnections(
319
                        table="grid.egon_etrago_link",
320
                        rule_id="SANITY_GAS_LINKS_CH4_EGON2035",
321
                        scenario="eGon2035",
322
                        carrier="CH4"
323
                    ),
324
                    # H2_feedin links - eGon2035
325
                    GasLinksConnections(
326
                        table="grid.egon_etrago_link",
327
                        rule_id="SANITY_GAS_LINKS_H2_FEEDIN_EGON2035",
328
                        scenario="eGon2035",
329
                        carrier="H2_feedin"
330
                    ),
331
                    # H2_to_CH4 links - eGon2035
332
                    GasLinksConnections(
333
                        table="grid.egon_etrago_link",
334
                        rule_id="SANITY_GAS_LINKS_H2_TO_CH4_EGON2035",
335
                        scenario="eGon2035",
336
                        carrier="H2_to_CH4"
337
                    ),
338
                    # CH4_to_H2 links - eGon2035
339
                    GasLinksConnections(
340
                        table="grid.egon_etrago_link",
341
                        rule_id="SANITY_GAS_LINKS_CH4_TO_H2_EGON2035",
342
                        scenario="eGon2035",
343
                        carrier="CH4_to_H2"
344
                    ),
345
                    # H2_to_power links - eGon2035
346
                    GasLinksConnections(
347
                        table="grid.egon_etrago_link",
348
                        rule_id="SANITY_GAS_LINKS_H2_TO_POWER_EGON2035",
349
                        scenario="eGon2035",
350
                        carrier="H2_to_power"
351
                    ),
352
                    # power_to_H2 links - eGon2035
353
                    GasLinksConnections(
354
                        table="grid.egon_etrago_link",
355
                        rule_id="SANITY_GAS_LINKS_POWER_TO_H2_EGON2035",
356
                        scenario="eGon2035",
357
                        carrier="power_to_H2"
358
                    ),
359
                    # OCGT links - eGon2035
360
                    GasLinksConnections(
361
                        table="grid.egon_etrago_link",
362
                        rule_id="SANITY_GAS_LINKS_OCGT_EGON2035",
363
                        scenario="eGon2035",
364
                        carrier="OCGT"
365
                    ),
366
                    # central_gas_boiler links - eGon2035
367
                    GasLinksConnections(
368
                        table="grid.egon_etrago_link",
369
                        rule_id="SANITY_GAS_LINKS_CENTRAL_GAS_BOILER_EGON2035",
370
                        scenario="eGon2035",
371
                        carrier="central_gas_boiler"
372
                    ),
373
                    # central_gas_CHP links - eGon2035
374
                    GasLinksConnections(
375
                        table="grid.egon_etrago_link",
376
                        rule_id="SANITY_GAS_LINKS_CENTRAL_GAS_CHP_EGON2035",
377
                        scenario="eGon2035",
378
                        carrier="central_gas_CHP"
379
                    ),
380
                    # central_gas_CHP_heat links - eGon2035
381
                    GasLinksConnections(
382
                        table="grid.egon_etrago_link",
383
                        rule_id="SANITY_GAS_LINKS_CENTRAL_GAS_CHP_HEAT_EGON2035",
384
                        scenario="eGon2035",
385
                        carrier="central_gas_CHP_heat"
386
                    ),
387
                    # industrial_gas_CHP links - eGon2035
388
                    GasLinksConnections(
389
                        table="grid.egon_etrago_link",
390
                        rule_id="SANITY_GAS_LINKS_INDUSTRIAL_GAS_CHP_EGON2035",
391
                        scenario="eGon2035",
392
                        carrier="industrial_gas_CHP"
393
                    ),
394
                ],
395
396
                # Gas loads and generators capacity validations
397
                # These check that gas demand and generation capacity match reference data
398
                "gas_loads_generators": [
399
                    # CH4_for_industry loads - eGon2035
400
                    GasLoadsCapacity(
401
                        table="grid.egon_etrago_load",
402
                        rule_id="SANITY_GAS_LOADS_CH4_FOR_INDUSTRY_EGON2035",
403
                        scenario="eGon2035",
404
                        carrier="CH4_for_industry",
405
                        rtol=0.10
406
                    ),
407
                    # H2_for_industry loads - eGon2035
408
                    GasLoadsCapacity(
409
                        table="grid.egon_etrago_load",
410
                        rule_id="SANITY_GAS_LOADS_H2_FOR_INDUSTRY_EGON2035",
411
                        scenario="eGon2035",
412
                        carrier="H2_for_industry",
413
                        rtol=0.10
414
                    ),
415
                    # CH4 generators - eGon2035
416
                    GasGeneratorsCapacity(
417
                        table="grid.egon_etrago_generator",
418
                        rule_id="SANITY_GAS_GENERATORS_CH4_EGON2035",
419
                        scenario="eGon2035",
420
                        carrier="CH4",
421
                        rtol=0.10
422
                    ),
423
                ],
424
425
                # Electricity capacity validations
426
                # These check that distributed generator and storage capacities match input capacities
427
                "electricity_capacity": [
428
                    # GENERATORS - eGon2035
429
                    # Wind onshore
430
                    ElectricityCapacityComparison(
431
                        table="grid.egon_etrago_generator",
432
                        rule_id="SANITY_ELECTRICITY_GENERATOR_WIND_ONSHORE_EGON2035",
433
                        scenario="eGon2035",
434
                        carrier="wind_onshore",
435
                        component_type="generator",
436
                        rtol=0.10
437
                    ),
438
                    # Wind offshore
439
                    ElectricityCapacityComparison(
440
                        table="grid.egon_etrago_generator",
441
                        rule_id="SANITY_ELECTRICITY_GENERATOR_WIND_OFFSHORE_EGON2035",
442
                        scenario="eGon2035",
443
                        carrier="wind_offshore",
444
                        component_type="generator",
445
                        rtol=0.10
446
                    ),
447
                    # Solar
448
                    ElectricityCapacityComparison(
449
                        table="grid.egon_etrago_generator",
450
                        rule_id="SANITY_ELECTRICITY_GENERATOR_SOLAR_EGON2035",
451
                        scenario="eGon2035",
452
                        carrier="solar",
453
                        component_type="generator",
454
                        rtol=0.10
455
                    ),
456
                    # Solar rooftop
457
                    ElectricityCapacityComparison(
458
                        table="grid.egon_etrago_generator",
459
                        rule_id="SANITY_ELECTRICITY_GENERATOR_SOLAR_ROOFTOP_EGON2035",
460
                        scenario="eGon2035",
461
                        carrier="solar_rooftop",
462
                        component_type="generator",
463
                        rtol=0.10
464
                    ),
465
                    # Biomass (maps to multiple output carriers: biomass, industrial_biomass_CHP, central_biomass_CHP)
466
                    ElectricityCapacityComparison(
467
                        table="grid.egon_etrago_generator",
468
                        rule_id="SANITY_ELECTRICITY_GENERATOR_BIOMASS_EGON2035",
469
                        scenario="eGon2035",
470
                        carrier="biomass",
471
                        component_type="generator",
472
                        output_carriers=["biomass", "industrial_biomass_CHP", "central_biomass_CHP"],
473
                        rtol=0.10
474
                    ),
475
                    # Run of river
476
                    ElectricityCapacityComparison(
477
                        table="grid.egon_etrago_generator",
478
                        rule_id="SANITY_ELECTRICITY_GENERATOR_RUN_OF_RIVER_EGON2035",
479
                        scenario="eGon2035",
480
                        carrier="run_of_river",
481
                        component_type="generator",
482
                        rtol=0.10
483
                    ),
484
                    # Reservoir
485
                    ElectricityCapacityComparison(
486
                        table="grid.egon_etrago_generator",
487
                        rule_id="SANITY_ELECTRICITY_GENERATOR_RESERVOIR_EGON2035",
488
                        scenario="eGon2035",
489
                        carrier="reservoir",
490
                        component_type="generator",
491
                        rtol=0.10
492
                    ),
493
                    # Oil
494
                    ElectricityCapacityComparison(
495
                        table="grid.egon_etrago_generator",
496
                        rule_id="SANITY_ELECTRICITY_GENERATOR_OIL_EGON2035",
497
                        scenario="eGon2035",
498
                        carrier="oil",
499
                        component_type="generator",
500
                        rtol=0.10
501
                    ),
502
                    # Others
503
                    ElectricityCapacityComparison(
504
                        table="grid.egon_etrago_generator",
505
                        rule_id="SANITY_ELECTRICITY_GENERATOR_OTHERS_EGON2035",
506
                        scenario="eGon2035",
507
                        carrier="others",
508
                        component_type="generator",
509
                        rtol=0.10
510
                    ),
511
512
                    # STORAGE - eGon2035
513
                    # Pumped hydro
514
                    ElectricityCapacityComparison(
515
                        table="grid.egon_etrago_storage",
516
                        rule_id="SANITY_ELECTRICITY_STORAGE_PUMPED_HYDRO_EGON2035",
517
                        scenario="eGon2035",
518
                        carrier="pumped_hydro",
519
                        component_type="storage",
520
                        rtol=0.10
521
                    ),
522
523
                    # GENERATORS - eGon100RE
524
                    # Wind onshore
525
                    ElectricityCapacityComparison(
526
                        table="grid.egon_etrago_generator",
527
                        rule_id="SANITY_ELECTRICITY_GENERATOR_WIND_ONSHORE_EGON100RE",
528
                        scenario="eGon100RE",
529
                        carrier="wind_onshore",
530
                        component_type="generator",
531
                        rtol=0.10
532
                    ),
533
                    # Wind offshore
534
                    ElectricityCapacityComparison(
535
                        table="grid.egon_etrago_generator",
536
                        rule_id="SANITY_ELECTRICITY_GENERATOR_WIND_OFFSHORE_EGON100RE",
537
                        scenario="eGon100RE",
538
                        carrier="wind_offshore",
539
                        component_type="generator",
540
                        rtol=0.10
541
                    ),
542
                    # Solar
543
                    ElectricityCapacityComparison(
544
                        table="grid.egon_etrago_generator",
545
                        rule_id="SANITY_ELECTRICITY_GENERATOR_SOLAR_EGON100RE",
546
                        scenario="eGon100RE",
547
                        carrier="solar",
548
                        component_type="generator",
549
                        rtol=0.10
550
                    ),
551
                    # Solar rooftop
552
                    ElectricityCapacityComparison(
553
                        table="grid.egon_etrago_generator",
554
                        rule_id="SANITY_ELECTRICITY_GENERATOR_SOLAR_ROOFTOP_EGON100RE",
555
                        scenario="eGon100RE",
556
                        carrier="solar_rooftop",
557
                        component_type="generator",
558
                        rtol=0.10
559
                    ),
560
                    # Run of river
561
                    ElectricityCapacityComparison(
562
                        table="grid.egon_etrago_generator",
563
                        rule_id="SANITY_ELECTRICITY_GENERATOR_RUN_OF_RIVER_EGON100RE",
564
                        scenario="eGon100RE",
565
                        carrier="run_of_river",
566
                        component_type="generator",
567
                        rtol=0.10
568
                    ),
569
                    # Oil
570
                    ElectricityCapacityComparison(
571
                        table="grid.egon_etrago_generator",
572
                        rule_id="SANITY_ELECTRICITY_GENERATOR_OIL_EGON100RE",
573
                        scenario="eGon100RE",
574
                        carrier="oil",
575
                        component_type="generator",
576
                        rtol=0.10
577
                    ),
578
                    # Lignite
579
                    ElectricityCapacityComparison(
580
                        table="grid.egon_etrago_generator",
581
                        rule_id="SANITY_ELECTRICITY_GENERATOR_LIGNITE_EGON100RE",
582
                        scenario="eGon100RE",
583
                        carrier="lignite",
584
                        component_type="generator",
585
                        rtol=0.10
586
                    ),
587
                    # Coal
588
                    ElectricityCapacityComparison(
589
                        table="grid.egon_etrago_generator",
590
                        rule_id="SANITY_ELECTRICITY_GENERATOR_COAL_EGON100RE",
591
                        scenario="eGon100RE",
592
                        carrier="coal",
593
                        component_type="generator",
594
                        rtol=0.10
595
                    ),
596
                    # Solar thermal collector
597
                    ElectricityCapacityComparison(
598
                        table="grid.egon_etrago_generator",
599
                        rule_id="SANITY_ELECTRICITY_GENERATOR_SOLAR_THERMAL_EGON100RE",
600
                        scenario="eGon100RE",
601
                        carrier="urban_central_solar_thermal_collector",
602
                        component_type="generator",
603
                        output_carriers=["solar_thermal_collector"],
604
                        rtol=0.10
605
                    ),
606
                    # Geothermal
607
                    ElectricityCapacityComparison(
608
                        table="grid.egon_etrago_generator",
609
                        rule_id="SANITY_ELECTRICITY_GENERATOR_GEO_THERMAL_EGON100RE",
610
                        scenario="eGon100RE",
611
                        carrier="urban_central_geo_thermal",
612
                        component_type="generator",
613
                        output_carriers=["geo_thermal"],
614
                        rtol=0.10
615
                    ),
616
                    # Rural solar thermal
617
                    ElectricityCapacityComparison(
618
                        table="grid.egon_etrago_generator",
619
                        rule_id="SANITY_ELECTRICITY_GENERATOR_RURAL_SOLAR_THERMAL_EGON100RE",
620
                        scenario="eGon100RE",
621
                        carrier="rural_solar_thermal",
622
                        component_type="generator",
623
                        rtol=0.10
624
                    ),
625
                    # Urban central gas CHP
626
                    ElectricityCapacityComparison(
627
                        table="grid.egon_etrago_generator",
628
                        rule_id="SANITY_ELECTRICITY_GENERATOR_URBAN_GAS_CHP_EGON100RE",
629
                        scenario="eGon100RE",
630
                        carrier="urban_central_gas_CHP",
631
                        component_type="generator",
632
                        rtol=0.10
633
                    ),
634
                    # Urban central solid biomass CHP
635
                    ElectricityCapacityComparison(
636
                        table="grid.egon_etrago_generator",
637
                        rule_id="SANITY_ELECTRICITY_GENERATOR_BIOMASS_CHP_EGON100RE",
638
                        scenario="eGon100RE",
639
                        carrier="urban_central_solid_biomass_CHP",
640
                        component_type="generator",
641
                        rtol=0.10
642
                    ),
643
644
                    # LINKS - eGon100RE
645
                    # Central gas boiler
646
                    ElectricityCapacityComparison(
647
                        table="grid.egon_etrago_link",
648
                        rule_id="SANITY_ELECTRICITY_LINK_CENTRAL_GAS_BOILER_EGON100RE",
649
                        scenario="eGon100RE",
650
                        carrier="urban_central_gas_boiler",
651
                        component_type="link",
652
                        output_carriers=["central_gas_boiler"],
653
                        rtol=0.10
654
                    ),
655
                    # Central heat pump
656
                    ElectricityCapacityComparison(
657
                        table="grid.egon_etrago_link",
658
                        rule_id="SANITY_ELECTRICITY_LINK_CENTRAL_HEAT_PUMP_EGON100RE",
659
                        scenario="eGon100RE",
660
                        carrier="urban_central_heat_pump",
661
                        component_type="link",
662
                        output_carriers=["central_heat_pump"],
663
                        rtol=0.10
664
                    ),
665
                    # Central resistive heater
666
                    ElectricityCapacityComparison(
667
                        table="grid.egon_etrago_link",
668
                        rule_id="SANITY_ELECTRICITY_LINK_CENTRAL_RESISTIVE_HEATER_EGON100RE",
669
                        scenario="eGon100RE",
670
                        carrier="urban_central_resistive_heater",
671
                        component_type="link",
672
                        output_carriers=["central_resistive_heater"],
673
                        rtol=0.10
674
                    ),
675
                    # OCGT (gas)
676
                    ElectricityCapacityComparison(
677
                        table="grid.egon_etrago_link",
678
                        rule_id="SANITY_ELECTRICITY_LINK_OCGT_EGON100RE",
679
                        scenario="eGon100RE",
680
                        carrier="gas",
681
                        component_type="link",
682
                        output_carriers=["OCGT"],
683
                        rtol=0.10
684
                    ),
685
                    # Rural biomass boiler
686
                    ElectricityCapacityComparison(
687
                        table="grid.egon_etrago_link",
688
                        rule_id="SANITY_ELECTRICITY_LINK_RURAL_BIOMASS_BOILER_EGON100RE",
689
                        scenario="eGon100RE",
690
                        carrier="rural_biomass_boiler",
691
                        component_type="link",
692
                        rtol=0.10
693
                    ),
694
                    # Rural gas boiler
695
                    ElectricityCapacityComparison(
696
                        table="grid.egon_etrago_link",
697
                        rule_id="SANITY_ELECTRICITY_LINK_RURAL_GAS_BOILER_EGON100RE",
698
                        scenario="eGon100RE",
699
                        carrier="rural_gas_boiler",
700
                        component_type="link",
701
                        rtol=0.10
702
                    ),
703
                    # Rural heat pump
704
                    ElectricityCapacityComparison(
705
                        table="grid.egon_etrago_link",
706
                        rule_id="SANITY_ELECTRICITY_LINK_RURAL_HEAT_PUMP_EGON100RE",
707
                        scenario="eGon100RE",
708
                        carrier="rural_heat_pump",
709
                        component_type="link",
710
                        rtol=0.10
711
                    ),
712
                    # Rural oil boiler
713
                    ElectricityCapacityComparison(
714
                        table="grid.egon_etrago_link",
715
                        rule_id="SANITY_ELECTRICITY_LINK_RURAL_OIL_BOILER_EGON100RE",
716
                        scenario="eGon100RE",
717
                        carrier="rural_oil_boiler",
718
                        component_type="link",
719
                        rtol=0.10
720
                    ),
721
                    # Rural resistive heater
722
                    ElectricityCapacityComparison(
723
                        table="grid.egon_etrago_link",
724
                        rule_id="SANITY_ELECTRICITY_LINK_RURAL_RESISTIVE_HEATER_EGON100RE",
725
                        scenario="eGon100RE",
726
                        carrier="rural_resistive_heater",
727
                        component_type="link",
728
                        rtol=0.10
729
                    ),
730
731
                    # STORAGE - eGon100RE
732
                    # Pumped hydro
733
                    ElectricityCapacityComparison(
734
                        table="grid.egon_etrago_storage",
735
                        rule_id="SANITY_ELECTRICITY_STORAGE_PUMPED_HYDRO_EGON100RE",
736
                        scenario="eGon100RE",
737
                        carrier="pumped_hydro",
738
                        component_type="storage",
739
                        rtol=0.10
740
                    ),
741
                ],
742
743
                # Heat capacity validations
744
                # These check that distributed heat supply capacities match input capacities
745
                "heat_capacity": [
746
                    # LINKS - eGon2035
747
                    # Central heat pump
748
                    ElectricityCapacityComparison(
749
                        table="grid.egon_etrago_link",
750
                        rule_id="SANITY_HEAT_LINK_CENTRAL_HEAT_PUMP_EGON2035",
751
                        scenario="eGon2035",
752
                        carrier="urban_central_heat_pump",
753
                        component_type="link",
754
                        output_carriers=["central_heat_pump"],
755
                        rtol=0.10
756
                    ),
757
                    # Rural heat pump
758
                    ElectricityCapacityComparison(
759
                        table="grid.egon_etrago_link",
760
                        rule_id="SANITY_HEAT_LINK_RURAL_HEAT_PUMP_EGON2035",
761
                        scenario="eGon2035",
762
                        carrier="residential_rural_heat_pump",
763
                        component_type="link",
764
                        output_carriers=["rural_heat_pump"],
765
                        rtol=0.10
766
                    ),
767
                    # Central resistive heater
768
                    ElectricityCapacityComparison(
769
                        table="grid.egon_etrago_link",
770
                        rule_id="SANITY_HEAT_LINK_CENTRAL_RESISTIVE_HEATER_EGON2035",
771
                        scenario="eGon2035",
772
                        carrier="urban_central_resistive_heater",
773
                        component_type="link",
774
                        output_carriers=["central_resistive_heater"],
775
                        rtol=0.10
776
                    ),
777
778
                    # GENERATORS - eGon2035
779
                    # Solar thermal collector
780
                    ElectricityCapacityComparison(
781
                        table="grid.egon_etrago_generator",
782
                        rule_id="SANITY_HEAT_GENERATOR_SOLAR_THERMAL_EGON2035",
783
                        scenario="eGon2035",
784
                        carrier="urban_central_solar_thermal_collector",
785
                        component_type="generator",
786
                        output_carriers=["solar_thermal_collector"],
787
                        rtol=0.10
788
                    ),
789
                    # Geothermal
790
                    ElectricityCapacityComparison(
791
                        table="grid.egon_etrago_generator",
792
                        rule_id="SANITY_HEAT_GENERATOR_GEO_THERMAL_EGON2035",
793
                        scenario="eGon2035",
794
                        carrier="urban_central_geo_thermal",
795
                        component_type="generator",
796
                        output_carriers=["geo_thermal"],
797
                        rtol=0.10
798
                    ),
799
                ],
800
801
                # Timeseries length validations
802
                # These check that all timeseries arrays have the expected length (8760 hours)
803
                # NOTE: All array columns are validated to match original sanity_checks.py
804
                # which dynamically discovers all array columns (lines 2465-2494)
805
                "timeseries_length": [
806
                    # Generator timeseries - all array columns
807
                    ArrayCardinalityValidation(
808
                        rule_id="SANITY_TIMESERIES_GENERATOR_P_SET",
809
                        task="FinalValidations.timeseries_length",
810
                        table="grid.egon_etrago_generator_timeseries",
811
                        array_column="p_set",
812
                        expected_length=8760
813
                    ),
814
                    ArrayCardinalityValidation(
815
                        rule_id="SANITY_TIMESERIES_GENERATOR_Q_SET",
816
                        task="FinalValidations.timeseries_length",
817
                        table="grid.egon_etrago_generator_timeseries",
818
                        array_column="q_set",
819
                        expected_length=8760
820
                    ),
821
                    ArrayCardinalityValidation(
822
                        rule_id="SANITY_TIMESERIES_GENERATOR_P_MIN_PU",
823
                        task="FinalValidations.timeseries_length",
824
                        table="grid.egon_etrago_generator_timeseries",
825
                        array_column="p_min_pu",
826
                        expected_length=8760
827
                    ),
828
                    ArrayCardinalityValidation(
829
                        rule_id="SANITY_TIMESERIES_GENERATOR_P_MAX_PU",
830
                        task="FinalValidations.timeseries_length",
831
                        table="grid.egon_etrago_generator_timeseries",
832
                        array_column="p_max_pu",
833
                        expected_length=8760
834
                    ),
835
                    ArrayCardinalityValidation(
836
                        rule_id="SANITY_TIMESERIES_GENERATOR_MARGINAL_COST",
837
                        task="FinalValidations.timeseries_length",
838
                        table="grid.egon_etrago_generator_timeseries",
839
                        array_column="marginal_cost",
840
                        expected_length=8760
841
                    ),
842
843
                    # Load timeseries - all array columns
844
                    ArrayCardinalityValidation(
845
                        rule_id="SANITY_TIMESERIES_LOAD_P_SET",
846
                        task="FinalValidations.timeseries_length",
847
                        table="grid.egon_etrago_load_timeseries",
848
                        array_column="p_set",
849
                        expected_length=8760
850
                    ),
851
                    ArrayCardinalityValidation(
852
                        rule_id="SANITY_TIMESERIES_LOAD_Q_SET",
853
                        task="FinalValidations.timeseries_length",
854
                        table="grid.egon_etrago_load_timeseries",
855
                        array_column="q_set",
856
                        expected_length=8760
857
                    ),
858
859
                    # Link timeseries - all array columns
860
                    ArrayCardinalityValidation(
861
                        rule_id="SANITY_TIMESERIES_LINK_P_SET",
862
                        task="FinalValidations.timeseries_length",
863
                        table="grid.egon_etrago_link_timeseries",
864
                        array_column="p_set",
865
                        expected_length=8760
866
                    ),
867
                    ArrayCardinalityValidation(
868
                        rule_id="SANITY_TIMESERIES_LINK_P_MIN_PU",
869
                        task="FinalValidations.timeseries_length",
870
                        table="grid.egon_etrago_link_timeseries",
871
                        array_column="p_min_pu",
872
                        expected_length=8760
873
                    ),
874
                    ArrayCardinalityValidation(
875
                        rule_id="SANITY_TIMESERIES_LINK_P_MAX_PU",
876
                        task="FinalValidations.timeseries_length",
877
                        table="grid.egon_etrago_link_timeseries",
878
                        array_column="p_max_pu",
879
                        expected_length=8760
880
                    ),
881
                    ArrayCardinalityValidation(
882
                        rule_id="SANITY_TIMESERIES_LINK_EFFICIENCY",
883
                        task="FinalValidations.timeseries_length",
884
                        table="grid.egon_etrago_link_timeseries",
885
                        array_column="efficiency",
886
                        expected_length=8760
887
                    ),
888
                    ArrayCardinalityValidation(
889
                        rule_id="SANITY_TIMESERIES_LINK_MARGINAL_COST",
890
                        task="FinalValidations.timeseries_length",
891
                        table="grid.egon_etrago_link_timeseries",
892
                        array_column="marginal_cost",
893
                        expected_length=8760
894
                    ),
895
896
                    # Storage timeseries - all array columns
897
                    ArrayCardinalityValidation(
898
                        rule_id="SANITY_TIMESERIES_STORAGE_P_SET",
899
                        task="FinalValidations.timeseries_length",
900
                        table="grid.egon_etrago_storage_timeseries",
901
                        array_column="p_set",
902
                        expected_length=8760
903
                    ),
904
                    ArrayCardinalityValidation(
905
                        rule_id="SANITY_TIMESERIES_STORAGE_Q_SET",
906
                        task="FinalValidations.timeseries_length",
907
                        table="grid.egon_etrago_storage_timeseries",
908
                        array_column="q_set",
909
                        expected_length=8760
910
                    ),
911
                    ArrayCardinalityValidation(
912
                        rule_id="SANITY_TIMESERIES_STORAGE_P_MIN_PU",
913
                        task="FinalValidations.timeseries_length",
914
                        table="grid.egon_etrago_storage_timeseries",
915
                        array_column="p_min_pu",
916
                        expected_length=8760
917
                    ),
918
                    ArrayCardinalityValidation(
919
                        rule_id="SANITY_TIMESERIES_STORAGE_P_MAX_PU",
920
                        task="FinalValidations.timeseries_length",
921
                        table="grid.egon_etrago_storage_timeseries",
922
                        array_column="p_max_pu",
923
                        expected_length=8760
924
                    ),
925
                    ArrayCardinalityValidation(
926
                        rule_id="SANITY_TIMESERIES_STORAGE_STATE_OF_CHARGE_SET",
927
                        task="FinalValidations.timeseries_length",
928
                        table="grid.egon_etrago_storage_timeseries",
929
                        array_column="state_of_charge_set",
930
                        expected_length=8760
931
                    ),
932
                    ArrayCardinalityValidation(
933
                        rule_id="SANITY_TIMESERIES_STORAGE_INFLOW",
934
                        task="FinalValidations.timeseries_length",
935
                        table="grid.egon_etrago_storage_timeseries",
936
                        array_column="inflow",
937
                        expected_length=8760
938
                    ),
939
                    ArrayCardinalityValidation(
940
                        rule_id="SANITY_TIMESERIES_STORAGE_MARGINAL_COST",
941
                        task="FinalValidations.timeseries_length",
942
                        table="grid.egon_etrago_storage_timeseries",
943
                        array_column="marginal_cost",
944
                        expected_length=8760
945
                    ),
946
947
                    # Store timeseries - all array columns
948
                    ArrayCardinalityValidation(
949
                        rule_id="SANITY_TIMESERIES_STORE_P_SET",
950
                        task="FinalValidations.timeseries_length",
951
                        table="grid.egon_etrago_store_timeseries",
952
                        array_column="p_set",
953
                        expected_length=8760
954
                    ),
955
                    ArrayCardinalityValidation(
956
                        rule_id="SANITY_TIMESERIES_STORE_Q_SET",
957
                        task="FinalValidations.timeseries_length",
958
                        table="grid.egon_etrago_store_timeseries",
959
                        array_column="q_set",
960
                        expected_length=8760
961
                    ),
962
                    ArrayCardinalityValidation(
963
                        rule_id="SANITY_TIMESERIES_STORE_E_MIN_PU",
964
                        task="FinalValidations.timeseries_length",
965
                        table="grid.egon_etrago_store_timeseries",
966
                        array_column="e_min_pu",
967
                        expected_length=8760
968
                    ),
969
                    ArrayCardinalityValidation(
970
                        rule_id="SANITY_TIMESERIES_STORE_E_MAX_PU",
971
                        task="FinalValidations.timeseries_length",
972
                        table="grid.egon_etrago_store_timeseries",
973
                        array_column="e_max_pu",
974
                        expected_length=8760
975
                    ),
976
                    ArrayCardinalityValidation(
977
                        rule_id="SANITY_TIMESERIES_STORE_MARGINAL_COST",
978
                        task="FinalValidations.timeseries_length",
979
                        table="grid.egon_etrago_store_timeseries",
980
                        array_column="marginal_cost",
981
                        expected_length=8760
982
                    ),
983
                ],
984
985
                # Electrical load demand validations
986
                # Validates annual electrical load sums against expected values
987
                "electrical_load": [
988
                    # Total AC load aggregation for all scenarios (eGon2035, eGon100RE, etc.)
989
                    ElectricalLoadAggregationValidation(
990
                        rule_id="SANITY_ELECTRICAL_LOAD_AGGREGATION",
991
                        task="FinalValidations.electrical_load",
992
                        table="grid.egon_etrago_load",
993
                        tolerance=0.05  # 5% tolerance
994
                    ),
995
                    # Sector breakdown validation for eGon100RE
996
                    # Validates residential (90.4 TWh), commercial (146.7 TWh),
997
                    # industrial (382.9 TWh), and total (620.0 TWh) loads
998
                    ElectricalLoadSectorBreakdown(
999
                        rule_id="SANITY_ELECTRICAL_LOAD_SECTOR_BREAKDOWN_EGON100RE",
1000
                        task="FinalValidations.electrical_load",
1001
                        table="grid.egon_etrago_load",
1002
                        scenario="eGon100RE",
1003
                        rtol=0.01  # 1% tolerance as in original
1004
                    ),
1005
                ],
1006
1007
                # Heat demand validations
1008
                # Validates annual heat demand against peta_heat reference values
1009
                "heat_demand": [
1010
                    # Heat demand - eGon2035
1011
                    HeatDemandValidation(
1012
                        table="grid.egon_etrago_load",
1013
                        rule_id="SANITY_HEAT_DEMAND_EGON2035",
1014
                        scenario="eGon2035",
1015
                        rtol=0.02  # 2% tolerance
1016
                    ),
1017
                ],
1018
                "data-quality": [
1019
                    #grid validation
1020
                    RowCountValidation(
1021
                        table="grid.egon_etrago_bus",
1022
                        rule_id="TEST_ROW_COUNT.egon_etrago_bus",
1023
                        expected_count={"Schleswig-Holstein": 2729, "Everything": 85710}
1024
                    ),
1025
                    DataTypeValidation(
1026
                        table="grid.egon_etrago_bus",
1027
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_bus",
1028
                        column_types={
1029
                            "scen_name": "character varying", "bus_id": "bigint", "v_nom": "double precision",
1030
                            "type": "text", "carrier": "text", "v_mag_pu_set": "double precision",
1031
                            "v_mag_pu_min": "double precision", "v_mag_pu_max": "double precision",
1032
                            "x": "double precision", "y": "double precision", "geometry": "geometry", "country": "text"
1033
                        },
1034
                    ),
1035
                    NotNullAndNotNaNValidation(
1036
                        table="grid.egon_etrago_bus",
1037
                        rule_id="TEST_NOT_NAN.egon_etrago_bus",
1038
                        columns=[
1039
                            "scn_name", "bus_id", "v_nom", "carrier", "v_mag_pu_min", "v_mag_pu_max", "x", "y", "geom"
1040
                        ]
1041
                    ),
1042
                    WholeTableNotNullAndNotNaNValidation(
1043
                        table="grid.egon_etrago_bus",
1044
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_bus"
1045
                    ),
1046
                    ValueSetValidation(
1047
                        table="grid.egon_etrago_bus",
1048
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_bus",
1049
                        column="scn_name",
1050
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1051
                    ),
1052
                    ValueSetValidation(
1053
                        table="grid.egon_etrago_bus",
1054
                        rule_id="TEST_VALUE_SET_CARRIER.egon_etrago_bus",
1055
                        column="carrier",
1056
                        expected_values=[
1057
                            "rural_heat", "urban_central_water_tanks", "low_voltage", "CH4", "H2_saltcavern",
1058
                            "services_rural_heat", "services_rural_water_tanks", "central_heat_store", "AC", "Li_ion",
1059
                            "H2_grid", "dsm", "urban_central_heat", "residential_rural_heat", "central_heat",
1060
                            "rural_heat_store", "residential_rural_water_tanks"
1061
                        ]
1062
                    ),
1063
                    SRIDUniqueNonZero(
1064
                        table="grid.egon_etrago_bus",
1065
                        rule_id="SRIDUniqueNonZero.egon_etrago_bus",
1066
                        column="geometry"
1067
                    ),
1068
                    RowCountValidation(
1069
                        table="grid.egon_etrago_generator",
1070
                        rule_id="TEST_ROW_COUNT.egon_etrago_generator",
1071
                        expected_count={"Schleswig-Holstein": 2863, "Everything": 40577}
1072
                    ),
1073
                    DataTypeValidation(
1074
                        table="grid.egon_etrago_generator",
1075
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_generator",
1076
                        column_types={
1077
                            "scen_name": "character varying", "generator_id": "bigint", "control": "text",
1078
                            "type": "text", "carrier": "text", "p_nom": "double precision", "p_nom_extendable": "boolean",
1079
                            "p_nom_min": "double precision", "p_nom_max": "double precision", "p_min_pu": "double precision",
1080
                            "p_max_pu": "double precision", "p_set": "double precision", "q_set": "double precision",
1081
                            "sign": "double precision", "marginal_cost": "double precision", "build_year": "bigint",
1082
                            "lifetime": "double precision", "capital_cost": "double precision", "efficiency": "double precision",
1083
                            "commitable": "boolean", "start_up_cost": "double precision", "shut_down_cost": "double precision",
1084
                            "min_up_time": "bigint", "min_down_time": "bigint", "up_time_before": "bigint", "down_time_before": "bigint",
1085
                            "ramp_limit_up": "double precision", "ramp_limit_down": "double precision",
1086
                            "ramp_limit_start_up": "double precision", "ramp_limit_shut_down": "double precision",
1087
                            "e_nom_max": "double precision"
1088
                        },
1089
                    ),
1090
                    NotNullAndNotNaNValidation(
1091
                        table="grid.egon_etrago_generator",
1092
                        rule_id="TEST_NOT_NAN.egon_etrago_generator",
1093
                        columns=[
1094
                            "scn_name", "generator_id", "bus", "control", "type", "carrier", "p_nom", "p_nom_extendable",
1095
                            "p_nom_min", "p_nom_max", "p_min_pu", "p_max_pu", "sign", "marginal_cost", "build_year",
1096
                            "lifetime", "capital_cost", "efficiency", "committable", "start_up_cost", "shut_down_cost",
1097
                            "min_up_time", "min_down_time", "up_time_before", "down_time_before", "ramp_limit_start_up",
1098
                            "ramp_limit_shut_down", "e_nom_max"
1099
                        ]
1100
                    ),
1101
                    WholeTableNotNullAndNotNaNValidation(
1102
                        table="grid.egon_etrago_generator",
1103
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_generator"
1104
                    ),
1105
                    ValueSetValidation(
1106
                        table="grid.egon_etrago_generator",
1107
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_generator",
1108
                        column="scn_name",
1109
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1110
                    ),
1111
                    ValueSetValidation(
1112
                        table="grid.egon_etrago_generator",
1113
                        rule_id="TEST_VALUE_SET_CARRIER.egon_etrago_generator",
1114
                        column="carrier",
1115
                        expected_values=[
1116
                            "CH4", "others", "central_biomass_CHP", "wind_onshore", "lignite", "geo_thermal", "solar",
1117
                            "reservoir", "services_rural_solar_thermal_collector", "residential_rural_solar_thermal_collector",
1118
                            "industrial_biomass_CHP", "biomass", "urban_central_solar_thermal_collector", "run_of_river",
1119
                            "oil", "central_biomass_CHP_heat", "nuclear", "coal", "solar_thermal_collector", "solar_rooftop",
1120
                            "wind_offshore"
1121
                        ]
1122
                    ),
1123
                    RowCountValidation(
1124
                        table="grid.egon_etrago_generator_timeseries",
1125
                        rule_id="TEST_ROW_COUNT.egon_etrago_generator_timeseries",
1126
                        expected_count={"Schleswig-Holstein": 1929, "Everything": 28651}
1127
                    ),
1128
                    DataTypeValidation(
1129
                        table="grid.egon_etrago_generator_timeseries",
1130
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_generator_timeseries",
1131
                        column_types={
1132
                            "scn_name":	"character varying", "generator_id": "integer", "temp_id": "integer",
1133
                            "p_set": "double precision[]", "q_set":	"double precision[]", "p_min_pu": "double precision[]",
1134
                            "p_max_pu":	"double precision[]", "marginal_cost":	"double precision[]"
1135
                        },
1136
                    ),
1137
                    NotNullAndNotNaNValidation(
1138
                        table="grid.egon_etrago_generator_timeseries",
1139
                        rule_id="TEST_NOT_NAN.egon_etrago_generator_timeseries",
1140
                        columns=[
1141
                            "scn_name", "generator_id", "temp_id", "p_max_pu"
1142
                        ]
1143
                    ),
1144
                    WholeTableNotNullAndNotNaNValidation(
1145
                        table="grid.egon_etrago_generator_timeseries",
1146
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_generator_timeseries"
1147
                    ),
1148
                    ValueSetValidation(
1149
                        table="grid.egon_etrago_generator_timeseries",
1150
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_generator_timeseries",
1151
                        column="scn_name",
1152
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1153
                    ),
1154
                    RowCountValidation(
1155
                        table="grid.egon_etrago_line",
1156
                        rule_id="TEST_ROW_COUNT.egon_etrago_line",
1157
                        expected_count={"Schleswig-Holstein": 1197, "Everything": 69901}
1158
                    ),
1159
                    DataTypeValidation(
1160
                        table="grid.egon_etrago_line",
1161
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_line",
1162
                        column_types={
1163
                            "scn_name":	"character varying", "line_id":	"bigint", "bus0": "bigint", "bus1":	"bigint",
1164
                            "type":	"text", "carrier": "text", "x": "numeric", "r": "numeric", "g":	"numeric", "b":	"numeric",
1165
                            "s_nom": "numeric", "s_nom_extendable":	"boolean", "s_nom_min":	"double precision",
1166
                            "s_nom_max": "double precision", "s_max_pu": "double precision", "build_year": "bigint",
1167
                            "lifetime":	"double precision", "capital_cost":	"double precision", "length": "double precision",
1168
                            "cables": "integer", "terrain_factor": "double precision", "num_parallel": "double precision",
1169
                            "v_ang_min": "double precision", "v_ang_max": "double precision", "v_nom": "double precision",
1170
                            "geom":	"geometry", "topo":	"geometry"
1171
                        },
1172
                    ),
1173
                    NotNullAndNotNaNValidation(
1174
                        table="grid.egon_etrago_line",
1175
                        rule_id="TEST_NOT_NAN.egon_etrago_line",
1176
                        columns=[
1177
                            "scn_name", "line_id", "bus0", "bus1", "carrier", "x", "r", "g", "b", "s_nom",
1178
                            "s_nom_extendable", "s_nom_min", "s_nom_max", "s_max_pu", "build_year", "lifetime",
1179
                            "capital_cost", "length", "cables", "terrain_factor", "num_parallel", "v_ang_min",
1180
                            "v_ang_max", "v_nom", "geom", "topo",
1181
                        ]
1182
                    ),
1183
                    WholeTableNotNullAndNotNaNValidation(
1184
                        table="grid.egon_etrago_line",
1185
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_line"
1186
                    ),
1187
                    ValueSetValidation(
1188
                        table="grid.egon_etrago_line",
1189
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_line",
1190
                        column="scn_name",
1191
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1192
                    ),
1193
                    ValueSetValidation(
1194
                        table="grid.egon_etrago_line",
1195
                        rule_id="TEST_VALUE_SET_CARRIER.egon_etrago_line",
1196
                        column="carrier",
1197
                        expected_values=["AC"]
1198
                    ),
1199
                    SRIDUniqueNonZero(
1200
                        table="grid.egon_etrago_line",
1201
                        rule_id="SRIDUniqueNonZero.egon_etrago_line.geom",
1202
                        column="geom"
1203
                    ),
1204
                    SRIDUniqueNonZero(
1205
                        table="grid.egon_etrago_line",
1206
                        rule_id="SRIDUniqueNonZero.egon_etrago_line.topo",
1207
                        column="topo"
1208
                    ),
1209
                    #Row Count does't equal egon_etrago_line, because buses are located outside Germany
1210
                    RowCountValidation(
1211
                        table="grid.egon_etrago_line_timeseries",
1212
                        rule_id="TEST_ROW_COUNT.egon_etrago_line_timeseries",
1213
                        expected_count={"Schleswig-Holstein": 1197, "Everything": 69714}
1214
                    ),
1215
                    DataTypeValidation(
1216
                        table="grid.egon_etrago_line_timeseries",
1217
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_line_timeseries",
1218
                        column_types={
1219
                            "scn_name": "character varying", "line_id": "bigint", "bus0": "bigint", "bus1": "bigint",
1220
                            "type": "text", "carrier": "text", "x": "numeric", "r": "numeric", "g": "numeric",
1221
                            "b": "numeric",
1222
                            "s_nom": "numeric", "s_nom_extendable": "boolean", "s_nom_min": "double precision",
1223
                            "s_nom_max": "double precision", "s_max_pu": "double precision", "build_year": "bigint",
1224
                            "lifetime": "double precision", "capital_cost": "double precision",
1225
                            "length": "double precision",
1226
                            "cables": "integer", "terrain_factor": "double precision",
1227
                            "num_parallel": "double precision",
1228
                            "v_ang_min": "double precision", "v_ang_max": "double precision",
1229
                            "v_nom": "double precision",
1230
                            "geom": "geometry", "topo": "geometry"
1231
                        },
1232
                    ),
1233
                    NotNullAndNotNaNValidation(
1234
                        table="grid.egon_etrago_line_timeseries",
1235
                        rule_id="TEST_NOT_NAN.egon_etrago_line_timeseries",
1236
                        columns=[
1237
                            "scn_name", "line_id", "bus0", "bus1", "carrier", "x", "r", "g", "b", "s_nom",
1238
                            "s_nom_extendable", "s_nom_min", "s_nom_max", "s_max_pu", "build_year", "lifetime",
1239
                            "capital_cost", "length", "cables", "terrain_factor", "num_parallel", "v_ang_min",
1240
                            "v_ang_max", "v_nom", "geom", "topo",
1241
                        ]
1242
                    ),
1243
                    WholeTableNotNullAndNotNaNValidation(
1244
                        table="grid.egon_etrago_line_timeseries",
1245
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_line_timeseries"
1246
                    ),
1247
                    ValueSetValidation(
1248
                        table="grid.egon_etrago_line_timeseries",
1249
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_line_timeseries",
1250
                        column="scn_name",
1251
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1252
                    ),
1253
                    ValueSetValidation(
1254
                        table="grid.egon_etrago_line_timeseries",
1255
                        rule_id="TEST_VALUE_SET_CARRIER.egon_etrago_line_timeseries",
1256
                        column="carrier",
1257
                        expected_values=["AC"]
1258
                    ),
1259
                    SRIDUniqueNonZero(
1260
                        table="grid.egon_etrago_line_timeseries",
1261
                        rule_id="SRIDUniqueNonZero.egon_etrago_line_timeseries.geom",
1262
                        column="geom"
1263
                    ),
1264
                    SRIDUniqueNonZero(
1265
                        table="grid.egon_etrago_line_timeseries",
1266
                        rule_id="SRIDUniqueNonZero.egon_etrago_line_timeseries.topo",
1267
                        column="topo"
1268
                    ),
1269
                    RowCountValidation(
1270
                        table="grid.egon_etrago_link",
1271
                        rule_id="TEST_ROW_COUNT.egon_etrago_link",
1272
                        expected_count={"Schleswig-Holstein": 15496, "Everything": 83980}
1273
                    ),
1274
                    DataTypeValidation(
1275
                        table="grid.egon_etrago_link",
1276
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_link",
1277
                        column_types={
1278
                            "scn_name":	"character varying", "link_id":	"bigint", "bus0": "bigint", "bus1":	"bigint",
1279
                            "type":	"text", "carrier": "text", "efficiency": "double precision", "build_year": "bigint",
1280
                            "lifetime":	"double precision", "p_nom": "numeric", "p_nom_extendable":	"boolean",
1281
                            "p_nom_min": "double precision", "p_nom_max": "double precision", "p_min_pu": "double precision",
1282
                            "p_max_pu":	"double precision", "p_set": "double precision", "capital_cost": "double precision",
1283
                            "marginal_cost": "double precision", "length": "double precision",
1284
                            "terrain_factor": "double precision", "geom": "geometry", "topo": "geometry",
1285
                        },
1286
                    ),
1287
                    NotNullAndNotNaNValidation(
1288
                        table="grid.egon_etrago_link",
1289
                        rule_id="TEST_NOT_NAN.egon_etrago_link",
1290
                        columns=[
1291
                            "scn_name", "link_id", "bus0", "bus1", "carrier", "efficiency", "build_year", "p_nom",
1292
                            "p_nom_extendable", "p_nom_min", "p_nom_max", "p_min_pu", "p_max_pu", "p_set",
1293
                            "capital_cost", "marginal_cost", "length", "terrain_factor", "geom", "topo"
1294
                        ]
1295
                    ),
1296
                    WholeTableNotNullAndNotNaNValidation(
1297
                        table="grid.egon_etrago_link",
1298
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_link"
1299
                    ),
1300
                    ValueSetValidation(
1301
                        table="grid.egon_etrago_link",
1302
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_link",
1303
                        column="scn_name",
1304
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1305
                    ),
1306
                    ValueSetValidation(
1307
                        table="grid.egon_etrago_link",
1308
                        rule_id="TEST_VALUE_SET_CARRIER.egon_etrago_link",
1309
                        column="carrier",
1310
                        expected_values=[
1311
                            "industrial_gas_CHP", "residential_rural_water_tanks_discharger", "BEV_charger", "CH4",
1312
                            "power_to_H2", "urban_central_gas_CHP", "rural_heat_store_discharger", "H2_gridextension",
1313
                            "urban_central_gas_CHP_CC", "dsm", "services_rural_water_tanks_charger", "H2_to_CH4",
1314
                            "rural_heat_store_charger", "DC", "central_gas_boiler", "H2_feedin", "H2_retrofit", "OCGT",
1315
                            "central_gas_CHP_heat", "residential_rural_water_tanks_charger", "central_heat_pump",
1316
                            "services_rural_ground_heat_pump", "rural_heat_pump", "CH4_to_H2", "central_resistive_heater",
1317
                            "urban_central_air_heat_pump", "urban_central_water_tanks_discharger",
1318
                            "urban_central_water_tanks_charger", "services_rural_water_tanks_discharger",
1319
                            "electricity_distribution_grid", "central_heat_store_discharger", "H2_to_power",
1320
                            "central_heat_store_charger", "central_gas_CHP", "residential_rural_ground_heat_pump"]
1321
                    ),
1322
                    SRIDUniqueNonZero(
1323
                        table="grid.egon_etrago_link",
1324
                        rule_id="SRIDUniqueNonZero.egon_etrago_link.geom",
1325
                        column="geom"
1326
                    ),
1327
                    SRIDUniqueNonZero(
1328
                        table="grid.egon_etrago_link",
1329
                        rule_id="SRIDUniqueNonZero.egon_etrago_link.topo",
1330
                        column="topo"
1331
                    ),
1332
                    RowCountValidation(
1333
                        table="grid.egon_etrago_link_timeseries",
1334
                        rule_id="TEST_ROW_COUNT.egon_etrago_link_timeseries",
1335
                        expected_count={"Schleswig-Holstein": 947, "Everything": 25729}
1336
                    ),
1337
                    DataTypeValidation(
1338
                        table="grid.egon_etrago_link_timeseries",
1339
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_link_timeseries",
1340
                        column_types={
1341
                            "scn_name": "character varying",
1342
                            "link_id": "bigint",
1343
                            "temp_id": "integer",
1344
                            "p_set": "double precision[]",
1345
                            "p_min_pu": "double precision[]",
1346
                            "p_max_pu": "double precision[]",
1347
                            "efficiency": "double precision[]",
1348
                            "marginal_cost": "double precision[]"
1349
                        },
1350
                    ),
1351
                    NotNullAndNotNaNValidation(
1352
                        table="grid.egon_etrago_link_timeseries",
1353
                        rule_id="TEST_NOT_NAN.egon_etrago_link_timeseries",
1354
                        columns=[
1355
                            "scn_name", "link_id", "temp_id", "p_set", "p_min_pu", "p_max_pu", "efficiency",
1356
                            "marginal_cost"
1357
                        ]
1358
                    ),
1359
                    WholeTableNotNullAndNotNaNValidation(
1360
                        table="grid.egon_etrago_link_timeseries",
1361
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_link_timeseries"
1362
                    ),
1363
                    ValueSetValidation(
1364
                        table="grid.egon_etrago_link_timeseries",
1365
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_link_timeseries",
1366
                        column="scn_name",
1367
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1368
                    ),
1369
                    RowCountValidation(
1370
                        table="grid.egon_etrago_load",
1371
                        rule_id="TEST_ROW_COUNT.egon_etrago_load",
1372
                        expected_count={"Schleswig-Holstein": 3202, "Everything": 44019}
1373
                    ),
1374
                    DataTypeValidation(
1375
                        table="grid.egon_etrago_load",
1376
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_load",
1377
                        column_types={
1378
                            "scn_name": "character varying",
1379
                            "load_id": "bigint",
1380
                            "bus": "bigint",
1381
                            "type": "text",
1382
                            "carrier": "text",
1383
                            "p_set": "double precision",
1384
                            "q_set": "double precision",
1385
                            "sign": "double precision"
1386
                        },
1387
                    ),
1388
                    NotNullAndNotNaNValidation(
1389
                        table="grid.egon_etrago_load",
1390
                        rule_id="TEST_NOT_NAN.egon_etrago_load",
1391
                        columns=[
1392
                            "scn_name", "load_id", "bus", "type", "carrier", "p_set", "q_set", "sign"
1393
                        ]
1394
                    ),
1395
                    WholeTableNotNullAndNotNaNValidation(
1396
                        table="grid.egon_etrago_load",
1397
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_load"
1398
                    ),
1399
                    ValueSetValidation(
1400
                        table="grid.egon_etrago_load",
1401
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_load",
1402
                        column="scn_name",
1403
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1404
                    ),
1405
                    ValueSetValidation(
1406
                        table="grid.egon_etrago_load",
1407
                        rule_id="TEST_VALUE_SET_CARRIER.egon_etrago_load",
1408
                        column="carrier",
1409
                        expected_values=[
1410
                            "CH4", "H2_for_industry", "services_rural_heat", "H2_system_boundary", "AC",
1411
                            "urban_central_heat", "residential_rural_heat", "low-temperature_heat_for_industry",
1412
                            "CH4_for_industry", "central_heat", "CH4_system_boundary", "land_transport_EV",
1413
                            "H2_hgv_load", "rural_gas_boiler", "rural_heat"
1414
                        ]
1415
                    ),
1416
                    RowCountValidation(
1417
                        table="grid.egon_etrago_load_timeseries",
1418
                        rule_id="TEST_ROW_COUNT.egon_etrago_load_timeseries",
1419
                        expected_count={"Schleswig-Holstein": 3176, "Everything": 44013}
1420
                    ),
1421
                    DataTypeValidation(
1422
                        table="grid.egon_etrago_load_timeseries",
1423
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_load_timeseries",
1424
                        column_types={
1425
                            "scn_name": "character varying",
1426
                            "load_id": "bigint",
1427
                            "temp_id": "integer",
1428
                            "p_set": "double precision[]",
1429
                            "q_set": "double precision[]"
1430
                        },
1431
                    ),
1432
                    NotNullAndNotNaNValidation(
1433
                        table="grid.egon_etrago_load_timeseries",
1434
                        rule_id="TEST_NOT_NAN.egon_etrago_load_timeseries",
1435
                        columns=[
1436
                            "scn_name", "load_id", "temp_id", "p_set", "q_set"
1437
                        ]
1438
                    ),
1439
                    WholeTableNotNullAndNotNaNValidation(
1440
                        table="grid.egon_etrago_load_timeseries",
1441
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_load_timeseries"
1442
                    ),
1443
                    ValueSetValidation(
1444
                        table="grid.egon_etrago_load_timeseries",
1445
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_load_timeseries",
1446
                        column="scn_name",
1447
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1448
                    ),
1449
                    RowCountValidation(
1450
                        table="grid.egon_etrago_storage",
1451
                        rule_id="TEST_ROW_COUNT.egon_etrago_storage",
1452
                        expected_count={"Schleswig-Holstein": 418, "Everything": 13044}
1453
                    ),
1454
                    DataTypeValidation(
1455
                        table="grid.egon_etrago_storage",
1456
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_storage",
1457
                        column_types={
1458
                            "scn_name": "character varying",
1459
                            "storage_id": "bigint",
1460
                            "bus": "bigint",
1461
                            "control": "text",
1462
                            "type": "text",
1463
                            "carrier": "text",
1464
                            "p_nom": "double precision",
1465
                            "p_nom_extendable": "boolean",
1466
                            "p_nom_min": "double precision",
1467
                            "p_nom_max": "double precision",
1468
                            "p_min_pu": "double precision",
1469
                            "p_max_pu": "double precision",
1470
                            "p_set": "double precision",
1471
                            "q_set": "double precision",
1472
                            "sign": "double precision",
1473
                            "marginal_cost": "double precision",
1474
                            "capital_cost": "double precision",
1475
                            "build_year": "bigint",
1476
                            "lifetime": "double precision",
1477
                            "state_of_charge_initial": "double precision",
1478
                            "cyclic_state_of_charge": "boolean",
1479
                            "state_of_charge_set": "double precision",
1480
                            "max_hours": "double precision",
1481
                            "efficiency_store": "double precision",
1482
                            "efficiency_dispatch": "double precision",
1483
                            "standing_loss": "double precision",
1484
                            "inflow": "double precision"
1485
                        },
1486
                    ),
1487
                    NotNullAndNotNaNValidation(
1488
                        table="grid.egon_etrago_storage",
1489
                        rule_id="TEST_NOT_NAN.egon_etrago_storage",
1490
                        columns=[
1491
                            "scn_name", "storage_id", "bus", "control", "type", "carrier", "p_nom",
1492
                            "p_nom_extendable", "p_nom_min", "p_nom_max", "p_min_pu", "p_max_pu", "p_set",
1493
                            "q_set", "sign", "marginal_cost", "capital_cost", "build_year", "lifetime",
1494
                            "state_of_charge_initial", "cyclic_state_of_charge", "state_of_charge_set",
1495
                            "max_hours", "efficiency_store", "efficiency_dispatch", "standing_loss", "inflow"
1496
                        ]
1497
                    ),
1498
                    WholeTableNotNullAndNotNaNValidation(
1499
                        table="grid.egon_etrago_storage",
1500
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_storage"
1501
                    ),
1502
                    ValueSetValidation(
1503
                        table="grid.egon_etrago_storage",
1504
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_storage",
1505
                        column="scn_name",
1506
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1507
                    ),
1508
                    ValueSetValidation(
1509
                        table="grid.egon_etrago_storage",
1510
                        rule_id="TEST_VALUE_SET_CARRIER.egon_etrago_storage",
1511
                        column="carrier",
1512
                        expected_values=["battery", "home_battery", "pumped_hydro", "reservoir"]
1513
                    ),
1514
                    RowCountValidation(
1515
                        table="grid.egon_etrago_storage_timeseries",
1516
                        rule_id="TEST_ROW_COUNT.egon_etrago_storage_timeseries",
1517
                        expected_count={"Schleswig-Holstein": 0, "Everything": 9}
1518
                    ),
1519
                    DataTypeValidation(
1520
                        table="grid.egon_etrago_storage_timeseries",
1521
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_storage_timeseries",
1522
                        column_types={
1523
                            "scn_name": "character varying",
1524
                            "storage_id": "bigint",
1525
                            "temp_id": "integer",
1526
                            "p_set": "double precision[]",
1527
                            "q_set": "double precision[]",
1528
                            "p_min_pu": "double precision[]",
1529
                            "p_max_pu": "double precision[]",
1530
                            "state_of_charge_set": "double precision[]",
1531
                            "inflow": "double precision[]",
1532
                            "marginal_cost": "double precision[]"
1533
                        },
1534
                    ),
1535
                    NotNullAndNotNaNValidation(
1536
                        table="grid.egon_etrago_storage_timeseries",
1537
                        rule_id="TEST_NOT_NAN.egon_etrago_storage_timeseries",
1538
                        columns=[
1539
                            "scn_name", "storage_id", "temp_id", "inflow", "marginal_cost"
1540
                        ]
1541
                    ),
1542
                    WholeTableNotNullAndNotNaNValidation(
1543
                        table="grid.egon_etrago_storage_timeseries",
1544
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_storage_timeseries"
1545
                    ),
1546
                    ValueSetValidation(
1547
                        table="grid.egon_etrago_storage_timeseries",
1548
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_storage_timeseries",
1549
                        column="scn_name",
1550
                        expected_values=["eGon100RE"]
1551
                    ),
1552
                    RowCountValidation(
1553
                        table="grid.egon_etrago_store",
1554
                        rule_id="TEST_ROW_COUNT.egon_etrago_store",
1555
                        expected_count={"Schleswig-Holstein": 2913, "Everything": 26520}
1556
                    ),
1557
                    DataTypeValidation(
1558
                        table="grid.egon_etrago_store",
1559
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_store",
1560
                        column_types={
1561
                            "scn_name": "character varying",
1562
                            "store_id": "bigint",
1563
                            "bus": "bigint",
1564
                            "type": "text",
1565
                            "carrier": "text",
1566
                            "e_nom": "double precision",
1567
                            "e_nom_extendable": "boolean",
1568
                            "e_nom_min": "double precision",
1569
                            "e_nom_max": "double precision",
1570
                            "e_min_pu": "double precision",
1571
                            "e_max_pu": "double precision",
1572
                            "p_set": "double precision",
1573
                            "q_set": "double precision",
1574
                            "e_initial": "double precision",
1575
                            "e_cyclic": "boolean",
1576
                            "sign": "double precision",
1577
                            "marginal_cost": "double precision",
1578
                            "capital_cost": "double precision",
1579
                            "standing_loss": "double precision",
1580
                            "build_year": "bigint",
1581
                            "lifetime": "double precision"
1582
                        },
1583
                    ),
1584
                    NotNullAndNotNaNValidation(
1585
                        table="grid.egon_etrago_store",
1586
                        rule_id="TEST_NOT_NAN.egon_etrago_store",
1587
                        columns=[
1588
                            "scn_name", "store_id", "bus", "type", "carrier", "e_nom", "e_nom_extendable",
1589
                            "e_nom_min", "e_nom_max", "e_min_pu", "e_max_pu", "p_set", "q_set", "e_initial",
1590
                            "e_cyclic", "sign", "marginal_cost", "capital_cost", "standing_loss", "build_year",
1591
                            "lifetime"
1592
                        ]
1593
                    ),
1594
                    WholeTableNotNullAndNotNaNValidation(
1595
                        table="grid.egon_etrago_store",
1596
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_store"
1597
                    ),
1598
                    ValueSetValidation(
1599
                        table="grid.egon_etrago_store",
1600
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_store",
1601
                        column="scn_name",
1602
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1603
                    ),
1604
                    RowCountValidation(
1605
                        table="grid.egon_etrago_store_timeseries",
1606
                        rule_id="TEST_ROW_COUNT.egon_etrago_store_timeseries",
1607
                        expected_count={"Schleswig-Holstein": 392, "Everything": 15281}
1608
                    ),
1609
                    DataTypeValidation(
1610
                        table="grid.egon_etrago_store_timeseries",
1611
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_store_timeseries",
1612
                        column_types={
1613
                            "scn_name": "character varying",
1614
                            "store_id": "bigint",
1615
                            "temp_id": "integer",
1616
                            "p_set": "double precision[]",
1617
                            "q_set": "double precision[]",
1618
                            "e_min_pu": "double precision[]",
1619
                            "e_max_pu": "double precision[]",
1620
                            "marginal_cost": "double precision[]"
1621
                        },
1622
                    ),
1623
                    NotNullAndNotNaNValidation(
1624
                        table="grid.egon_etrago_store_timeseries",
1625
                        rule_id="TEST_NOT_NAN.egon_etrago_store_timeseries",
1626
                        columns=[
1627
                            "scn_name", "store_id", "temp_id", "p_set", "q_set", "e_min_pu", "e_max_pu",
1628
                            "marginal_cost"
1629
                        ]
1630
                    ),
1631
                    WholeTableNotNullAndNotNaNValidation(
1632
                        table="grid.egon_etrago_store_timeseries",
1633
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_store_timeseries"
1634
                    ),
1635
                    ValueSetValidation(
1636
                        table="grid.egon_etrago_store_timeseries",
1637
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_store_timeseries",
1638
                        column="scn_name",
1639
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1640
                    ),
1641
                    RowCountValidation(
1642
                        table="grid.egon_etrago_temp_resolution",
1643
                        rule_id="TEST_ROW_COUNT.egon_etrago_temp_resolution",
1644
                        expected_count=1
1645
                    ),
1646
                    DataTypeValidation(
1647
                        table="grid.egon_etrago_temp_resolution",
1648
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_temp_resolution",
1649
                        column_types={
1650
                            "temp_id": "bigint",
1651
                            "timesteps": "bigint",
1652
                            "resolution": "text",
1653
                            "start_time": "timestamp without time zone"
1654
                        },
1655
                    ),
1656
                    WholeTableNotNullAndNotNaNValidation(
1657
                        table="grid.egon_etrago_temp_resolution",
1658
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_temp_resolution"
1659
                    ),
1660
                    RowCountValidation(
1661
                        table="grid.egon_etrago_transformer",
1662
                        rule_id="TEST_ROW_COUNT.egon_etrago_transformer",
1663
                        expected_count={"Schleswig-Holstein": 31, "Everything": 1545}
1664
                    ),
1665
                    DataTypeValidation(
1666
                        table="grid.egon_etrago_transformer",
1667
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_etrago_transformer",
1668
                        column_types={
1669
                            "scn_name": "character varying",
1670
                            "store_id": "bigint",
1671
                            "bus": "bigint",
1672
                            "type": "text",
1673
                            "carrier": "text",
1674
                            "e_nom": "double precision",
1675
                            "e_nom_extendable": "boolean",
1676
                            "e_nom_min": "double precision",
1677
                            "e_nom_max": "double precision",
1678
                            "e_min_pu": "double precision",
1679
                            "e_max_pu": "double precision",
1680
                            "p_set": "double precision",
1681
                            "q_set": "double precision",
1682
                            "e_initial": "double precision",
1683
                            "e_cyclic": "boolean",
1684
                            "sign": "double precision",
1685
                            "marginal_cost": "double precision",
1686
                            "capital_cost": "double precision",
1687
                            "standing_loss": "double precision",
1688
                            "build_year": "bigint",
1689
                            "lifetime": "double precision"
1690
                        },
1691
                    ),
1692
                    NotNullAndNotNaNValidation(
1693
                        table="grid.egon_etrago_transformer",
1694
                        rule_id="TEST_NOT_NAN.egon_etrago_transformer",
1695
                        columns=[
1696
                            "scn_name", "store_id", "bus", "type", "carrier", "e_nom", "e_nom_extendable",
1697
                            "e_nom_min", "e_nom_max", "e_min_pu", "e_max_pu", "p_set", "q_set", "e_initial",
1698
                            "e_cyclic", "sign", "marginal_cost", "capital_cost", "standing_loss", "build_year",
1699
                            "lifetime"
1700
                        ]
1701
                    ),
1702
                    WholeTableNotNullAndNotNaNValidation(
1703
                        table="grid.egon_etrago_transformer",
1704
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_etrago_transformer"
1705
                    ),
1706
                    ValueSetValidation(
1707
                        table="grid.egon_etrago_transformer",
1708
                        rule_id="TEST_VALUE_SET_SCENARIO.egon_etrago_transformer",
1709
                        column="scn_name",
1710
                        expected_values=["eGon2035", "eGon2035_lowflex", "eGon100RE"]
1711
                    ),
1712
                    RowCountValidation(
1713
                        table="grid.egon_hvmv_substation",
1714
                        rule_id="TEST_ROW_COUNT.hvmv_substation",
1715
                        expected_count={"Schleswig-Holstein": 200, "Everything": 3854}
1716
                    ),
1717
                    DataTypeValidation(
1718
                        table="grid.egon_hvmv_substation",
1719
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_hvmv_substation",
1720
                        column_types={
1721
                            "bus_id": "integer",
1722
                            "lon": "double precision",
1723
                            "lat": "double precision",
1724
                            "point": "geometry",
1725
                            "polygon": "geometry",
1726
                            "voltage": "text",
1727
                            "power_type": "text",
1728
                            "substation": "text",
1729
                            "osm_id": "text",
1730
                            "osm_www": "text",
1731
                            "frequency": "text",
1732
                            "subst_name": "text",
1733
                            "ref": "text",
1734
                            "operator": "text",
1735
                            "dbahn": "text",
1736
                            "status": "integer"
1737
                        },
1738
                    ),
1739
                    NotNullAndNotNaNValidation(
1740
                        table="grid.egon_hvmv_substation",
1741
                        rule_id="TEST_NOT_NAN.egon_hvmv_substation",
1742
                        columns=[
1743
                            "bus_id", "lon", "lat", "point", "polygon", "voltage", "power_type", "substation",
1744
                            "osm_id", "osm_www", "frequency", "subst_name", "ref", "operator", "dbahn", "status"
1745
                        ]
1746
                    ),
1747
                    WholeTableNotNullAndNotNaNValidation(
1748
                        table="grid.egon_hvmv_substation",
1749
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_hvmv_substation"
1750
                    ),
1751
                    SRIDUniqueNonZero(
1752
                        table="grid.egon_hvmv_substation",
1753
                        rule_id="SRIDUniqueNonZero.egon_hvmv_substation.point",
1754
                        column="point"
1755
                    ),
1756
                    SRIDUniqueNonZero(
1757
                        table="grid.egon_hvmv_substation",
1758
                        rule_id="SRIDUniqueNonZero.egon_hvmv_substation.polygon",
1759
                        column="polygon"
1760
                    ),
1761
                    RowCountValidation(
1762
                        table="grid.egon_mv_grid_district",
1763
                        rule_id="TEST_ROW_COUNT.egon_mv_grid_district",
1764
                        expected_count={"Schleswig-Holstein": 200, "Everything": 3854}
1765
                    ),
1766
                    DataTypeValidation(
1767
                        table="grid.egon_mv_grid_district",
1768
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_mv_grid_district",
1769
                        column_types={
1770
                            "bus_id": "integer",
1771
                            "geom": "geometry",
1772
                            "area": "double precision"
1773
                        },
1774
                    ),
1775
                    WholeTableNotNullAndNotNaNValidation(
1776
                        table="grid.egon_mv_grid_district",
1777
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_mv_grid_district"
1778
                    ),
1779
                    SRIDUniqueNonZero(
1780
                        table="grid.egon_mv_grid_district",
1781
                        rule_id="SRIDUniqueNonZero.egon_mv_grid_district.geom",
1782
                        column="geom"
1783
                    ),
1784
                ]
1785
            },
1786
            on_validation_failure="continue"  # Continue pipeline even if validations fail
1787
        )
1788