pydra-core 0.0.1__py2.py3-none-any.whl → 0.0.2__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pydra_core/__init__.py +32 -32
- pydra_core/common/common.py +98 -98
- pydra_core/common/enum.py +63 -63
- pydra_core/common/interpolate.py +345 -345
- pydra_core/common/probability.py +293 -293
- pydra_core/core/calculation.py +51 -51
- pydra_core/core/datamodels/frequency_line.py +60 -60
- pydra_core/core/exceedance_frequency_line.py +224 -224
- pydra_core/core/exceedance_frequency_line_experimental.py +163 -163
- pydra_core/core/hbn.py +226 -226
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_2017.txt +36 -36
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_2017_metOnzHeid.txt +45 -45
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_G_2015_metOnzHeid_v02.txt +50 -50
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_G_2015_v02.txt +42 -42
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_G_2050_metOnzHeid_v02.txt +56 -56
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_G_2050_v02.txt +48 -48
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_G_2100_metOnzHeid_v02.txt +56 -56
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_G_2100_v02.txt +48 -48
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_W_2015_metOnzHeid_v02.txt +50 -50
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_W_2015_v02.txt +42 -42
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_W_2050_metOnzHeid_v02.txt +56 -56
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_W_2050_v02.txt +48 -48
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_W_2100_metOnzHeid_v02.txt +51 -51
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_OI2014_W_2100_v02.txt +44 -44
- pydra_core/data/statistics/Afvoer/Borgharen/Ovkans_Borgharen_piekafvoer_Ref.txt +27 -27
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_2017.txt +30 -30
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_2017_metOnzHeid.txt +32 -32
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_G_2015.txt +44 -44
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_G_2015_metOnzHeid.txt +33 -33
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_G_2050.txt +44 -44
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_G_2050_metOnzHeid.txt +33 -33
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_G_2100.txt +44 -44
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_G_2100_metOnzHeid.txt +38 -38
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_W_2015.txt +44 -44
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_W_2015_metOnzHeid.txt +33 -33
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_W_2050.txt +44 -44
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_W_2050_metOnzHeid.txt +33 -33
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_W_2100.txt +44 -44
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_OI2014_W_2100_metOnzHeid.txt +33 -33
- pydra_core/data/statistics/Afvoer/Dalfsen/Ovkans_Dalfsen_piekafvoer_Ref.txt +13 -13
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_2017.txt +47 -47
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_2017_metOnzHeid.txt +47 -47
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_G_2015.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_G_2015_metOnzHeid.txt +58 -58
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_G_2050.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_G_2050_metOnzHeid.txt +58 -58
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_G_2100.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_G_2100_metOnzHeid.txt +58 -58
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_W_2015.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_W_2015_metOnzHeid.txt +58 -58
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_W_2050.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_W_2050_metOnzHeid.txt +58 -58
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_W_2100.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_OI2014_W_2100_metOnzHeid.txt +58 -58
- pydra_core/data/statistics/Afvoer/Lith/Ovkans_Lith_piekafvoer_Ref.txt +20 -20
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_2017.txt +33 -33
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_2017_metOnzHeid.txt +59 -59
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2015.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2015_BenedenRijn.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2015_metOnzHeid.txt +62 -62
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2015_metOnzHeid_BenedenRijn.txt +65 -65
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2050.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2050_BenedenRijn.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2050_metOnzHeid.txt +62 -62
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2050_metOnzHeid_BenedenRijn.txt +64 -64
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2100.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2100_BenedenRijn.txt +49 -49
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2100_metOnzHeid.txt +62 -62
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_G_2100_metOnzHeid_BenedenRijn.txt +64 -64
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2015.txt +50 -50
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2015_BenedenRijn.txt +50 -50
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2015_metOnzHeid.txt +62 -62
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2015_metOnzHeid_BenedenRijn.txt +64 -64
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2050.txt +50 -50
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2050_BenedenRijn.txt +50 -50
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2050_metOnzHeid.txt +62 -62
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2050_metOnzHeid_BenedenRijn.txt +64 -64
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2100.txt +50 -50
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2100_BenedenRijn.txt +50 -50
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2100_metOnzHeid.txt +62 -62
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_OI2014_W_2100_metOnzHeid_BenedenRijn.txt +65 -65
- pydra_core/data/statistics/Afvoer/Lobith/Ovkans_Lobith_piekafvoer_Ref.txt +22 -22
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_2017.txt +55 -55
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_2017_metOnzHeid.txt +55 -55
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_G_2015.txt +46 -46
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_G_2015_metOnzHeid.txt +64 -64
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_G_2050.txt +46 -46
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_G_2050_metOnzHeid.txt +64 -64
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_G_2100.txt +46 -46
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_G_2100_metOnzHeid.txt +64 -64
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_W_2015.txt +47 -47
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_W_2015_metOnzHeid.txt +64 -64
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_W_2050.txt +47 -47
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_W_2050_metOnzHeid.txt +64 -64
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_W_2100.txt +47 -47
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_OI2014_W_2100_metOnzHeid.txt +64 -64
- pydra_core/data/statistics/Afvoer/Olst/Ovkans_Olst_piekafvoer_Ref.txt +14 -14
- pydra_core/data/statistics/Golfvorm/Borgharen/Golfvormen_Borgharen.txt +76 -76
- pydra_core/data/statistics/Golfvorm/Dalfsen/Golfvormen_Dalfsen.txt +83 -83
- pydra_core/data/statistics/Golfvorm/Grevelingenmeer/Golfvormen_Grevelingenmeer.txt +33 -33
- pydra_core/data/statistics/Golfvorm/IJsselmeer/Golfvormen_IJsselmeer.txt +83 -83
- pydra_core/data/statistics/Golfvorm/Lith/Golfvormen_Lith.txt +76 -76
- pydra_core/data/statistics/Golfvorm/Lobith/Golfvormen_Lobith.txt +76 -76
- pydra_core/data/statistics/Golfvorm/Markermeer/Golfvormen_Markermeer.txt +139 -139
- pydra_core/data/statistics/Golfvorm/Olst/Golfvormen_Olst.txt +83 -83
- pydra_core/data/statistics/Golfvorm/Veerse Meer/Golfvormen_Veersemeer.txt +53 -53
- pydra_core/data/statistics/Golfvorm/Veluwerandmeer/Golfvormen_Veluwerandmeer.txt +139 -139
- pydra_core/data/statistics/Golfvorm/Volkerak-Zoommeer/Golfvormen_Volkerakzoommeer.txt +73 -73
- pydra_core/data/statistics/Meerpeil/Grevelingenmeer/Ovkans_Grevelingenmeer_piekmeerpeil_2017.txt +12 -12
- pydra_core/data/statistics/Meerpeil/Grevelingenmeer/Ovkans_Grevelingenmeer_piekmeerpeil_2017_metOnzHeid.txt +24 -24
- pydra_core/data/statistics/Meerpeil/Grevelingenmeer/Ovkans_Grevelingenmeer_piekmeerpeil_v01.txt +12 -12
- pydra_core/data/statistics/Meerpeil/IJsselmeer/Ovkans_IJsselmeer_piekmeerpeil_2017.txt +25 -25
- pydra_core/data/statistics/Meerpeil/IJsselmeer/Ovkans_IJsselmeer_piekmeerpeil_2017_metOnzHeid.txt +39 -39
- pydra_core/data/statistics/Meerpeil/IJsselmeer/Ovkans_IJsselmeer_piekmeerpeil_v01.txt +14 -14
- pydra_core/data/statistics/Meerpeil/Markermeer/Ovkans_Markermeer_piekmeerpeil_2017.txt +18 -18
- pydra_core/data/statistics/Meerpeil/Markermeer/Ovkans_Markermeer_piekmeerpeil_2017_metOnzHeid.txt +37 -37
- pydra_core/data/statistics/Meerpeil/Markermeer/Ovkans_Markermeer_piekmeerpeil_v01.txt +10 -10
- pydra_core/data/statistics/Meerpeil/Veerse Meer/Ovkans_Veersemeer_piekmeerpeil_excl_peilverhoging.txt +13 -13
- pydra_core/data/statistics/Meerpeil/Veerse Meer/Ovkans_Veersemeer_piekmeerpeil_v01.txt +15 -15
- pydra_core/data/statistics/Meerpeil/Veluwerandmeer/Ovkans_Veluwerandmeer_piekmeerpeil_2017.txt +13 -13
- pydra_core/data/statistics/Meerpeil/Veluwerandmeer/Ovkans_Veluwerandmeer_piekmeerpeil_2017_metOnzHeid.txt +36 -36
- pydra_core/data/statistics/Meerpeil/Veluwerandmeer/Ovkans_Veluwerandmeer_piekmeerpeil_v01.txt +13 -13
- pydra_core/data/statistics/Meerpeil/Volkerak-Zoommeer/Ovkans_VZM_piekmeerpeil_BER-VZM.txt +17 -17
- pydra_core/data/statistics/Meerpeil/Volkerak-Zoommeer/Ovkans_VZM_piekmeerpeil_BER-VZM_metOnzHeid.txt +42 -42
- pydra_core/data/statistics/Restant/Oosterschelde/BesliskansenOSKering.txt +524 -524
- pydra_core/data/statistics/Restant/Oosterschelde/KansenFaseverschil_2023.txt +7 -7
- pydra_core/data/statistics/Restant/Oosterschelde/KansenFaseverschil_OS.txt +13 -13
- pydra_core/data/statistics/Restant/Oosterschelde/KansenStormduur_OS.txt +14 -14
- pydra_core/data/statistics/Restant/Oosterschelde/KansenStormduur_OS_40_60_80uur_2023.txt +16 -16
- pydra_core/data/statistics/Restant/Oosterschelde/ScenariokansenOSKering_2008.txt +23 -23
- pydra_core/data/statistics/Restant/Oosterschelde/ScenariokansenOSKering_2013.txt +18 -18
- pydra_core/data/statistics/Restant/Oosterschelde/ScenariokansenOSKering_2017.txt +18 -18
- pydra_core/data/statistics/Restant/Oosterschelde/ScenariokansenOSKering_2023.txt +13 -13
- pydra_core/data/statistics/Restant/Up2U/Up2U10.dat +59 -59
- pydra_core/data/statistics/Restant/Up2U/Up2Up.dat +59 -59
- pydra_core/data/statistics/Restant/Up2U/Up2Ustar.dat +59 -59
- pydra_core/data/statistics/Restant/hulpdijken.txt +59 -59
- pydra_core/data/statistics/Restant/hulpgolfhoogtes.txt +23 -23
- pydra_core/data/statistics/Restant/hulpgolfperiodes.txt +38 -38
- pydra_core/data/statistics/Restant/kansstormduur.txt +8 -8
- pydra_core/data/statistics/Restant/pwind_west.txt +33 -33
- pydra_core/data/statistics/Restant/pwind_west_met_Volkerfactor.txt +33 -33
- pydra_core/data/statistics/Restant/pwind_west_zonder_Volkerfactor.txt +33 -33
- pydra_core/data/statistics/Sigmafunctie/Hollandse Kust Midden/VS_sigmafunctie_Kust_Midden.txt +18 -18
- pydra_core/data/statistics/Sigmafunctie/Hollandse Kust Midden/VS_sigmafunctie_Kust_Midden_2017.txt +22 -22
- pydra_core/data/statistics/Sigmafunctie/Hollandse Kust Noord/VS_sigmafunctie_Kust_Noord.txt +18 -18
- pydra_core/data/statistics/Sigmafunctie/Hollandse Kust Noord/VS_sigmafunctie_Kust_Noord_2017.txt +22 -22
- pydra_core/data/statistics/Sigmafunctie/Hollandse Kust Zuid/VS_sigmafunctie_Kust_Zuid.txt +18 -18
- pydra_core/data/statistics/Sigmafunctie/Hollandse Kust Zuid/VS_sigmafunctie_Kust_Zuid_2017.txt +22 -22
- pydra_core/data/statistics/Sigmafunctie/Oosterschelde/VS_sigmafunctie_OS.txt +21 -21
- pydra_core/data/statistics/Sigmafunctie/Oosterschelde/VS_sigmafunctie_OS_16sectoren_2023.txt +23 -23
- pydra_core/data/statistics/Sigmafunctie/Oosterschelde/VS_sigmafunctie_OS_2017.txt +21 -21
- pydra_core/data/statistics/Sigmafunctie/Waddenzee Oost/VS_sigmafunctie_WZ_oost.txt +18 -18
- pydra_core/data/statistics/Sigmafunctie/Waddenzee Oost/VS_sigmafunctie_WZ_oost_2017.txt +22 -22
- pydra_core/data/statistics/Sigmafunctie/Waddenzee West/VS_sigmafunctie_WZ_west.txt +18 -18
- pydra_core/data/statistics/Sigmafunctie/Waddenzee West/VS_sigmafunctie_WZ_west_2017.txt +22 -22
- pydra_core/data/statistics/Sigmafunctie/Westerschelde/VS_sigmafunctie_WS.txt +18 -18
- pydra_core/data/statistics/Sigmafunctie/Westerschelde/VS_sigmafunctie_WS_2017.txt +22 -22
- pydra_core/data/statistics/Sluitpeilen/Sluitfunctie Europoortkering Maas 2017.csv +630 -630
- pydra_core/data/statistics/Sluitpeilen/Sluitfunctie Europoortkering Rijn 2017.csv +630 -630
- pydra_core/data/statistics/Sluitpeilen/Sluitfunctie Hollandsche IJsselkering.csv +757 -757
- pydra_core/data/statistics/Sluitpeilen/Sluitfunctie Oosterscheldekering 2017.csv +55080 -55080
- pydra_core/data/statistics/Topduur/Borgharen/Topduur_Borgharen_2017.txt +18 -18
- pydra_core/data/statistics/Topduur/Borgharen/Topduur_Borgharen_v00.txt +14 -14
- pydra_core/data/statistics/Topduur/Dalfsen/Topduur_Dalfsen_2017.txt +19 -19
- pydra_core/data/statistics/Topduur/Dalfsen/Topduur_Dalfsen_v01.txt +15 -15
- pydra_core/data/statistics/Topduur/Grevelingenmeer/Topduur_Grevelingenmeer_2017.txt +13 -13
- pydra_core/data/statistics/Topduur/Grevelingenmeer/Topduur_Grevelingenmeer_v01.txt +13 -13
- pydra_core/data/statistics/Topduur/IJsselmeer/Topduur_IJsselmeer_2017.txt +19 -19
- pydra_core/data/statistics/Topduur/IJsselmeer/Topduur_IJsselmeer_v01.txt +14 -14
- pydra_core/data/statistics/Topduur/Lith/Topduur_Lith_2017.txt +18 -18
- pydra_core/data/statistics/Topduur/Lith/Topduur_Lith_v01.txt +17 -17
- pydra_core/data/statistics/Topduur/Lobith/Topduur_Lobith_2017.txt +18 -18
- pydra_core/data/statistics/Topduur/Lobith/Topduur_Lobith_v01.txt +16 -16
- pydra_core/data/statistics/Topduur/Markermeer/Topduur_Markermeer_2017.txt +19 -19
- pydra_core/data/statistics/Topduur/Markermeer/Topduur_Markermeer_v01.txt +11 -11
- pydra_core/data/statistics/Topduur/Olst/Topduur_Olst_2017.txt +19 -19
- pydra_core/data/statistics/Topduur/Olst/Topduur_Olst_v01.txt +15 -15
- pydra_core/data/statistics/Topduur/Veerse Meer/Topduur_Veersemeer_excl_peilverhoging.txt +12 -12
- pydra_core/data/statistics/Topduur/Veerse Meer/Topduur_Veersemeer_v01.txt +15 -15
- pydra_core/data/statistics/Topduur/Veluwerandmeer/Topduur_Veluwerandmeer_2017.txt +11 -11
- pydra_core/data/statistics/Topduur/Veluwerandmeer/Topduur_Veluwerandmeer_v01.txt +11 -11
- pydra_core/data/statistics/Topduur/Volkerak-Zoommeer/Topduur_Volkerakzoommeer_BER-VZM.txt +17 -17
- pydra_core/data/statistics/Windrichting/Deelen/Richtingskansen_Deelen_2017.txt +27 -27
- pydra_core/data/statistics/Windrichting/Hollandse Kust/KansenWindrichting_Kust.txt +16 -16
- pydra_core/data/statistics/Windrichting/Hollandse Kust/KansenWindrichting_Kust_2017.txt +23 -23
- pydra_core/data/statistics/Windrichting/Oosterschelde/KansenWindrichting_16sectoren_OS_2023.txt +30 -30
- pydra_core/data/statistics/Windrichting/Oosterschelde/KansenWindrichting_OS.txt +19 -19
- pydra_core/data/statistics/Windrichting/Oosterschelde/KansenWindrichting_OS_2017.txt +23 -23
- pydra_core/data/statistics/Windrichting/Schiphol/Richtingskansen_Schiphol_12sectoren.txt +19 -19
- pydra_core/data/statistics/Windrichting/Schiphol/Richtingskansen_Schiphol_12sectoren_2017.txt +19 -19
- pydra_core/data/statistics/Windrichting/Schiphol/Richtingskansen_Schiphol_2017.txt +27 -27
- pydra_core/data/statistics/Windrichting/Schiphol/kanswindrichting_v01.txt +28 -28
- pydra_core/data/statistics/Windrichting/Waddenzee/KansenWindrichting_WZ.txt +16 -16
- pydra_core/data/statistics/Windrichting/Waddenzee/KansenWindrichting_WZ_2017.txt +23 -23
- pydra_core/data/statistics/Windrichting/Westerschelde/KansenWindrichting_WS.txt +16 -16
- pydra_core/data/statistics/Windrichting/Westerschelde/KansenWindrichting_WS_2017.txt +23 -23
- pydra_core/data/statistics/Windsnelheid/De Kooy/OvkansWindsnelheid_Texel.txt +69 -69
- pydra_core/data/statistics/Windsnelheid/De Kooy/Ovkanswind_de Kooy_2017.txt +91 -91
- pydra_core/data/statistics/Windsnelheid/De Kooy/Ovkanswind_de Kooy_2017_metOnzHeid.txt +91 -91
- pydra_core/data/statistics/Windsnelheid/Deelen/Ovkanswind_Deelen_2017.txt +90 -90
- pydra_core/data/statistics/Windsnelheid/Deelen/Ovkanswind_Deelen_2017_metOnzHeid.txt +90 -90
- pydra_core/data/statistics/Windsnelheid/Hoek van Holland/OvkansWindsnelheid_Hoek van Holland.txt +69 -69
- pydra_core/data/statistics/Windsnelheid/Hoek van Holland/Ovkanswind_Hoek van Holland_2017.txt +91 -91
- pydra_core/data/statistics/Windsnelheid/Hoek van Holland/Ovkanswind_Hoek van Holland_2017_metOnzHeid.txt +91 -91
- pydra_core/data/statistics/Windsnelheid/IJmuiden/OvkansWindsnelheid_IJmuiden.txt +69 -69
- pydra_core/data/statistics/Windsnelheid/IJmuiden/Ovkanswind_IJmuiden_2017.txt +91 -91
- pydra_core/data/statistics/Windsnelheid/IJmuiden/Ovkanswind_IJmuiden_2017_metOnzHeid.txt +91 -91
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_Schiphol_12sectoren.txt +50 -50
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_Schiphol_12sectoren_2017.txt +90 -90
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_Schiphol_12sectoren_2017_metOnzHeid.txt +90 -90
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_Schiphol_12sectoren_2017_metWindDrag.txt +96 -96
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_Schiphol_12sectoren_2017_metWindDrag_metOnzHeid.txt +96 -96
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_Schiphol_16sectoren_2017_metWindDrag.txt +96 -96
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_Schiphol_16sectoren_2017_metWindDrag_metOnzHeid.txt +96 -96
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_Schiphol_2017.txt +90 -90
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_Schiphol_2017_metOnzHeid.txt +90 -90
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_Schiphol_met_Volkerfactor_2017.txt +90 -90
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_Schiphol_met_Volkerfactor_2017_metOnzHeid.txt +90 -90
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_schiphol.txt +57 -57
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_schiphol_10%.txt +63 -63
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_schiphol_5%.txt +61 -61
- pydra_core/data/statistics/Windsnelheid/Schiphol/Ovkanswind_schiphol_B_met volker.txt +59 -59
- pydra_core/data/statistics/Windsnelheid/Vlissingen/OvkansWindsnelheid_OS.txt +66 -66
- pydra_core/data/statistics/Windsnelheid/Vlissingen/OvkansWindsnelheid_Vlissingen.txt +69 -69
- pydra_core/data/statistics/Windsnelheid/Vlissingen/Ovkanswind_Vlissingen_16sectoren_2023.txt +91 -91
- pydra_core/data/statistics/Windsnelheid/Vlissingen/Ovkanswind_Vlissingen_16sectoren_2023_metOnzHeid.txt +90 -90
- pydra_core/data/statistics/Windsnelheid/Vlissingen/Ovkanswind_Vlissingen_2017.txt +91 -91
- pydra_core/data/statistics/Windsnelheid/Vlissingen/Ovkanswind_Vlissingen_2017_metOnzHeid.txt +91 -91
- pydra_core/data/statistics/Windsnelheid/Vlissingen/Ovkanswind_Vlissingen_2017_metWindDrag.txt +96 -96
- pydra_core/data/statistics/Windsnelheid/Vlissingen/Ovkanswind_Vlissingen_2017_metWindDrag_metOnzHeid.txt +96 -96
- pydra_core/data/statistics/Windsnelheid/West-Terschelling/OvkansWindsnelheid_West-Tersch.txt +69 -69
- pydra_core/data/statistics/Windsnelheid/West-Terschelling/Ovkanswind_West Terschelling_2017.txt +91 -91
- pydra_core/data/statistics/Windsnelheid/West-Terschelling/Ovkanswind_West Terschelling_2017_metOnzHeid.txt +91 -91
- pydra_core/data/statistics/Zeewaterstand/Delfzijl/CondPovDelfzijl_12u_zichtjaar1985_2017.txt +81 -81
- pydra_core/data/statistics/Zeewaterstand/Delfzijl/CondPovDelfzijl_12u_zichtjaar1985_2017_metOnzHeid.txt +81 -81
- pydra_core/data/statistics/Zeewaterstand/Delfzijl/CondPovDelfzijl_12u_zichtjaar2017.txt +81 -81
- pydra_core/data/statistics/Zeewaterstand/Delfzijl/CondPovDelfzijl_12u_zichtjaar2017_metOnzHeid.txt +81 -81
- pydra_core/data/statistics/Zeewaterstand/Delfzijl/OvkansZee_Delfzijl.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Den Helder/CondPovDenHelder_12u_zichtjaar1985_2017.txt +89 -89
- pydra_core/data/statistics/Zeewaterstand/Den Helder/CondPovDenHelder_12u_zichtjaar1985_2017_metOnzHeid.txt +89 -89
- pydra_core/data/statistics/Zeewaterstand/Den Helder/CondPovDenHelder_12u_zichtjaar2017.txt +88 -88
- pydra_core/data/statistics/Zeewaterstand/Den Helder/CondPovDenHelder_12u_zichtjaar2017_metOnzHeid.txt +88 -88
- pydra_core/data/statistics/Zeewaterstand/Den Helder/OvkansZee_Den Helder.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Den Oever/CondPovDenOeverBuiten_12u_zichtjaar1985_2017.txt +88 -88
- pydra_core/data/statistics/Zeewaterstand/Den Oever/CondPovDenOeverBuiten_12u_zichtjaar1985_2017_metOnzHeid.txt +88 -88
- pydra_core/data/statistics/Zeewaterstand/Den Oever/CondPovDenOeverBuiten_12u_zichtjaar2017.txt +87 -87
- pydra_core/data/statistics/Zeewaterstand/Den Oever/CondPovDenOeverBuiten_12u_zichtjaar2017_metOnzHeid.txt +87 -87
- pydra_core/data/statistics/Zeewaterstand/Den Oever/OvkansZee_Den Oever.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Hansweert/CondPovHansweert_12u_zichtjaar1985_2017.txt +71 -71
- pydra_core/data/statistics/Zeewaterstand/Hansweert/CondPovHansweert_12u_zichtjaar1985_2017_metOnzHeid.txt +71 -71
- pydra_core/data/statistics/Zeewaterstand/Hansweert/CondPovHansweert_12u_zichtjaar2017.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Hansweert/CondPovHansweert_12u_zichtjaar2017_metOnzHeid.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Hansweert/OvkansZee_Hansweert.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Harlingen/CondPovHarlingen_12u_zichtjaar1985_2017.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/Harlingen/CondPovHarlingen_12u_zichtjaar1985_2017_metOnzHeid.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/Harlingen/CondPovHarlingen_12u_zichtjaar2017.txt +84 -84
- pydra_core/data/statistics/Zeewaterstand/Harlingen/CondPovHarlingen_12u_zichtjaar2017_metOnzHeid.txt +84 -84
- pydra_core/data/statistics/Zeewaterstand/Harlingen/OvkansZee_Harlingen.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Hoek van Holland/CondPovHoekvanHolland_12u_zichtjaar1985_2017.txt +84 -84
- pydra_core/data/statistics/Zeewaterstand/Hoek van Holland/CondPovHoekvanHolland_12u_zichtjaar1985_2017_metOnzHeid.txt +84 -84
- pydra_core/data/statistics/Zeewaterstand/Hoek van Holland/CondPovHoekvanHolland_12u_zichtjaar2017.txt +83 -83
- pydra_core/data/statistics/Zeewaterstand/Hoek van Holland/CondPovHoekvanHolland_12u_zichtjaar2017_metOnzHeid.txt +83 -83
- pydra_core/data/statistics/Zeewaterstand/Hoek van Holland/OvkansZee_Hoek van Holland.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Huibertgat/CondPovHuibertgat_12u_zichtjaar1985_2017.txt +86 -86
- pydra_core/data/statistics/Zeewaterstand/Huibertgat/CondPovHuibertgat_12u_zichtjaar1985_2017_metOnzHeid.txt +86 -86
- pydra_core/data/statistics/Zeewaterstand/Huibertgat/CondPovHuibertgat_12u_zichtjaar2017.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/Huibertgat/CondPovHuibertgat_12u_zichtjaar2017_metOnzHeid.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/Huibertgat/OvkansZee_Huibertgat.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/IJmuiden/CondPovIJmuiden_12u_zichtjaar1985_2017.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/IJmuiden/CondPovIJmuiden_12u_zichtjaar1985_2017_metOnzHeid.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/IJmuiden/CondPovIJmuiden_12u_zichtjaar2017.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/IJmuiden/CondPovIJmuiden_12u_zichtjaar2017_metOnzHeid.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/IJmuiden/OvkansZee_IJmuiden.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/IJmuiden virtueel/CondPovIJmuiden-Additional_12u_zichtjaar1985_2017.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/IJmuiden virtueel/CondPovIJmuiden-Additional_12u_zichtjaar1985_2017_metOnzHeid.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/IJmuiden virtueel/CondPovIJmuiden-Additional_12u_zichtjaar2017.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/IJmuiden virtueel/CondPovIJmuiden-Additional_12u_zichtjaar2017_metOnzHeid.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/IJmuiden virtueel/OvkansZee_IJmuiden_virtueel.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Lauwersoog/CondPovLauwersoog_12u_zichtjaar1985_2017.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/Lauwersoog/CondPovLauwersoog_12u_zichtjaar1985_2017_metOnzHeid.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/Lauwersoog/CondPovLauwersoog_12u_zichtjaar2017.txt +84 -84
- pydra_core/data/statistics/Zeewaterstand/Lauwersoog/CondPovLauwersoog_12u_zichtjaar2017_metOnzHeid.txt +84 -84
- pydra_core/data/statistics/Zeewaterstand/Lauwersoog/OvkansZee_Lauwersoog.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Maasmond/CondPovMaasmond_12u_zichtjaar1985_2011.txt +88 -88
- pydra_core/data/statistics/Zeewaterstand/Maasmond/CondPovMaasmond_12u_zichtjaar1985_2017.txt +88 -88
- pydra_core/data/statistics/Zeewaterstand/Maasmond/CondPovMaasmond_12u_zichtjaar1985_2017_metOnzheid.txt +92 -92
- pydra_core/data/statistics/Zeewaterstand/Maasmond/CondPovMaasmond_12u_zichtjaar2017.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/Maasmond/CondPovMaasmond_12u_zichtjaar2017_metOnzheid.txt +85 -85
- pydra_core/data/statistics/Zeewaterstand/Oosterschelde/CondPovOS11_12u_zichtjaar1985_2017.txt +79 -79
- pydra_core/data/statistics/Zeewaterstand/Oosterschelde/CondPovOS11_12u_zichtjaar1985_2017_metOnzHeid.txt +79 -79
- pydra_core/data/statistics/Zeewaterstand/Oosterschelde/CondPovOS11_12u_zichtjaar2017.txt +79 -79
- pydra_core/data/statistics/Zeewaterstand/Oosterschelde/CondPovOS11_12u_zichtjaar2017_metOnzHeid.txt +79 -79
- pydra_core/data/statistics/Zeewaterstand/Oosterschelde/CondPovOS11_16sectoren_12u_2023.txt +74 -74
- pydra_core/data/statistics/Zeewaterstand/Oosterschelde/CondPovOS11_16sectoren_12u_2023_metOnzHeid.txt +73 -73
- pydra_core/data/statistics/Zeewaterstand/Oosterschelde/OvkansZee_OS11.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Oosterschelde/OvkansZeewaterstand_OS.txt +71 -71
- pydra_core/data/statistics/Zeewaterstand/Vlissingen/CondPovVlissingen_12u_zichtjaar1985_2017.txt +74 -74
- pydra_core/data/statistics/Zeewaterstand/Vlissingen/CondPovVlissingen_12u_zichtjaar1985_2017_metOnzHeid.txt +74 -74
- pydra_core/data/statistics/Zeewaterstand/Vlissingen/CondPovVlissingen_12u_zichtjaar2017.txt +74 -74
- pydra_core/data/statistics/Zeewaterstand/Vlissingen/CondPovVlissingen_12u_zichtjaar2017_metOnzHeid.txt +74 -74
- pydra_core/data/statistics/Zeewaterstand/Vlissingen/OvkansZee_Vlissingen.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/Vlissingen virtueel/CondPovVlissingen-Additional_12u_zichtjaar1985_2017.txt +74 -74
- pydra_core/data/statistics/Zeewaterstand/Vlissingen virtueel/CondPovVlissingen-Additional_12u_zichtjaar1985_2017_metOnzHeid.txt +74 -74
- pydra_core/data/statistics/Zeewaterstand/Vlissingen virtueel/CondPovVlissingen-Additional_12u_zichtjaar2017.txt +74 -74
- pydra_core/data/statistics/Zeewaterstand/Vlissingen virtueel/CondPovVlissingen-Additional_12u_zichtjaar2017_metOnzHeid.txt +74 -74
- pydra_core/data/statistics/Zeewaterstand/Vlissingen virtueel/OvkansZee_Vlissingen_virtueel.txt +70 -70
- pydra_core/data/statistics/Zeewaterstand/West-Terschelling/CondPovWestTerschelling_12u_zichtjaar1985_2017.txt +87 -87
- pydra_core/data/statistics/Zeewaterstand/West-Terschelling/CondPovWestTerschelling_12u_zichtjaar1985_2017_metOnzHeid.txt +87 -87
- pydra_core/data/statistics/Zeewaterstand/West-Terschelling/CondPovWestTerschelling_12u_zichtjaar2017.txt +86 -86
- pydra_core/data/statistics/Zeewaterstand/West-Terschelling/CondPovWestTerschelling_12u_zichtjaar2017_metOnzHeid.txt +86 -86
- pydra_core/data/statistics/Zeewaterstand/West-Terschelling/OvkansZee_West-Terschelling.txt +70 -70
- pydra_core/hrdatabase/hrdatabase.py +177 -177
- pydra_core/io/database_hr.py +598 -598
- pydra_core/io/database_settings.py +183 -183
- pydra_core/io/file_hydranl.py +92 -92
- pydra_core/location/location.py +115 -115
- pydra_core/location/model/base_model.py +270 -270
- pydra_core/location/model/loading/loading.py +368 -368
- pydra_core/location/model/loading/loading_factory.py +89 -89
- pydra_core/location/model/loading/loading_model/loading_model.py +324 -324
- pydra_core/location/model/loading/other_systems/loading_wave_overtopping.py +122 -122
- pydra_core/location/model/loading/water_systems/loading_coast.py +54 -54
- pydra_core/location/model/loading/water_systems/loading_eastern_scheldt.py +169 -169
- pydra_core/location/model/loading/water_systems/loading_ijssel_vechtdelta.py +55 -55
- pydra_core/location/model/loading/water_systems/loading_lake.py +55 -55
- pydra_core/location/model/loading/water_systems/loading_lower_rivier.py +68 -68
- pydra_core/location/model/loading/water_systems/loading_upper_river.py +55 -55
- pydra_core/location/model/statistics/other_systems/statistics_wave_overtopping.py +72 -72
- pydra_core/location/model/statistics/statistics.py +171 -171
- pydra_core/location/model/statistics/statistics_factory.py +89 -89
- pydra_core/location/model/statistics/stochastics/barrier/barrier.py +43 -43
- pydra_core/location/model/statistics/stochastics/barrier/barrier_easternscheldt.py +147 -147
- pydra_core/location/model/statistics/stochastics/barrier/barrier_europoort.py +209 -209
- pydra_core/location/model/statistics/stochastics/barrier/barrier_ramspol.py +41 -41
- pydra_core/location/model/statistics/stochastics/barrier/no_barrier.py +21 -21
- pydra_core/location/model/statistics/stochastics/discharge.py +108 -108
- pydra_core/location/model/statistics/stochastics/discrete_probability.py +55 -55
- pydra_core/location/model/statistics/stochastics/lake_level.py +158 -158
- pydra_core/location/model/statistics/stochastics/model_uncertainty.py +358 -358
- pydra_core/location/model/statistics/stochastics/sea_level/sea_level.py +53 -53
- pydra_core/location/model/statistics/stochastics/sea_level/sea_level_lower_river.py +93 -93
- pydra_core/location/model/statistics/stochastics/sea_level/sea_level_point.py +65 -65
- pydra_core/location/model/statistics/stochastics/sea_level/sea_level_triangular.py +158 -158
- pydra_core/location/model/statistics/stochastics/sigma_function.py +24 -24
- pydra_core/location/model/statistics/stochastics/wave_shape.py +624 -624
- pydra_core/location/model/statistics/stochastics/wind_speed.py +196 -196
- pydra_core/location/model/statistics/water_systems/statistics_coast.py +153 -153
- pydra_core/location/model/statistics/water_systems/statistics_eastern_scheldt.py +177 -177
- pydra_core/location/model/statistics/water_systems/statistics_ijssel_vechtdelta.py +229 -229
- pydra_core/location/model/statistics/water_systems/statistics_lake.py +86 -86
- pydra_core/location/model/statistics/water_systems/statistics_lower_river.py +321 -321
- pydra_core/location/model/statistics/water_systems/statistics_upper_river.py +86 -86
- pydra_core/location/model/water_system.py +249 -249
- pydra_core/location/model/wave_overtopping.py +25 -25
- pydra_core/location/profile/foreland.py +246 -246
- pydra_core/location/profile/lib/README.MD +10 -10
- pydra_core/location/profile/profile.py +971 -971
- pydra_core/location/profile/profile_loading.py +473 -473
- pydra_core/location/settings/settings.py +387 -387
- {pydra_core-0.0.1.dist-info → pydra_core-0.0.2.dist-info}/METADATA +18 -3
- pydra_core-0.0.2.dist-info/RECORD +389 -0
- pydra_core-0.0.1.dist-info/RECORD +0 -389
- {pydra_core-0.0.1.dist-info → pydra_core-0.0.2.dist-info}/WHEEL +0 -0
pydra_core/io/database_hr.py
CHANGED
@@ -1,598 +1,598 @@
|
|
1
|
-
import os
|
2
|
-
import pandas as pd
|
3
|
-
import sqlite3
|
4
|
-
|
5
|
-
from typing import List
|
6
|
-
from typing import Union
|
7
|
-
|
8
|
-
from .database_settings import DatabaseSettings
|
9
|
-
from ..common.enum import WaterSystem
|
10
|
-
from ..location.settings.settings import Settings
|
11
|
-
|
12
|
-
|
13
|
-
class DatabaseHR:
|
14
|
-
"""
|
15
|
-
HR database sqlite
|
16
|
-
"""
|
17
|
-
|
18
|
-
def __init__(self, path_to_database: str) -> None:
|
19
|
-
# Check if the path is valid
|
20
|
-
if not os.path.exists(path_to_database):
|
21
|
-
raise OSError(path_to_database)
|
22
|
-
|
23
|
-
# Save the path
|
24
|
-
self.path_to_database = path_to_database
|
25
|
-
self.con = None
|
26
|
-
|
27
|
-
def __enter__(self) -> "DatabaseHR":
|
28
|
-
# Init the connection
|
29
|
-
self.con = sqlite3.connect(self.path_to_database)
|
30
|
-
return self
|
31
|
-
|
32
|
-
def __exit__(self, exc_type, exc_val, exc_tb) -> None:
|
33
|
-
# Close the connection
|
34
|
-
self.con.close()
|
35
|
-
|
36
|
-
def get_water_system(self) -> WaterSystem:
|
37
|
-
"""
|
38
|
-
Obtain the water system from the .sqlite database
|
39
|
-
|
40
|
-
Returns
|
41
|
-
-------
|
42
|
-
WaterSystem
|
43
|
-
Corresponding water system
|
44
|
-
"""
|
45
|
-
# Obtain the water system ID from the sqlite
|
46
|
-
wsid = self.con.execute("SELECT GeneralId FROM General").fetchone()[0]
|
47
|
-
|
48
|
-
# Return the WaterSystem
|
49
|
-
return WaterSystem(wsid)
|
50
|
-
|
51
|
-
def get_hrdlocations_names(self) -> List[str]:
|
52
|
-
"""
|
53
|
-
Obtain a list with all names of the hrdlocations
|
54
|
-
|
55
|
-
Returns
|
56
|
-
-------
|
57
|
-
list[str]
|
58
|
-
A list with all names of hrdlocations
|
59
|
-
"""
|
60
|
-
# Obtain the water system ID from the sqlite
|
61
|
-
hrdlocations = self.con.execute("SELECT Name FROM HRDLocations").fetchall()
|
62
|
-
|
63
|
-
# Convert the result to a list of strings
|
64
|
-
names = [row[0] for row in hrdlocations]
|
65
|
-
|
66
|
-
# Return names
|
67
|
-
return names
|
68
|
-
|
69
|
-
def get_hrdlocation_id(self, hrdlocation: Union[str, Settings]) -> int:
|
70
|
-
"""
|
71
|
-
Returns the HRDLocationID
|
72
|
-
|
73
|
-
Parameters
|
74
|
-
----------
|
75
|
-
hrdlocation : Union[str, Settings]
|
76
|
-
HRDLocation
|
77
|
-
|
78
|
-
Returns
|
79
|
-
-------
|
80
|
-
int
|
81
|
-
HRDLocationId
|
82
|
-
"""
|
83
|
-
# Obtain the HRDLocationName from a Settings object
|
84
|
-
if isinstance(hrdlocation, Settings):
|
85
|
-
hrdlocation = hrdlocation.location
|
86
|
-
|
87
|
-
# Obtain the water system ID from the sqlite
|
88
|
-
hrdlocationid = self.con.execute(
|
89
|
-
f"SELECT HRDLocationId FROM HRDLocations WHERE Name = '{hrdlocation}'"
|
90
|
-
).fetchone()[0]
|
91
|
-
|
92
|
-
# Return HRDLocationId
|
93
|
-
return hrdlocationid
|
94
|
-
|
95
|
-
def get_hrdlocation_xy(
|
96
|
-
self, hrdlocation: Union[str, Settings]
|
97
|
-
) -> Union[float, float]:
|
98
|
-
"""
|
99
|
-
Returns the X and Y coordinate of the HRDLocation
|
100
|
-
|
101
|
-
Parameters
|
102
|
-
----------
|
103
|
-
hrdlocation : Union[str, Settings]
|
104
|
-
HRDLocation
|
105
|
-
|
106
|
-
Returns
|
107
|
-
-------
|
108
|
-
Union[float, float]
|
109
|
-
X and Y coordinate
|
110
|
-
"""
|
111
|
-
# Obtain the HRDLocationName from a Settings object
|
112
|
-
if isinstance(hrdlocation, Settings):
|
113
|
-
hrdlocation = hrdlocation.location
|
114
|
-
|
115
|
-
# Obtain the water system ID from the sqlite
|
116
|
-
hrdlocationid = self.con.execute(
|
117
|
-
f"SELECT XCoordinate, YCoordinate FROM HRDLocations WHERE Name = '{hrdlocation}'"
|
118
|
-
).fetchone()
|
119
|
-
|
120
|
-
# Return HRDLocationId
|
121
|
-
return hrdlocationid
|
122
|
-
|
123
|
-
def get_input_variables(self) -> list:
|
124
|
-
"""
|
125
|
-
Return the input variables
|
126
|
-
|
127
|
-
Returns
|
128
|
-
-------
|
129
|
-
list
|
130
|
-
List with input variables
|
131
|
-
"""
|
132
|
-
# Query
|
133
|
-
sql = "SELECT InputVariableId FROM HRDInputVariables"
|
134
|
-
data = self.con.execute(sql).fetchall()
|
135
|
-
|
136
|
-
# Settings database
|
137
|
-
with DatabaseSettings() as database:
|
138
|
-
ivids = database.get_input_variable_ids()
|
139
|
-
data = [ivids[i[0]] for i in data]
|
140
|
-
|
141
|
-
# Shift wind speed in front
|
142
|
-
if "u" in data:
|
143
|
-
data.pop(data.index("u"))
|
144
|
-
data.insert(0, "u")
|
145
|
-
|
146
|
-
# Return results
|
147
|
-
return data
|
148
|
-
|
149
|
-
def get_result_variables(self) -> list:
|
150
|
-
"""
|
151
|
-
Return the result variables
|
152
|
-
|
153
|
-
Returns
|
154
|
-
-------
|
155
|
-
list
|
156
|
-
List with result variables
|
157
|
-
"""
|
158
|
-
# Query
|
159
|
-
sql = "SELECT ResultVariableId FROM HRDResultVariables"
|
160
|
-
data = self.con.execute(sql).fetchall()
|
161
|
-
|
162
|
-
# Settings database
|
163
|
-
with DatabaseSettings() as database:
|
164
|
-
rvids = database.get_result_variable_ids()
|
165
|
-
data = [rvids[i[0]] for i in data]
|
166
|
-
|
167
|
-
# For the coast, if not defined, the local water level is equal to the sea level
|
168
|
-
if self.get_water_system() in [
|
169
|
-
WaterSystem.WADDEN_SEA_EAST,
|
170
|
-
WaterSystem.WADDEN_SEA_WEST,
|
171
|
-
WaterSystem.COAST_NORTH,
|
172
|
-
WaterSystem.COAST_CENTRAL,
|
173
|
-
WaterSystem.COAST_SOUTH,
|
174
|
-
WaterSystem.WESTERN_SCHELDT,
|
175
|
-
]:
|
176
|
-
if "h" not in rvids:
|
177
|
-
data.insert(0, "h")
|
178
|
-
|
179
|
-
# Return results
|
180
|
-
return data
|
181
|
-
|
182
|
-
def get_model_uncertainties(
|
183
|
-
self, hrdlocation: Union[int, str, Settings]
|
184
|
-
) -> pd.DataFrame:
|
185
|
-
"""
|
186
|
-
Return the model uncertainties
|
187
|
-
|
188
|
-
Parameters
|
189
|
-
----------
|
190
|
-
hrdlocation : Union[int, str, Settings]
|
191
|
-
HRDLocation in form of HRDLocationId, HRDLocationName or Settings object
|
192
|
-
|
193
|
-
Returns
|
194
|
-
-------
|
195
|
-
pd.DataFrame
|
196
|
-
DataFrame with the distribution per closing situation
|
197
|
-
"""
|
198
|
-
# Obtain the hrdlocationid
|
199
|
-
if isinstance(hrdlocation, (str, Settings)):
|
200
|
-
hrdlocation = self.get_hrdlocation_id(hrdlocation)
|
201
|
-
|
202
|
-
# Obtain all model uncertainties from the database for the hrdlocation
|
203
|
-
sql = f"""
|
204
|
-
SELECT umf.HRDLocationId, umf.ClosingSituationId, hrv.ResultVariableId, umf.Mean, umf.Standarddeviation
|
205
|
-
FROM UncertaintyModelFactor umf
|
206
|
-
INNER JOIN HRDResultVariables hrv
|
207
|
-
ON umf.HRDResultColumnId = hrv.HRDResultColumnId
|
208
|
-
WHERE umf.HRDLocationId = {hrdlocation}
|
209
|
-
"""
|
210
|
-
data = pd.read_sql(sql, self.con, index_col="HRDLocationId")
|
211
|
-
|
212
|
-
# Adjust dataframe
|
213
|
-
with DatabaseSettings() as database:
|
214
|
-
rvids = database.get_result_variable_ids()
|
215
|
-
data.rename(
|
216
|
-
columns={
|
217
|
-
"ClosingSituationId": "k",
|
218
|
-
"ResultVariableId": "rvid",
|
219
|
-
"Mean": "mean",
|
220
|
-
"Standarddeviation": "stdev",
|
221
|
-
},
|
222
|
-
inplace=True,
|
223
|
-
)
|
224
|
-
data["rvid"].replace(rvids, inplace=True)
|
225
|
-
|
226
|
-
# Return the model uncertainties
|
227
|
-
return data
|
228
|
-
|
229
|
-
def get_correlation_uncertainties(
|
230
|
-
self, hrdlocation: Union[int, str, Settings]
|
231
|
-
) -> pd.DataFrame:
|
232
|
-
"""
|
233
|
-
Return the correlation between model uncertainties
|
234
|
-
|
235
|
-
Parameters
|
236
|
-
----------
|
237
|
-
hrdlocation : Union[int, str, Settings]
|
238
|
-
HRDLocation in form of HRDLocationId, HRDLocationName or Settings object
|
239
|
-
"""
|
240
|
-
# Obtain the hrdlocationid
|
241
|
-
if isinstance(hrdlocation, (str, Settings)):
|
242
|
-
hrdlocation = self.get_hrdlocation_id(hrdlocation)
|
243
|
-
|
244
|
-
# ResultVariableIds
|
245
|
-
with DatabaseSettings() as database:
|
246
|
-
rvids = database.get_result_variable_ids()
|
247
|
-
|
248
|
-
# Data uit correlatie tabel
|
249
|
-
try:
|
250
|
-
sql = f"""
|
251
|
-
SELECT ucf.HRDLocationId, ucf.ClosingSituationId, hrv.ResultVariableId, ucf.HRDResultColumnId2, ucf.Correlation
|
252
|
-
FROM UncertaintyCorrelationFactor ucf
|
253
|
-
INNER JOIN HRDResultVariables hrv
|
254
|
-
ON ucf.HRDResultColumnId = hrv.HRDResultColumnId
|
255
|
-
WHERE ucf.HRDLocationId = {hrdlocation}
|
256
|
-
"""
|
257
|
-
data = pd.read_sql(sql, self.con, index_col="HRDLocationId")
|
258
|
-
|
259
|
-
# Vertaal tabel naar HRDResultColumnId2
|
260
|
-
# Zo niet, negeer en ga verder, neem aan dat de HRDResultColumnId2 heeft dezelfde Ids als HRDResultColumnId
|
261
|
-
try:
|
262
|
-
sql = """
|
263
|
-
SELECT HRDResultColumnId2, ResultVariableId
|
264
|
-
FROM HRDResultVariables2 hrv2
|
265
|
-
INNER JOIN HRDResultVariables hrv ON hrv.HRDResultColumnId = hrv2.HRDResultColumnId
|
266
|
-
"""
|
267
|
-
data_hrdid2 = self.con.execute(sql).fetchall()
|
268
|
-
hrdid2_to_rvid = {_hrdid: _hrdid2 for _hrdid, _hrdid2 in data_hrdid2}
|
269
|
-
data = data.replace({"HRDResultColumnId2": hrdid2_to_rvid})
|
270
|
-
except Exception as e:
|
271
|
-
print(f"ERROR: {e}, continuing without")
|
272
|
-
pass
|
273
|
-
|
274
|
-
# Geen correlaties aanwezig, return leeg dataframe
|
275
|
-
except Exception as e:
|
276
|
-
print(f"ERROR: {e}, continuing without correlation")
|
277
|
-
data = pd.DataFrame(
|
278
|
-
columns=[
|
279
|
-
"HRDLocationId",
|
280
|
-
"ClosingSituationId",
|
281
|
-
"ResultVariableId",
|
282
|
-
"HRDResultColumnId2",
|
283
|
-
"Correlation",
|
284
|
-
]
|
285
|
-
)
|
286
|
-
|
287
|
-
# Replace column names
|
288
|
-
data.rename(
|
289
|
-
columns={
|
290
|
-
"ClosingSituationId": "k",
|
291
|
-
"ResultVariableId": "rvid",
|
292
|
-
"HRDResultColumnId2": "rvid2",
|
293
|
-
"Correlation": "rho",
|
294
|
-
},
|
295
|
-
inplace=True,
|
296
|
-
)
|
297
|
-
|
298
|
-
# Check of alle ResultVariableId(2) rvids zijn
|
299
|
-
if not set(data["rvid"]).issubset(set(rvids)) or not set(
|
300
|
-
data["rvid2"]
|
301
|
-
).issubset(set(rvids)):
|
302
|
-
raise ValueError("ERROR")
|
303
|
-
|
304
|
-
# Change ResultVariableId(2) to rvids
|
305
|
-
data["rvid"].replace(rvids, inplace=True)
|
306
|
-
data["rvid2"].replace(rvids, inplace=True)
|
307
|
-
|
308
|
-
# Return the model uncertainties
|
309
|
-
return data
|
310
|
-
|
311
|
-
def get_wind_directions(self) -> dict:
|
312
|
-
"""
|
313
|
-
Obtain a dictionary with HRDWindDirectionIds and Directions
|
314
|
-
|
315
|
-
Returns
|
316
|
-
-------
|
317
|
-
dict
|
318
|
-
A dictionary {HRDWindDirectionId : Direction}
|
319
|
-
"""
|
320
|
-
# Wind directions
|
321
|
-
results = self.con.execute("SELECT * FROM HRDWindDirections").fetchall()
|
322
|
-
|
323
|
-
# Process wind directions such that {wind_id : wind_direction}
|
324
|
-
wind_direction = {wid: wr for wid, wr in results}
|
325
|
-
|
326
|
-
# Return wind direction dictionary
|
327
|
-
return wind_direction
|
328
|
-
|
329
|
-
def get_result_table(self, hrdlocation: Union[str, Settings]) -> pd.DataFrame:
|
330
|
-
"""
|
331
|
-
Function to read the load combinations of a location to a pandas DataFrame
|
332
|
-
|
333
|
-
Parameters
|
334
|
-
----------
|
335
|
-
hrdlocation : Union[str, Settings]
|
336
|
-
HRDLocation
|
337
|
-
|
338
|
-
Returns
|
339
|
-
-------
|
340
|
-
pd.DataFrame
|
341
|
-
A DataFrame with load combinations
|
342
|
-
"""
|
343
|
-
# Obtain HRDLocationId
|
344
|
-
hrdlocationid = self.get_hrdlocation_id(hrdlocation)
|
345
|
-
with DatabaseSettings() as database:
|
346
|
-
ivids = database.get_input_variable_ids()
|
347
|
-
rvids = database.get_result_variable_ids()
|
348
|
-
|
349
|
-
# Obtain all data from the HydroDynamicData table
|
350
|
-
# (HydroDynamicDataId, HRDLocationId, ClosingSituationId, HRDWindDirectionID)
|
351
|
-
query = f"SELECT * FROM HydroDynamicData WHERE HRDLocationId = {hrdlocationid}"
|
352
|
-
hydrodynamicdata = pd.read_sql(query, self.con, index_col="HydroDynamicDataId")
|
353
|
-
|
354
|
-
# Obtain all data from the HydroDynamicInputData table
|
355
|
-
hydrodynamicdataids = ",".join(
|
356
|
-
hydrodynamicdata.index.values.astype(str).tolist()
|
357
|
-
)
|
358
|
-
query = """
|
359
|
-
SELECT ID.HydroDynamicDataId, IV.InputVariableId, ID.Value
|
360
|
-
FROM HydroDynamicInputData ID
|
361
|
-
INNER JOIN HRDInputVariables IV ON ID.HRDInputColumnId = IV.HRDInputColumnId
|
362
|
-
WHERE HydroDynamicDataId IN ({});
|
363
|
-
""".format(hydrodynamicdataids)
|
364
|
-
hydrodynamicinputdata = pd.read_sql(
|
365
|
-
query, self.con, index_col=["HydroDynamicDataId", "InputVariableId"]
|
366
|
-
).unstack()
|
367
|
-
ivcols = [ivids[i] for i in hydrodynamicinputdata.columns.get_level_values(1)]
|
368
|
-
hydrodynamicinputdata.columns = ivcols
|
369
|
-
|
370
|
-
# Obtain all data from the HydroDynamicResultData table
|
371
|
-
query = """
|
372
|
-
SELECT RD.HydroDynamicDataId, RV.ResultVariableId, RD.Value
|
373
|
-
FROM HydroDynamicResultData RD
|
374
|
-
INNER JOIN HRDResultVariables RV ON RD.HRDResultColumnId = RV.HRDResultColumnId
|
375
|
-
WHERE HydroDynamicDataId IN ({});
|
376
|
-
""".format(hydrodynamicdataids)
|
377
|
-
hydrodynamicresultdata = pd.read_sql(
|
378
|
-
query, self.con, index_col=["HydroDynamicDataId", "ResultVariableId"]
|
379
|
-
).unstack()
|
380
|
-
rvcols = [rvids[i] for i in hydrodynamicresultdata.columns.get_level_values(1)]
|
381
|
-
hydrodynamicresultdata.columns = rvcols
|
382
|
-
|
383
|
-
# Merge the three tables
|
384
|
-
results = hydrodynamicdata.join(hydrodynamicinputdata).join(
|
385
|
-
hydrodynamicresultdata
|
386
|
-
)
|
387
|
-
|
388
|
-
# Vervang windrichting
|
389
|
-
windrdict = self.get_wind_directions()
|
390
|
-
for wid, r in windrdict.items():
|
391
|
-
if r == 0.0:
|
392
|
-
windrdict[wid] = 360.0
|
393
|
-
results["Wind direction"] = [
|
394
|
-
windrdict[i] for i in results["HRDWindDirectionId"].array
|
395
|
-
]
|
396
|
-
results.drop(["HRDLocationId", "HRDWindDirectionId"], axis=1, inplace=True)
|
397
|
-
|
398
|
-
# Replace discrete stochasts
|
399
|
-
results.rename(
|
400
|
-
columns={"Wind direction": "r", "ClosingSituationId": "k"}, inplace=True
|
401
|
-
)
|
402
|
-
|
403
|
-
# Move r to the front
|
404
|
-
results.insert(0, "r", results.pop("r"))
|
405
|
-
results.sort_values(by=["k", "r"] + ivcols, inplace=True)
|
406
|
-
|
407
|
-
# Return results
|
408
|
-
return results
|
409
|
-
|
410
|
-
def get_closing_levels_table_europoort(self) -> dict:
|
411
|
-
"""
|
412
|
-
Read the closing levels for the Europoort barrier.
|
413
|
-
|
414
|
-
Returns
|
415
|
-
-------
|
416
|
-
pd.DataFrame
|
417
|
-
A Dataframe with the closing level at sea (m) given r, u, q
|
418
|
-
"""
|
419
|
-
|
420
|
-
# If there is a table called 'Sluitfunctie Europoortkering', use it
|
421
|
-
try:
|
422
|
-
# Read the table
|
423
|
-
table = pd.read_sql(
|
424
|
-
"SELECT * FROM [Sluitfunctie Europoortkering]", con=self.con
|
425
|
-
)
|
426
|
-
|
427
|
-
# Otherwise use the default functions
|
428
|
-
except Exception as e:
|
429
|
-
print(f"{e}: Using default functions")
|
430
|
-
PATH = os.path.join(
|
431
|
-
os.path.split(os.path.dirname(__file__))[0],
|
432
|
-
"data",
|
433
|
-
"statistics",
|
434
|
-
"Sluitpeilen",
|
435
|
-
)
|
436
|
-
if self.get_water_system() in [
|
437
|
-
WaterSystem.RHINE_TIDAL,
|
438
|
-
WaterSystem.EUROPOORT,
|
439
|
-
]:
|
440
|
-
table = pd.read_csv(
|
441
|
-
os.path.join(PATH, "Sluitfunctie Europoortkering Rijn 2017.csv"),
|
442
|
-
delimiter=";",
|
443
|
-
)
|
444
|
-
elif self.get_water_system() == WaterSystem.MEUSE_TIDAL:
|
445
|
-
table = pd.read_csv(
|
446
|
-
os.path.join(PATH, "Sluitfunctie Europoortkering Maas 2017.csv"),
|
447
|
-
delimiter=";",
|
448
|
-
)
|
449
|
-
else:
|
450
|
-
raise (
|
451
|
-
f"[ERROR] No closing levels for water system '{self.get_water_system().name}'."
|
452
|
-
)
|
453
|
-
|
454
|
-
# All columns to lower
|
455
|
-
table.columns = table.columns.str.lower()
|
456
|
-
|
457
|
-
# Rename
|
458
|
-
table.rename(
|
459
|
-
columns={
|
460
|
-
"windrichting": "r",
|
461
|
-
"afvoer": "q",
|
462
|
-
"windsnelheid": "u",
|
463
|
-
"zeewaterstand": "m",
|
464
|
-
},
|
465
|
-
inplace=True,
|
466
|
-
)
|
467
|
-
|
468
|
-
# Return table
|
469
|
-
return table
|
470
|
-
|
471
|
-
def get_closing_levels_table_eastern_scheldt(self):
|
472
|
-
"""
|
473
|
-
Read the closing levels for the Eastern Scheldt barrier.
|
474
|
-
|
475
|
-
Returns
|
476
|
-
-------
|
477
|
-
pd.DataFrame
|
478
|
-
A Dataframe with the closing level (h_rpb), given r, u, m, d, p
|
479
|
-
"""
|
480
|
-
# Read the table from the ClosingCriterionsOSK
|
481
|
-
table = pd.read_sql("SELECT * FROM ClosingCriterionsOSK", con=self.con)
|
482
|
-
|
483
|
-
# Rename the entries
|
484
|
-
table.rename(
|
485
|
-
columns={
|
486
|
-
"WindDirection": "r",
|
487
|
-
"WindSpeed": "u",
|
488
|
-
"WaterLevel": "m",
|
489
|
-
"StormDuration": "d",
|
490
|
-
"PhaseDifference": "p",
|
491
|
-
"WaterLevelRPB": "h_rpb",
|
492
|
-
},
|
493
|
-
inplace=True,
|
494
|
-
)
|
495
|
-
|
496
|
-
# Return table
|
497
|
-
return table
|
498
|
-
|
499
|
-
def get_closing_situations_eastern_scheldt(self) -> dict:
|
500
|
-
"""
|
501
|
-
Read the closing situations from the database (ClosingSituationId : (Description : FailingLocks)).
|
502
|
-
e.g. 1 : ("Reguliere sluiting", 0)
|
503
|
-
|
504
|
-
Only works for the Eastern Scheldt.
|
505
|
-
"""
|
506
|
-
# Check watersystem
|
507
|
-
if self.get_water_system() != WaterSystem.EASTERN_SCHELDT:
|
508
|
-
raise ValueError(
|
509
|
-
"[ERROR] Function can only be called for the Eastern Scheldt"
|
510
|
-
)
|
511
|
-
|
512
|
-
# Read table
|
513
|
-
sql = """
|
514
|
-
SELECT C.ClosingSituationId, T.Description, C.FailingLocks
|
515
|
-
FROM ClosingSituations C
|
516
|
-
INNER JOIN ClosingSituationTypes T ON C.ClosingSituationTypeId = T.ClosingSituationTypeId
|
517
|
-
"""
|
518
|
-
results = self.con.execute(sql).fetchall()
|
519
|
-
|
520
|
-
# Post processing into an dictionary
|
521
|
-
results = {i[0]: (i[1], i[2]) for i in results}
|
522
|
-
|
523
|
-
# Return
|
524
|
-
return results
|
525
|
-
|
526
|
-
def get_result_table_eastern_scheldt(
|
527
|
-
self, hrdlocation: Union[str, Settings]
|
528
|
-
) -> pd.DataFrame:
|
529
|
-
"""
|
530
|
-
Function to export the loadcombinations of a location to a pandas DataFrame
|
531
|
-
|
532
|
-
Parameters
|
533
|
-
----------
|
534
|
-
naam : str
|
535
|
-
Locationname
|
536
|
-
"""
|
537
|
-
# Obtain HRDLocationId
|
538
|
-
hrdlocationid = self.get_hrdlocation_id(hrdlocation)
|
539
|
-
with DatabaseSettings() as database:
|
540
|
-
ivids = database.get_input_variable_ids()
|
541
|
-
rvids = database.get_result_variable_ids()
|
542
|
-
|
543
|
-
# First collect the dataids. Also replace wind direction ids with real ids
|
544
|
-
SQL = """
|
545
|
-
SELECT D.HydraulicLoadId, D.ClosingSituationId, W.Direction AS "Wind direction"
|
546
|
-
FROM HydroDynamicData D
|
547
|
-
INNER JOIN HRDWindDirections W ON D.HRDWindDirectionId=W.HRDWindDirectionId;"""
|
548
|
-
dataids = pd.read_sql(SQL, self.con, index_col="HydraulicLoadId")
|
549
|
-
dataids.rename(
|
550
|
-
columns={"Wind direction": "r", "ClosingSituationId": "k"}, inplace=True
|
551
|
-
)
|
552
|
-
|
553
|
-
# Collect the result data. Replace HRDResultColumnId with variable id's
|
554
|
-
SQL = """
|
555
|
-
SELECT RD.HydraulicLoadId, RV.ResultVariableId, RD.Value
|
556
|
-
FROM HydroDynamicResultData RD
|
557
|
-
INNER JOIN HRDResultVariables RV ON RD.HRDResultColumnId = RV.HRDResultColumnId
|
558
|
-
WHERE HRDLocationId = {};""".format(hrdlocationid)
|
559
|
-
resultdata = pd.read_sql(
|
560
|
-
SQL, self.con, index_col=["HydraulicLoadId", "ResultVariableId"]
|
561
|
-
).unstack()
|
562
|
-
|
563
|
-
# Reduce columnindex to single level index (without 'Value')
|
564
|
-
resultdata.columns = [
|
565
|
-
rvids[rid] for rid in resultdata.columns.get_level_values(1)
|
566
|
-
]
|
567
|
-
|
568
|
-
# Create dictionary for mapping HRDInputColumnId to InputVariableId
|
569
|
-
SQL = """
|
570
|
-
SELECT ID.HydraulicLoadId, IV.InputVariableId, ID.Value
|
571
|
-
FROM HydroDynamicInputData ID
|
572
|
-
INNER JOIN HRDInputVariables IV ON ID.HRDInputColumnId = IV.HRDInputColumnId"""
|
573
|
-
inputdata = pd.read_sql(
|
574
|
-
SQL, self.con, index_col=["HydraulicLoadId", "InputVariableId"]
|
575
|
-
).unstack()
|
576
|
-
|
577
|
-
# Reduce columnindex to single level index (without 'Value')
|
578
|
-
inputdata.columns = [
|
579
|
-
ivids[ivid] for ivid in inputdata.columns.get_level_values(1)
|
580
|
-
]
|
581
|
-
|
582
|
-
# Join data and sort values
|
583
|
-
resultaat = (
|
584
|
-
dataids.join(inputdata).join(resultdata).sort_values(by=["r", "u", "m"])
|
585
|
-
)
|
586
|
-
|
587
|
-
# In the WBI2023 the water levels and waves are in the same table, but have different input variables
|
588
|
-
# Split the water levels and wave results
|
589
|
-
idx = pd.isnull(resultaat["hs"])
|
590
|
-
|
591
|
-
waterlevels = resultaat.loc[idx].dropna(how="all", axis=1)
|
592
|
-
waveconditions = resultaat.loc[~idx].dropna(how="all", axis=1)
|
593
|
-
|
594
|
-
# Replace m_os by m for the water level and m for h for the wave conditions
|
595
|
-
waterlevels.rename(columns={"m_os": "m"}, inplace=True)
|
596
|
-
waveconditions.rename(columns={"m": "h"}, inplace=True)
|
597
|
-
|
598
|
-
return waterlevels, waveconditions
|
1
|
+
import os
|
2
|
+
import pandas as pd
|
3
|
+
import sqlite3
|
4
|
+
|
5
|
+
from typing import List
|
6
|
+
from typing import Union
|
7
|
+
|
8
|
+
from .database_settings import DatabaseSettings
|
9
|
+
from ..common.enum import WaterSystem
|
10
|
+
from ..location.settings.settings import Settings
|
11
|
+
|
12
|
+
|
13
|
+
class DatabaseHR:
|
14
|
+
"""
|
15
|
+
HR database sqlite
|
16
|
+
"""
|
17
|
+
|
18
|
+
def __init__(self, path_to_database: str) -> None:
|
19
|
+
# Check if the path is valid
|
20
|
+
if not os.path.exists(path_to_database):
|
21
|
+
raise OSError(path_to_database)
|
22
|
+
|
23
|
+
# Save the path
|
24
|
+
self.path_to_database = path_to_database
|
25
|
+
self.con = None
|
26
|
+
|
27
|
+
def __enter__(self) -> "DatabaseHR":
|
28
|
+
# Init the connection
|
29
|
+
self.con = sqlite3.connect(self.path_to_database)
|
30
|
+
return self
|
31
|
+
|
32
|
+
def __exit__(self, exc_type, exc_val, exc_tb) -> None:
|
33
|
+
# Close the connection
|
34
|
+
self.con.close()
|
35
|
+
|
36
|
+
def get_water_system(self) -> WaterSystem:
|
37
|
+
"""
|
38
|
+
Obtain the water system from the .sqlite database
|
39
|
+
|
40
|
+
Returns
|
41
|
+
-------
|
42
|
+
WaterSystem
|
43
|
+
Corresponding water system
|
44
|
+
"""
|
45
|
+
# Obtain the water system ID from the sqlite
|
46
|
+
wsid = self.con.execute("SELECT GeneralId FROM General").fetchone()[0]
|
47
|
+
|
48
|
+
# Return the WaterSystem
|
49
|
+
return WaterSystem(wsid)
|
50
|
+
|
51
|
+
def get_hrdlocations_names(self) -> List[str]:
|
52
|
+
"""
|
53
|
+
Obtain a list with all names of the hrdlocations
|
54
|
+
|
55
|
+
Returns
|
56
|
+
-------
|
57
|
+
list[str]
|
58
|
+
A list with all names of hrdlocations
|
59
|
+
"""
|
60
|
+
# Obtain the water system ID from the sqlite
|
61
|
+
hrdlocations = self.con.execute("SELECT Name FROM HRDLocations").fetchall()
|
62
|
+
|
63
|
+
# Convert the result to a list of strings
|
64
|
+
names = [row[0] for row in hrdlocations]
|
65
|
+
|
66
|
+
# Return names
|
67
|
+
return names
|
68
|
+
|
69
|
+
def get_hrdlocation_id(self, hrdlocation: Union[str, Settings]) -> int:
|
70
|
+
"""
|
71
|
+
Returns the HRDLocationID
|
72
|
+
|
73
|
+
Parameters
|
74
|
+
----------
|
75
|
+
hrdlocation : Union[str, Settings]
|
76
|
+
HRDLocation
|
77
|
+
|
78
|
+
Returns
|
79
|
+
-------
|
80
|
+
int
|
81
|
+
HRDLocationId
|
82
|
+
"""
|
83
|
+
# Obtain the HRDLocationName from a Settings object
|
84
|
+
if isinstance(hrdlocation, Settings):
|
85
|
+
hrdlocation = hrdlocation.location
|
86
|
+
|
87
|
+
# Obtain the water system ID from the sqlite
|
88
|
+
hrdlocationid = self.con.execute(
|
89
|
+
f"SELECT HRDLocationId FROM HRDLocations WHERE Name = '{hrdlocation}'"
|
90
|
+
).fetchone()[0]
|
91
|
+
|
92
|
+
# Return HRDLocationId
|
93
|
+
return hrdlocationid
|
94
|
+
|
95
|
+
def get_hrdlocation_xy(
|
96
|
+
self, hrdlocation: Union[str, Settings]
|
97
|
+
) -> Union[float, float]:
|
98
|
+
"""
|
99
|
+
Returns the X and Y coordinate of the HRDLocation
|
100
|
+
|
101
|
+
Parameters
|
102
|
+
----------
|
103
|
+
hrdlocation : Union[str, Settings]
|
104
|
+
HRDLocation
|
105
|
+
|
106
|
+
Returns
|
107
|
+
-------
|
108
|
+
Union[float, float]
|
109
|
+
X and Y coordinate
|
110
|
+
"""
|
111
|
+
# Obtain the HRDLocationName from a Settings object
|
112
|
+
if isinstance(hrdlocation, Settings):
|
113
|
+
hrdlocation = hrdlocation.location
|
114
|
+
|
115
|
+
# Obtain the water system ID from the sqlite
|
116
|
+
hrdlocationid = self.con.execute(
|
117
|
+
f"SELECT XCoordinate, YCoordinate FROM HRDLocations WHERE Name = '{hrdlocation}'"
|
118
|
+
).fetchone()
|
119
|
+
|
120
|
+
# Return HRDLocationId
|
121
|
+
return hrdlocationid
|
122
|
+
|
123
|
+
def get_input_variables(self) -> list:
|
124
|
+
"""
|
125
|
+
Return the input variables
|
126
|
+
|
127
|
+
Returns
|
128
|
+
-------
|
129
|
+
list
|
130
|
+
List with input variables
|
131
|
+
"""
|
132
|
+
# Query
|
133
|
+
sql = "SELECT InputVariableId FROM HRDInputVariables"
|
134
|
+
data = self.con.execute(sql).fetchall()
|
135
|
+
|
136
|
+
# Settings database
|
137
|
+
with DatabaseSettings() as database:
|
138
|
+
ivids = database.get_input_variable_ids()
|
139
|
+
data = [ivids[i[0]] for i in data]
|
140
|
+
|
141
|
+
# Shift wind speed in front
|
142
|
+
if "u" in data:
|
143
|
+
data.pop(data.index("u"))
|
144
|
+
data.insert(0, "u")
|
145
|
+
|
146
|
+
# Return results
|
147
|
+
return data
|
148
|
+
|
149
|
+
def get_result_variables(self) -> list:
|
150
|
+
"""
|
151
|
+
Return the result variables
|
152
|
+
|
153
|
+
Returns
|
154
|
+
-------
|
155
|
+
list
|
156
|
+
List with result variables
|
157
|
+
"""
|
158
|
+
# Query
|
159
|
+
sql = "SELECT ResultVariableId FROM HRDResultVariables"
|
160
|
+
data = self.con.execute(sql).fetchall()
|
161
|
+
|
162
|
+
# Settings database
|
163
|
+
with DatabaseSettings() as database:
|
164
|
+
rvids = database.get_result_variable_ids()
|
165
|
+
data = [rvids[i[0]] for i in data]
|
166
|
+
|
167
|
+
# For the coast, if not defined, the local water level is equal to the sea level
|
168
|
+
if self.get_water_system() in [
|
169
|
+
WaterSystem.WADDEN_SEA_EAST,
|
170
|
+
WaterSystem.WADDEN_SEA_WEST,
|
171
|
+
WaterSystem.COAST_NORTH,
|
172
|
+
WaterSystem.COAST_CENTRAL,
|
173
|
+
WaterSystem.COAST_SOUTH,
|
174
|
+
WaterSystem.WESTERN_SCHELDT,
|
175
|
+
]:
|
176
|
+
if "h" not in rvids:
|
177
|
+
data.insert(0, "h")
|
178
|
+
|
179
|
+
# Return results
|
180
|
+
return data
|
181
|
+
|
182
|
+
def get_model_uncertainties(
|
183
|
+
self, hrdlocation: Union[int, str, Settings]
|
184
|
+
) -> pd.DataFrame:
|
185
|
+
"""
|
186
|
+
Return the model uncertainties
|
187
|
+
|
188
|
+
Parameters
|
189
|
+
----------
|
190
|
+
hrdlocation : Union[int, str, Settings]
|
191
|
+
HRDLocation in form of HRDLocationId, HRDLocationName or Settings object
|
192
|
+
|
193
|
+
Returns
|
194
|
+
-------
|
195
|
+
pd.DataFrame
|
196
|
+
DataFrame with the distribution per closing situation
|
197
|
+
"""
|
198
|
+
# Obtain the hrdlocationid
|
199
|
+
if isinstance(hrdlocation, (str, Settings)):
|
200
|
+
hrdlocation = self.get_hrdlocation_id(hrdlocation)
|
201
|
+
|
202
|
+
# Obtain all model uncertainties from the database for the hrdlocation
|
203
|
+
sql = f"""
|
204
|
+
SELECT umf.HRDLocationId, umf.ClosingSituationId, hrv.ResultVariableId, umf.Mean, umf.Standarddeviation
|
205
|
+
FROM UncertaintyModelFactor umf
|
206
|
+
INNER JOIN HRDResultVariables hrv
|
207
|
+
ON umf.HRDResultColumnId = hrv.HRDResultColumnId
|
208
|
+
WHERE umf.HRDLocationId = {hrdlocation}
|
209
|
+
"""
|
210
|
+
data = pd.read_sql(sql, self.con, index_col="HRDLocationId")
|
211
|
+
|
212
|
+
# Adjust dataframe
|
213
|
+
with DatabaseSettings() as database:
|
214
|
+
rvids = database.get_result_variable_ids()
|
215
|
+
data.rename(
|
216
|
+
columns={
|
217
|
+
"ClosingSituationId": "k",
|
218
|
+
"ResultVariableId": "rvid",
|
219
|
+
"Mean": "mean",
|
220
|
+
"Standarddeviation": "stdev",
|
221
|
+
},
|
222
|
+
inplace=True,
|
223
|
+
)
|
224
|
+
data["rvid"].replace(rvids, inplace=True)
|
225
|
+
|
226
|
+
# Return the model uncertainties
|
227
|
+
return data
|
228
|
+
|
229
|
+
def get_correlation_uncertainties(
|
230
|
+
self, hrdlocation: Union[int, str, Settings]
|
231
|
+
) -> pd.DataFrame:
|
232
|
+
"""
|
233
|
+
Return the correlation between model uncertainties
|
234
|
+
|
235
|
+
Parameters
|
236
|
+
----------
|
237
|
+
hrdlocation : Union[int, str, Settings]
|
238
|
+
HRDLocation in form of HRDLocationId, HRDLocationName or Settings object
|
239
|
+
"""
|
240
|
+
# Obtain the hrdlocationid
|
241
|
+
if isinstance(hrdlocation, (str, Settings)):
|
242
|
+
hrdlocation = self.get_hrdlocation_id(hrdlocation)
|
243
|
+
|
244
|
+
# ResultVariableIds
|
245
|
+
with DatabaseSettings() as database:
|
246
|
+
rvids = database.get_result_variable_ids()
|
247
|
+
|
248
|
+
# Data uit correlatie tabel
|
249
|
+
try:
|
250
|
+
sql = f"""
|
251
|
+
SELECT ucf.HRDLocationId, ucf.ClosingSituationId, hrv.ResultVariableId, ucf.HRDResultColumnId2, ucf.Correlation
|
252
|
+
FROM UncertaintyCorrelationFactor ucf
|
253
|
+
INNER JOIN HRDResultVariables hrv
|
254
|
+
ON ucf.HRDResultColumnId = hrv.HRDResultColumnId
|
255
|
+
WHERE ucf.HRDLocationId = {hrdlocation}
|
256
|
+
"""
|
257
|
+
data = pd.read_sql(sql, self.con, index_col="HRDLocationId")
|
258
|
+
|
259
|
+
# Vertaal tabel naar HRDResultColumnId2
|
260
|
+
# Zo niet, negeer en ga verder, neem aan dat de HRDResultColumnId2 heeft dezelfde Ids als HRDResultColumnId
|
261
|
+
try:
|
262
|
+
sql = """
|
263
|
+
SELECT HRDResultColumnId2, ResultVariableId
|
264
|
+
FROM HRDResultVariables2 hrv2
|
265
|
+
INNER JOIN HRDResultVariables hrv ON hrv.HRDResultColumnId = hrv2.HRDResultColumnId
|
266
|
+
"""
|
267
|
+
data_hrdid2 = self.con.execute(sql).fetchall()
|
268
|
+
hrdid2_to_rvid = {_hrdid: _hrdid2 for _hrdid, _hrdid2 in data_hrdid2}
|
269
|
+
data = data.replace({"HRDResultColumnId2": hrdid2_to_rvid})
|
270
|
+
except Exception as e:
|
271
|
+
print(f"ERROR: {e}, continuing without")
|
272
|
+
pass
|
273
|
+
|
274
|
+
# Geen correlaties aanwezig, return leeg dataframe
|
275
|
+
except Exception as e:
|
276
|
+
print(f"ERROR: {e}, continuing without correlation")
|
277
|
+
data = pd.DataFrame(
|
278
|
+
columns=[
|
279
|
+
"HRDLocationId",
|
280
|
+
"ClosingSituationId",
|
281
|
+
"ResultVariableId",
|
282
|
+
"HRDResultColumnId2",
|
283
|
+
"Correlation",
|
284
|
+
]
|
285
|
+
)
|
286
|
+
|
287
|
+
# Replace column names
|
288
|
+
data.rename(
|
289
|
+
columns={
|
290
|
+
"ClosingSituationId": "k",
|
291
|
+
"ResultVariableId": "rvid",
|
292
|
+
"HRDResultColumnId2": "rvid2",
|
293
|
+
"Correlation": "rho",
|
294
|
+
},
|
295
|
+
inplace=True,
|
296
|
+
)
|
297
|
+
|
298
|
+
# Check of alle ResultVariableId(2) rvids zijn
|
299
|
+
if not set(data["rvid"]).issubset(set(rvids)) or not set(
|
300
|
+
data["rvid2"]
|
301
|
+
).issubset(set(rvids)):
|
302
|
+
raise ValueError("ERROR")
|
303
|
+
|
304
|
+
# Change ResultVariableId(2) to rvids
|
305
|
+
data["rvid"].replace(rvids, inplace=True)
|
306
|
+
data["rvid2"].replace(rvids, inplace=True)
|
307
|
+
|
308
|
+
# Return the model uncertainties
|
309
|
+
return data
|
310
|
+
|
311
|
+
def get_wind_directions(self) -> dict:
|
312
|
+
"""
|
313
|
+
Obtain a dictionary with HRDWindDirectionIds and Directions
|
314
|
+
|
315
|
+
Returns
|
316
|
+
-------
|
317
|
+
dict
|
318
|
+
A dictionary {HRDWindDirectionId : Direction}
|
319
|
+
"""
|
320
|
+
# Wind directions
|
321
|
+
results = self.con.execute("SELECT * FROM HRDWindDirections").fetchall()
|
322
|
+
|
323
|
+
# Process wind directions such that {wind_id : wind_direction}
|
324
|
+
wind_direction = {wid: wr for wid, wr in results}
|
325
|
+
|
326
|
+
# Return wind direction dictionary
|
327
|
+
return wind_direction
|
328
|
+
|
329
|
+
def get_result_table(self, hrdlocation: Union[str, Settings]) -> pd.DataFrame:
|
330
|
+
"""
|
331
|
+
Function to read the load combinations of a location to a pandas DataFrame
|
332
|
+
|
333
|
+
Parameters
|
334
|
+
----------
|
335
|
+
hrdlocation : Union[str, Settings]
|
336
|
+
HRDLocation
|
337
|
+
|
338
|
+
Returns
|
339
|
+
-------
|
340
|
+
pd.DataFrame
|
341
|
+
A DataFrame with load combinations
|
342
|
+
"""
|
343
|
+
# Obtain HRDLocationId
|
344
|
+
hrdlocationid = self.get_hrdlocation_id(hrdlocation)
|
345
|
+
with DatabaseSettings() as database:
|
346
|
+
ivids = database.get_input_variable_ids()
|
347
|
+
rvids = database.get_result_variable_ids()
|
348
|
+
|
349
|
+
# Obtain all data from the HydroDynamicData table
|
350
|
+
# (HydroDynamicDataId, HRDLocationId, ClosingSituationId, HRDWindDirectionID)
|
351
|
+
query = f"SELECT * FROM HydroDynamicData WHERE HRDLocationId = {hrdlocationid}"
|
352
|
+
hydrodynamicdata = pd.read_sql(query, self.con, index_col="HydroDynamicDataId")
|
353
|
+
|
354
|
+
# Obtain all data from the HydroDynamicInputData table
|
355
|
+
hydrodynamicdataids = ",".join(
|
356
|
+
hydrodynamicdata.index.values.astype(str).tolist()
|
357
|
+
)
|
358
|
+
query = """
|
359
|
+
SELECT ID.HydroDynamicDataId, IV.InputVariableId, ID.Value
|
360
|
+
FROM HydroDynamicInputData ID
|
361
|
+
INNER JOIN HRDInputVariables IV ON ID.HRDInputColumnId = IV.HRDInputColumnId
|
362
|
+
WHERE HydroDynamicDataId IN ({});
|
363
|
+
""".format(hydrodynamicdataids)
|
364
|
+
hydrodynamicinputdata = pd.read_sql(
|
365
|
+
query, self.con, index_col=["HydroDynamicDataId", "InputVariableId"]
|
366
|
+
).unstack()
|
367
|
+
ivcols = [ivids[i] for i in hydrodynamicinputdata.columns.get_level_values(1)]
|
368
|
+
hydrodynamicinputdata.columns = ivcols
|
369
|
+
|
370
|
+
# Obtain all data from the HydroDynamicResultData table
|
371
|
+
query = """
|
372
|
+
SELECT RD.HydroDynamicDataId, RV.ResultVariableId, RD.Value
|
373
|
+
FROM HydroDynamicResultData RD
|
374
|
+
INNER JOIN HRDResultVariables RV ON RD.HRDResultColumnId = RV.HRDResultColumnId
|
375
|
+
WHERE HydroDynamicDataId IN ({});
|
376
|
+
""".format(hydrodynamicdataids)
|
377
|
+
hydrodynamicresultdata = pd.read_sql(
|
378
|
+
query, self.con, index_col=["HydroDynamicDataId", "ResultVariableId"]
|
379
|
+
).unstack()
|
380
|
+
rvcols = [rvids[i] for i in hydrodynamicresultdata.columns.get_level_values(1)]
|
381
|
+
hydrodynamicresultdata.columns = rvcols
|
382
|
+
|
383
|
+
# Merge the three tables
|
384
|
+
results = hydrodynamicdata.join(hydrodynamicinputdata).join(
|
385
|
+
hydrodynamicresultdata
|
386
|
+
)
|
387
|
+
|
388
|
+
# Vervang windrichting
|
389
|
+
windrdict = self.get_wind_directions()
|
390
|
+
for wid, r in windrdict.items():
|
391
|
+
if r == 0.0:
|
392
|
+
windrdict[wid] = 360.0
|
393
|
+
results["Wind direction"] = [
|
394
|
+
windrdict[i] for i in results["HRDWindDirectionId"].array
|
395
|
+
]
|
396
|
+
results.drop(["HRDLocationId", "HRDWindDirectionId"], axis=1, inplace=True)
|
397
|
+
|
398
|
+
# Replace discrete stochasts
|
399
|
+
results.rename(
|
400
|
+
columns={"Wind direction": "r", "ClosingSituationId": "k"}, inplace=True
|
401
|
+
)
|
402
|
+
|
403
|
+
# Move r to the front
|
404
|
+
results.insert(0, "r", results.pop("r"))
|
405
|
+
results.sort_values(by=["k", "r"] + ivcols, inplace=True)
|
406
|
+
|
407
|
+
# Return results
|
408
|
+
return results
|
409
|
+
|
410
|
+
def get_closing_levels_table_europoort(self) -> dict:
|
411
|
+
"""
|
412
|
+
Read the closing levels for the Europoort barrier.
|
413
|
+
|
414
|
+
Returns
|
415
|
+
-------
|
416
|
+
pd.DataFrame
|
417
|
+
A Dataframe with the closing level at sea (m) given r, u, q
|
418
|
+
"""
|
419
|
+
|
420
|
+
# If there is a table called 'Sluitfunctie Europoortkering', use it
|
421
|
+
try:
|
422
|
+
# Read the table
|
423
|
+
table = pd.read_sql(
|
424
|
+
"SELECT * FROM [Sluitfunctie Europoortkering]", con=self.con
|
425
|
+
)
|
426
|
+
|
427
|
+
# Otherwise use the default functions
|
428
|
+
except Exception as e:
|
429
|
+
print(f"{e}: Using default functions")
|
430
|
+
PATH = os.path.join(
|
431
|
+
os.path.split(os.path.dirname(__file__))[0],
|
432
|
+
"data",
|
433
|
+
"statistics",
|
434
|
+
"Sluitpeilen",
|
435
|
+
)
|
436
|
+
if self.get_water_system() in [
|
437
|
+
WaterSystem.RHINE_TIDAL,
|
438
|
+
WaterSystem.EUROPOORT,
|
439
|
+
]:
|
440
|
+
table = pd.read_csv(
|
441
|
+
os.path.join(PATH, "Sluitfunctie Europoortkering Rijn 2017.csv"),
|
442
|
+
delimiter=";",
|
443
|
+
)
|
444
|
+
elif self.get_water_system() == WaterSystem.MEUSE_TIDAL:
|
445
|
+
table = pd.read_csv(
|
446
|
+
os.path.join(PATH, "Sluitfunctie Europoortkering Maas 2017.csv"),
|
447
|
+
delimiter=";",
|
448
|
+
)
|
449
|
+
else:
|
450
|
+
raise (
|
451
|
+
f"[ERROR] No closing levels for water system '{self.get_water_system().name}'."
|
452
|
+
)
|
453
|
+
|
454
|
+
# All columns to lower
|
455
|
+
table.columns = table.columns.str.lower()
|
456
|
+
|
457
|
+
# Rename
|
458
|
+
table.rename(
|
459
|
+
columns={
|
460
|
+
"windrichting": "r",
|
461
|
+
"afvoer": "q",
|
462
|
+
"windsnelheid": "u",
|
463
|
+
"zeewaterstand": "m",
|
464
|
+
},
|
465
|
+
inplace=True,
|
466
|
+
)
|
467
|
+
|
468
|
+
# Return table
|
469
|
+
return table
|
470
|
+
|
471
|
+
def get_closing_levels_table_eastern_scheldt(self):
|
472
|
+
"""
|
473
|
+
Read the closing levels for the Eastern Scheldt barrier.
|
474
|
+
|
475
|
+
Returns
|
476
|
+
-------
|
477
|
+
pd.DataFrame
|
478
|
+
A Dataframe with the closing level (h_rpb), given r, u, m, d, p
|
479
|
+
"""
|
480
|
+
# Read the table from the ClosingCriterionsOSK
|
481
|
+
table = pd.read_sql("SELECT * FROM ClosingCriterionsOSK", con=self.con)
|
482
|
+
|
483
|
+
# Rename the entries
|
484
|
+
table.rename(
|
485
|
+
columns={
|
486
|
+
"WindDirection": "r",
|
487
|
+
"WindSpeed": "u",
|
488
|
+
"WaterLevel": "m",
|
489
|
+
"StormDuration": "d",
|
490
|
+
"PhaseDifference": "p",
|
491
|
+
"WaterLevelRPB": "h_rpb",
|
492
|
+
},
|
493
|
+
inplace=True,
|
494
|
+
)
|
495
|
+
|
496
|
+
# Return table
|
497
|
+
return table
|
498
|
+
|
499
|
+
def get_closing_situations_eastern_scheldt(self) -> dict:
|
500
|
+
"""
|
501
|
+
Read the closing situations from the database (ClosingSituationId : (Description : FailingLocks)).
|
502
|
+
e.g. 1 : ("Reguliere sluiting", 0)
|
503
|
+
|
504
|
+
Only works for the Eastern Scheldt.
|
505
|
+
"""
|
506
|
+
# Check watersystem
|
507
|
+
if self.get_water_system() != WaterSystem.EASTERN_SCHELDT:
|
508
|
+
raise ValueError(
|
509
|
+
"[ERROR] Function can only be called for the Eastern Scheldt"
|
510
|
+
)
|
511
|
+
|
512
|
+
# Read table
|
513
|
+
sql = """
|
514
|
+
SELECT C.ClosingSituationId, T.Description, C.FailingLocks
|
515
|
+
FROM ClosingSituations C
|
516
|
+
INNER JOIN ClosingSituationTypes T ON C.ClosingSituationTypeId = T.ClosingSituationTypeId
|
517
|
+
"""
|
518
|
+
results = self.con.execute(sql).fetchall()
|
519
|
+
|
520
|
+
# Post processing into an dictionary
|
521
|
+
results = {i[0]: (i[1], i[2]) for i in results}
|
522
|
+
|
523
|
+
# Return
|
524
|
+
return results
|
525
|
+
|
526
|
+
def get_result_table_eastern_scheldt(
|
527
|
+
self, hrdlocation: Union[str, Settings]
|
528
|
+
) -> pd.DataFrame:
|
529
|
+
"""
|
530
|
+
Function to export the loadcombinations of a location to a pandas DataFrame
|
531
|
+
|
532
|
+
Parameters
|
533
|
+
----------
|
534
|
+
naam : str
|
535
|
+
Locationname
|
536
|
+
"""
|
537
|
+
# Obtain HRDLocationId
|
538
|
+
hrdlocationid = self.get_hrdlocation_id(hrdlocation)
|
539
|
+
with DatabaseSettings() as database:
|
540
|
+
ivids = database.get_input_variable_ids()
|
541
|
+
rvids = database.get_result_variable_ids()
|
542
|
+
|
543
|
+
# First collect the dataids. Also replace wind direction ids with real ids
|
544
|
+
SQL = """
|
545
|
+
SELECT D.HydraulicLoadId, D.ClosingSituationId, W.Direction AS "Wind direction"
|
546
|
+
FROM HydroDynamicData D
|
547
|
+
INNER JOIN HRDWindDirections W ON D.HRDWindDirectionId=W.HRDWindDirectionId;"""
|
548
|
+
dataids = pd.read_sql(SQL, self.con, index_col="HydraulicLoadId")
|
549
|
+
dataids.rename(
|
550
|
+
columns={"Wind direction": "r", "ClosingSituationId": "k"}, inplace=True
|
551
|
+
)
|
552
|
+
|
553
|
+
# Collect the result data. Replace HRDResultColumnId with variable id's
|
554
|
+
SQL = """
|
555
|
+
SELECT RD.HydraulicLoadId, RV.ResultVariableId, RD.Value
|
556
|
+
FROM HydroDynamicResultData RD
|
557
|
+
INNER JOIN HRDResultVariables RV ON RD.HRDResultColumnId = RV.HRDResultColumnId
|
558
|
+
WHERE HRDLocationId = {};""".format(hrdlocationid)
|
559
|
+
resultdata = pd.read_sql(
|
560
|
+
SQL, self.con, index_col=["HydraulicLoadId", "ResultVariableId"]
|
561
|
+
).unstack()
|
562
|
+
|
563
|
+
# Reduce columnindex to single level index (without 'Value')
|
564
|
+
resultdata.columns = [
|
565
|
+
rvids[rid] for rid in resultdata.columns.get_level_values(1)
|
566
|
+
]
|
567
|
+
|
568
|
+
# Create dictionary for mapping HRDInputColumnId to InputVariableId
|
569
|
+
SQL = """
|
570
|
+
SELECT ID.HydraulicLoadId, IV.InputVariableId, ID.Value
|
571
|
+
FROM HydroDynamicInputData ID
|
572
|
+
INNER JOIN HRDInputVariables IV ON ID.HRDInputColumnId = IV.HRDInputColumnId"""
|
573
|
+
inputdata = pd.read_sql(
|
574
|
+
SQL, self.con, index_col=["HydraulicLoadId", "InputVariableId"]
|
575
|
+
).unstack()
|
576
|
+
|
577
|
+
# Reduce columnindex to single level index (without 'Value')
|
578
|
+
inputdata.columns = [
|
579
|
+
ivids[ivid] for ivid in inputdata.columns.get_level_values(1)
|
580
|
+
]
|
581
|
+
|
582
|
+
# Join data and sort values
|
583
|
+
resultaat = (
|
584
|
+
dataids.join(inputdata).join(resultdata).sort_values(by=["r", "u", "m"])
|
585
|
+
)
|
586
|
+
|
587
|
+
# In the WBI2023 the water levels and waves are in the same table, but have different input variables
|
588
|
+
# Split the water levels and wave results
|
589
|
+
idx = pd.isnull(resultaat["hs"])
|
590
|
+
|
591
|
+
waterlevels = resultaat.loc[idx].dropna(how="all", axis=1)
|
592
|
+
waveconditions = resultaat.loc[~idx].dropna(how="all", axis=1)
|
593
|
+
|
594
|
+
# Replace m_os by m for the water level and m for h for the wave conditions
|
595
|
+
waterlevels.rename(columns={"m_os": "m"}, inplace=True)
|
596
|
+
waveconditions.rename(columns={"m": "h"}, inplace=True)
|
597
|
+
|
598
|
+
return waterlevels, waveconditions
|