weatherdb 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. docker/Dockerfile +30 -0
  2. docker/docker-compose.yaml +58 -0
  3. docker/docker-compose_test.yaml +24 -0
  4. docker/start-docker-test.sh +6 -0
  5. docs/requirements.txt +10 -0
  6. docs/source/Changelog.md +2 -0
  7. docs/source/License.rst +7 -0
  8. docs/source/Methode.md +161 -0
  9. docs/source/_static/custom.css +8 -0
  10. docs/source/_static/favicon.ico +0 -0
  11. docs/source/_static/logo.png +0 -0
  12. docs/source/api/api.rst +15 -0
  13. docs/source/api/cli.rst +8 -0
  14. docs/source/api/weatherDB.broker.rst +10 -0
  15. docs/source/api/weatherDB.config.rst +7 -0
  16. docs/source/api/weatherDB.db.rst +23 -0
  17. docs/source/api/weatherDB.rst +22 -0
  18. docs/source/api/weatherDB.station.rst +56 -0
  19. docs/source/api/weatherDB.stations.rst +46 -0
  20. docs/source/api/weatherDB.utils.rst +22 -0
  21. docs/source/conf.py +137 -0
  22. docs/source/index.rst +33 -0
  23. docs/source/setup/Configuration.md +127 -0
  24. docs/source/setup/Hosting.md +9 -0
  25. docs/source/setup/Install.md +49 -0
  26. docs/source/setup/Quickstart.md +183 -0
  27. docs/source/setup/setup.rst +12 -0
  28. weatherdb/__init__.py +24 -0
  29. weatherdb/_version.py +1 -0
  30. weatherdb/alembic/README.md +8 -0
  31. weatherdb/alembic/alembic.ini +80 -0
  32. weatherdb/alembic/config.py +9 -0
  33. weatherdb/alembic/env.py +100 -0
  34. weatherdb/alembic/script.py.mako +26 -0
  35. weatherdb/alembic/versions/V1.0.0_initial_database_creation.py +898 -0
  36. weatherdb/alembic/versions/V1.0.2_more_charachters_for_settings+term_station_ma_raster.py +88 -0
  37. weatherdb/alembic/versions/V1.0.5_fix-ma-raster-values.py +152 -0
  38. weatherdb/alembic/versions/V1.0.6_update-views.py +22 -0
  39. weatherdb/broker.py +667 -0
  40. weatherdb/cli.py +214 -0
  41. weatherdb/config/ConfigParser.py +663 -0
  42. weatherdb/config/__init__.py +5 -0
  43. weatherdb/config/config_default.ini +162 -0
  44. weatherdb/db/__init__.py +3 -0
  45. weatherdb/db/connections.py +374 -0
  46. weatherdb/db/fixtures/RichterParameters.json +34 -0
  47. weatherdb/db/models.py +402 -0
  48. weatherdb/db/queries/get_quotient.py +155 -0
  49. weatherdb/db/views.py +165 -0
  50. weatherdb/station/GroupStation.py +710 -0
  51. weatherdb/station/StationBases.py +3108 -0
  52. weatherdb/station/StationET.py +111 -0
  53. weatherdb/station/StationP.py +807 -0
  54. weatherdb/station/StationPD.py +98 -0
  55. weatherdb/station/StationT.py +164 -0
  56. weatherdb/station/__init__.py +13 -0
  57. weatherdb/station/constants.py +21 -0
  58. weatherdb/stations/GroupStations.py +519 -0
  59. weatherdb/stations/StationsBase.py +1021 -0
  60. weatherdb/stations/StationsBaseTET.py +30 -0
  61. weatherdb/stations/StationsET.py +17 -0
  62. weatherdb/stations/StationsP.py +128 -0
  63. weatherdb/stations/StationsPD.py +24 -0
  64. weatherdb/stations/StationsT.py +21 -0
  65. weatherdb/stations/__init__.py +11 -0
  66. weatherdb/utils/TimestampPeriod.py +369 -0
  67. weatherdb/utils/__init__.py +3 -0
  68. weatherdb/utils/dwd.py +350 -0
  69. weatherdb/utils/geometry.py +69 -0
  70. weatherdb/utils/get_data.py +285 -0
  71. weatherdb/utils/logging.py +126 -0
  72. weatherdb-1.1.0.dist-info/LICENSE +674 -0
  73. weatherdb-1.1.0.dist-info/METADATA +765 -0
  74. weatherdb-1.1.0.dist-info/RECORD +77 -0
  75. weatherdb-1.1.0.dist-info/WHEEL +5 -0
  76. weatherdb-1.1.0.dist-info/entry_points.txt +2 -0
  77. weatherdb-1.1.0.dist-info/top_level.txt +3 -0
@@ -0,0 +1,88 @@
1
+ """more characters for settings and term column in station_ma_raster
2
+
3
+ Revision ID: V1.0.2
4
+ Revises: V1.0.0
5
+ Create Date: 2024-11-06 14:33:30.129005
6
+
7
+ """
8
+ from typing import Sequence, Union
9
+
10
+ from alembic import op
11
+ import sqlalchemy as sa
12
+
13
+
14
+ # revision identifiers, used by Alembic.
15
+ revision: str = 'V1.0.2'
16
+ down_revision: Union[str, None] = 'V1.0.0'
17
+ branch_labels: Union[str, Sequence[str], None] = None
18
+ depends_on: Union[str, Sequence[str], None] = None
19
+
20
+
21
+ def upgrade() -> None:
22
+ op.alter_column('settings', 'value',
23
+ existing_type=sa.VARCHAR(length=20),
24
+ type_=sa.String(length=60),
25
+ existing_comment='The value of the setting',
26
+ existing_nullable=False)
27
+
28
+ op.execute(sa.text("DROP VIEW IF EXISTS station_ma_quotient_view CASCADE;"))
29
+ op.drop_constraint("station_ma_raster_pkey", "station_ma_raster")
30
+ op.add_column(
31
+ 'station_ma_raster',
32
+ sa.Column('term',
33
+ sa.VARCHAR(length=4),
34
+ nullable=False,
35
+ server_default='year',
36
+ comment="The term of the raster. e.g. 'year', 'wihy', 'suhy'"))
37
+ op.alter_column('station_ma_raster', 'value',
38
+ existing_type=sa.INTEGER(),
39
+ comment='The value of the raster for the station in the database unit.',
40
+ existing_comment='The value of the raster for the station.',
41
+ existing_nullable=False)
42
+ op.execute(sa.text(
43
+ """
44
+ UPDATE public."station_ma_raster"
45
+ SET
46
+ term= split_part("parameter", '_', 2),
47
+ parameter= split_part("parameter", '_', 1)
48
+ WHERE parameter LIKE '%\\_%';
49
+ """))
50
+ op.alter_column(
51
+ 'station_ma_raster', 'term',
52
+ existing_server_default="fill", server_default=None)
53
+ op.alter_column('station_ma_raster', 'parameter',
54
+ existing_type=sa.VARCHAR(length=7),
55
+ type_=sa.VARCHAR(length=3),
56
+ comment="The parameter of the raster. e.g. 'p', 't', 'et'",
57
+ existing_comment="The parameter of the raster. e.g. 'p_wihj', 'p_sohj', 'p_year', 't_year', 'et_year'",
58
+ existing_nullable=False)
59
+ op.create_primary_key("station_ma_raster_pkey", "station_ma_raster", ["station_id", "parameter", "raster_key", "term"])
60
+
61
+ def downgrade() -> None:
62
+ op.alter_column('settings', 'value',
63
+ existing_type=sa.String(length=60),
64
+ type_=sa.VARCHAR(length=20),
65
+ existing_comment='The value of the setting',
66
+ existing_nullable=False)
67
+
68
+ op.execute(sa.text("DROP VIEW IF EXISTS station_ma_timeseries_quotient_view CASCADE;"))
69
+ op.drop_constraint("station_ma_raster_pkey", "station_ma_raster")
70
+ op.alter_column('station_ma_raster', 'parameter',
71
+ existing_type=sa.VARCHAR(length=3),
72
+ type_=sa.VARCHAR(length=7),
73
+ comment="The parameter of the raster. e.g. 'p_wihj', 'p_sohj', 'p_year', 't_year', 'et_year'",
74
+ existing_comment="The parameter of the raster. e.g. 'p', 't', 'et'",
75
+ existing_nullable=False)
76
+ op.alter_column('station_ma_raster', 'value',
77
+ existing_type=sa.INTEGER(),
78
+ comment='The value of the raster for the station.',
79
+ existing_comment='The value of the raster for the station in the database unit.',
80
+ existing_nullable=False)
81
+ op.execute(sa.text(
82
+ """
83
+ UPDATE public."station_ma_raster"
84
+ SET "parameter" = "parameter"||'_'||"term"
85
+ WHERE parameter NOT LIKE '%\\_%';
86
+ """))
87
+ op.drop_column('station_ma_raster', 'term')
88
+ op.create_primary_key("station_ma_raster_pkey", "station_ma_raster", ["station_id", "raster_key", "parameter"])
@@ -0,0 +1,152 @@
1
+ """Remove station_ma_raster values because they were faulty.
2
+ rename droped to dropped
3
+
4
+ Revision ID: V1.0.5
5
+ Revises: V1.0.2
6
+ Create Date: 2024-12-06 14:33:30.129005
7
+
8
+ """
9
+ from typing import Sequence, Union
10
+
11
+ from alembic import op
12
+ import sqlalchemy as sa
13
+
14
+
15
+ # revision identifiers, used by Alembic.
16
+ revision: str = 'V1.0.5'
17
+ down_revision: Union[str, None] = 'V1.0.2'
18
+ branch_labels: Union[str, Sequence[str], None] = None
19
+ depends_on: Union[str, Sequence[str], None] = None
20
+
21
+
22
+ def upgrade() -> None:
23
+ op.execute(sa.text(
24
+ """
25
+ DELETE FROM station_ma_raster
26
+ WHERE True;
27
+ """))
28
+
29
+ op.rename_table('droped_stations', 'dropped_stations')
30
+ op.alter_column('dropped_stations', 'station_id',
31
+ existing_type=sa.INTEGER(),
32
+ comment='The station id that got dropped',
33
+ existing_comment='The station id that got droped',
34
+ existing_nullable=False)
35
+ op.alter_column('dropped_stations', 'parameter',
36
+ existing_type=sa.VARCHAR(length=3),
37
+ comment='The parameter (p,t,et,p_d) of the station that got dropped',
38
+ existing_comment='The parameter (n,t,et,p_d) of the station that got droped',
39
+ existing_nullable=False)
40
+ op.alter_column('dropped_stations', 'why',
41
+ existing_type=sa.TEXT(),
42
+ comment='The reason why the station got dropped',
43
+ existing_comment='The reason why the station got droped',
44
+ existing_nullable=False)
45
+ op.alter_column('dropped_stations', 'timestamp',
46
+ existing_type=sa.TIMESTAMP(),
47
+ comment='The timestamp when the station got dropped',
48
+ existing_comment='The timestamp when the station got droped',
49
+ existing_nullable=False,
50
+ existing_server_default=sa.text('now()'))
51
+ op.create_table_comment(
52
+ 'dropped_stations',
53
+ 'This table is there to save the station ids that got dropped, so they wont GET recreated',
54
+ existing_comment='This table is there to save the station ids that got droped, so they wont GET recreated',
55
+ schema=None
56
+ )
57
+
58
+ op.alter_column('parameter_variables', 'parameter',
59
+ existing_type=sa.VARCHAR(length=3),
60
+ comment='The parameter for which the variables are valid. e.g. p/p_d/t/et.',
61
+ existing_comment='The parameter for which the variables are valid. e.g. n/p_d/t/et.',
62
+ existing_nullable=False)
63
+
64
+ op.alter_column('raw_files', 'parameter',
65
+ existing_type=sa.VARCHAR(length=3),
66
+ comment='The parameter that got downloaded for this file. e.g. t, et, p_d, p',
67
+ existing_comment='The parameter that got downloaded for this file. e.g. t, et, p_d, n',
68
+ existing_nullable=False)
69
+
70
+ op.alter_column('meta_et', 'qc_droped',
71
+ new_column_name='qc_dropped',
72
+ existing_type=sa.Float(),
73
+ nullable=True,
74
+ comment='The percentage of dropped values during the quality check')
75
+ op.alter_column('meta_p', 'qc_droped',
76
+ new_column_name='qc_dropped',
77
+ existing_type=sa.Float(),
78
+ nullable=True,
79
+ comment='The percentage of dropped values during the quality check')
80
+ op.alter_column('meta_t', 'qc_droped',
81
+ new_column_name='qc_dropped',
82
+ existing_type=sa.Float(),
83
+ nullable=True,
84
+ comment='The percentage of dropped values during the quality check')
85
+
86
+ op.execute(sa.text("DROP VIEW IF EXISTS station_ma_timeseries_quotient_view CASCADE;"))
87
+
88
+ def downgrade() -> None:
89
+ op.execute(sa.text(
90
+ """
91
+ DELETE FROM station_ma_raster
92
+ WHERE True;
93
+ """))
94
+
95
+ op.alter_column('raw_files', 'parameter',
96
+ existing_type=sa.VARCHAR(length=3),
97
+ comment='The parameter that got downloaded for this file. e.g. t, et, p_d, n',
98
+ existing_comment='The parameter that got downloaded for this file. e.g. t, et, p_d, p',
99
+ existing_nullable=False)
100
+
101
+ op.alter_column('parameter_variables', 'parameter',
102
+ existing_type=sa.VARCHAR(length=3),
103
+ comment='The parameter for which the variables are valid. e.g. n/p_d/t/et.',
104
+ existing_comment='The parameter for which the variables are valid. e.g. p/p_d/t/et.',
105
+ existing_nullable=False)
106
+
107
+ op.create_table_comment(
108
+ 'dropped_stations',
109
+ 'This table is there to save the station ids that got droped, so they wont GET recreated',
110
+ existing_comment='This table is there to save the station ids that got dropped, so they wont GET recreated',
111
+ schema=None
112
+ )
113
+ op.alter_column('dropped_stations', 'timestamp',
114
+ existing_type=sa.TIMESTAMP(),
115
+ comment='The timestamp when the station got droped',
116
+ existing_comment='The timestamp when the station got dropped',
117
+ existing_nullable=False,
118
+ existing_server_default=sa.text('now()'))
119
+ op.alter_column('dropped_stations', 'why',
120
+ existing_type=sa.TEXT(),
121
+ comment='The reason why the station got droped',
122
+ existing_comment='The reason why the station got dropped',
123
+ existing_nullable=False)
124
+ op.alter_column('dropped_stations', 'parameter',
125
+ existing_type=sa.VARCHAR(length=3),
126
+ comment='The parameter (n,t,et,p_d) of the station that got droped',
127
+ existing_comment='The parameter (p,t,et,p_d) of the station that got dropped',
128
+ existing_nullable=False)
129
+ op.alter_column('dropped_stations', 'station_id',
130
+ existing_type=sa.INTEGER(),
131
+ comment='The station id that got droped',
132
+ existing_comment='The station id that got dropped',
133
+ existing_nullable=False)
134
+ op.rename_table('dropped_stations', 'droped_stations')
135
+
136
+ op.alter_column('meta_t', 'qc_dropped',
137
+ new_column_name='qc_droped',
138
+ existing_type=sa.Float(),
139
+ nullable=True,
140
+ comment='The percentage of dropped values during the quality check')
141
+ op.alter_column('meta_p', 'qc_dropped',
142
+ new_column_name='qc_droped',
143
+ existing_type=sa.Float(),
144
+ nullable=True,
145
+ comment='The percentage of dropped values during the quality check')
146
+ op.alter_column('meta_et', 'qc_dropped',
147
+ new_column_name='qc_droped',
148
+ existing_type=sa.Float(),
149
+ nullable=True,
150
+ comment='The percentage of dropped values during the quality check')
151
+
152
+ op.execute(sa.text("DROP VIEW IF EXISTS station_ma_timeseries_raster_quotient_view CASCADE;"))
@@ -0,0 +1,22 @@
1
+ """Rebew the views
2
+
3
+ Revision ID: V1.0.6
4
+ Revises: V1.0.5
5
+ Create Date: 2024-12-06 14:33:30.129005
6
+
7
+ """
8
+ from typing import Sequence, Union
9
+
10
+
11
+ # revision identifiers, used by Alembic.
12
+ revision: str = 'V1.0.6'
13
+ down_revision: Union[str, None] = 'V1.0.5'
14
+ branch_labels: Union[str, Sequence[str], None] = None
15
+ depends_on: Union[str, Sequence[str], None] = None
16
+
17
+
18
+ def upgrade() -> None:
19
+ pass
20
+
21
+ def downgrade() -> None:
22
+ pass