weatherdb 1.2.1__py3-none-any.whl → 1.2.3__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.
@@ -38,11 +38,13 @@ services:
38
38
  target: /src/tests
39
39
 
40
40
  db:
41
- image: postgis/postgis:16-3.4
41
+ image: timescale/timescaledb-ha:pg17 # about 1 minute faster for tests
42
+ # image: postgis/postgis:17-3.4
42
43
  environment:
43
44
  POSTGRES_DB: weatherdb
44
45
  POSTGRES_USER: postgres
45
46
  POSTGRES_PASSWORD_FILE: /run/secrets/db_password
47
+ shm_size: '2g'
46
48
  ports:
47
49
  - 5454:5432
48
50
  volumes:
weatherdb/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.2.1"
1
+ __version__ = "1.2.3"
weatherdb/cli.py CHANGED
@@ -76,7 +76,8 @@ def upgrade_db_schema(revision):
76
76
 
77
77
  @cli.command(short_help="Create User configuration file.")
78
78
  @click.option('--file', '-f',
79
- type=click.Path(), default="ask", show_default=True,
79
+ type=click.Path(resolve_path=True, dir_okay=False, file_okay=True),
80
+ default="ask", show_default=True,
80
81
  help="The file to save the user configuration to.")
81
82
  @click.option('--on-exists', '-e',
82
83
  type=str, default="ask", show_default=True,
@@ -36,11 +36,24 @@ class ConfigParser(configparser.ConfigParser):
36
36
  self._user_listeners = []
37
37
 
38
38
  # read the configuration files
39
- self.read(self._DEFAULT_CONFIG_FILE)
39
+ self.read(self._DEFAULT_CONFIG_FILE, encoding="utf-8")
40
40
  self._read_main_config()
41
41
  self.load_user_config(raise_undefined_error=False)
42
42
  self.load_environment_variables()
43
43
 
44
+ def read(self, filenames, encoding="utf-8"):
45
+ """Read and parse a list of filenames.
46
+
47
+ Parameters
48
+ ----------
49
+ filenames : list or str
50
+ A list of filenames or a single filename to read.
51
+ encoding : str, optional
52
+ The encoding of the file.
53
+ The default is None.
54
+ """
55
+ super().read(filenames=filenames, encoding=encoding)
56
+
44
57
  def add_listener(self, section, option, callback):
45
58
  """Add a callback function to be called when a configuration option is changed.
46
59
 
@@ -163,7 +163,7 @@ class GroupStation(object):
163
163
  The default is True.
164
164
  paras : list of str or str, optional
165
165
  Give the parameters for which to get the meta information.
166
- Can be "n", "t", "et" or "all".
166
+ Can be "p", "t", "et" or "all".
167
167
  If "all", then every available station parameter is returned.
168
168
  The default is "all"
169
169
  add_na_share : bool, optional
@@ -298,7 +298,7 @@ class GroupStation(object):
298
298
  ----------
299
299
  paras : list of str or str, optional
300
300
  Give the parameters for which to get the meta information.
301
- Can be "n", "t", "et" or "all".
301
+ Can be "p", "t", "et" or "all".
302
302
  If "all", then every available station parameter is returned.
303
303
  The default is "all"
304
304
  **kwargs : dict, optional
@@ -398,8 +398,8 @@ class GroupStation(object):
398
398
  agg_to="10 min", r_r0=r_r0, split_date=True,
399
399
  nas_allowed=False,
400
400
  add_t_min=add_t_min, add_t_max=add_t_max,
401
- file_names={"N":"PREC.txt", "T":"TA.txt", "ET":"PET.txt"},
402
- col_names={"N":"PREC", "ET":"PET",
401
+ file_names={"P":"PREC.txt", "T":"TA.txt", "ET":"PET.txt"},
402
+ col_names={"P":"PREC", "ET":"PET",
403
403
  "T":"TA", "T_min":"TA_min", "T_max":"TA_max",
404
404
  "Jahr":"YYYY", "Monat":"MM", "Tag":"DD",
405
405
  "Stunde":"hh", "Minute":"mm"},
@@ -443,7 +443,7 @@ class GroupStation(object):
443
443
  If only one kind is asked for, then the columns get renamed to only have the parameter name as column name.
444
444
  paras : list of str or str, optional
445
445
  Give the parameters for which to get the meta information.
446
- Can be "n", "t", "et" or "all".
446
+ Can be "p", "t", "et" or "all".
447
447
  If "all", then every available station parameter is returned.
448
448
  The default is "all"
449
449
  agg_to : str, optional
@@ -484,12 +484,12 @@ class GroupStation(object):
484
484
  The default is True.
485
485
  file_names : dict, optional
486
486
  A dictionary with the file names for the different parameters.
487
- e.g.{"N":"PREC.txt", "T":"TA.txt", "ET":"ET.txt"}
487
+ e.g.{"P":"PREC.txt", "T":"TA.txt", "ET":"ET.txt"}
488
488
  If an empty dictionary is given, then the standard names are used.
489
489
  The default is {}.
490
490
  col_names : dict, optional
491
491
  A dictionary with the column names for the different parameters.
492
- e.g.{"N":"PREC", "T":"TA", "ET":"ET", "Jahr":"YYYY", "Monat":"MM", "Tag":"DD", "Stunde":"HH", "Minute":"MN"}
492
+ e.g.{"P":"PREC", "T":"TA", "ET":"ET", "Jahr":"YYYY", "Monat":"MM", "Tag":"DD", "Stunde":"HH", "Minute":"MN"}
493
493
  If an empty dictionary is given, then the standard names are used.
494
494
  The default is {}.
495
495
  keep_date_parts : bool, optional
@@ -595,7 +595,7 @@ class StationBase:
595
595
  DROP TABLE IF EXISTS timeseries."{self.id}_{self._para}";
596
596
  DELETE FROM meta_{self._para} WHERE station_id={self.id};
597
597
  DELETE FROM station_ma_raster WHERE station_id={self.id} and parameter='{self._para}';
598
- DELETE FROM station_ma_timeseries WHERE station_id={self.id} and parameter='{self._para}';
598
+ DELETE FROM station_ma_timeserie WHERE station_id={self.id} and parameter='{self._para}';
599
599
  INSERT INTO dropped_stations(station_id, parameter, why, timestamp)
600
600
  VALUES ('{self.id}', '{self._para}', '{why}', NOW())
601
601
  ON CONFLICT (station_id, parameter)
@@ -240,8 +240,8 @@ class StationP(StationPBase):
240
240
  @db_engine.deco_create_privilege
241
241
  def _create_timeseries_table(self):
242
242
  """Create the timeseries table in the DB if it is not yet existing."""
243
- sql_add_table = '''
244
- CREATE TABLE IF NOT EXISTS timeseries."{stid}_{para}" (
243
+ sql_add_table = f'''
244
+ CREATE TABLE IF NOT EXISTS timeseries."{self.id}_{self._para}" (
245
245
  timestamp timestamp PRIMARY KEY,
246
246
  raw int4,
247
247
  qn smallint,
@@ -250,7 +250,7 @@ class StationP(StationPBase):
250
250
  filled_by int2,
251
251
  corr int4
252
252
  );
253
- '''.format(stid=self.id, para=self._para)
253
+ '''
254
254
  with db_engine.connect() as con:
255
255
  con.execute(sqltxt(sql_add_table))
256
256
  con.commit()
@@ -46,7 +46,7 @@ class GroupStations(object):
46
46
  if isinstance(paras, str) and paras != "all":
47
47
  paras = [paras,]
48
48
 
49
- valid_paras=["n", "t", "et"]
49
+ valid_paras=["p", "t", "et"]
50
50
  if isinstance(paras, str) and (paras == "all"):
51
51
  return valid_paras
52
52
  else:
@@ -502,8 +502,8 @@ class GroupStations(object):
502
502
  agg_to="10 min", r_r0=r_r0, stids=stids,
503
503
  split_date=True, nas_allowed=False,
504
504
  add_t_min=add_t_min, add_t_max=add_t_max,
505
- file_names={"N":"PREC.txt", "T":"TA.txt", "ET":"PET.txt"},
506
- col_names={"N":"PREC", "ET":"PET",
505
+ file_names={"P":"PREC.txt", "T":"TA.txt", "ET":"PET.txt"},
506
+ col_names={"P":"PREC", "ET":"PET",
507
507
  "T":"TA", "T_min":"TA_min", "T_max":"TA_max",
508
508
  "Jahr":"YYYY", "Monat":"MM", "Tag":"DD",
509
509
  "Stunde":"hh", "Minute":"mm"},
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: weatherdb
3
- Version: 1.2.1
3
+ Version: 1.2.3
4
4
  Summary: This is a package to work with and to create the Weather Database which handles, checks, fills and corrects DWD Weather Station data.
5
5
  Author-email: Max Schmit <max.schmit@hydrology.uni-freiburg.de>
6
- License: GNU GENERAL PUBLIC LICENSE
6
+ License: GNU GENERAL PUBLIC LICENSE
7
7
  Version 3, 29 June 2007
8
8
 
9
9
  Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
@@ -706,11 +706,11 @@ Requires-Dist: GeoAlchemy2
706
706
  Requires-Dist: alembic
707
707
  Requires-Dist: requests
708
708
  Requires-Dist: keyring
709
+ Requires-Dist: keyrings.alt; sys_platform == "linux"
709
710
  Requires-Dist: rasterstats
710
711
  Requires-Dist: click
711
712
  Requires-Dist: setuptools>=61.0
712
- Requires-Dist: setuptools-scm
713
- Requires-Dist: keyrings.alt; sys_platform == "linux"
713
+ Requires-Dist: setuptools_scm
714
714
  Provides-Extra: optionals
715
715
  Requires-Dist: coloredlogs; extra == "optionals"
716
716
  Requires-Dist: colorama; extra == "optionals"
@@ -1,5 +1,5 @@
1
1
  docker/Dockerfile,sha256=AmSjZsQHA3-XANZz8RiH0B5skIlF7MXCNiy8yIzZXr4,1051
2
- docker/docker-compose.yaml,sha256=ezHqCUib83b5cbfbSy0fsrg0xl2iufp6diItsctJbRM,1719
2
+ docker/docker-compose.yaml,sha256=tnQoCLZk1VryR4i1x7TfV8B4nODGoD1Qaf6CWoj6hOs,1815
3
3
  docker/docker-compose_test.yaml,sha256=LTCehPG6Oid-ri7kcPBMzXzeJBqYC-zXTs_i6XOkSyQ,931
4
4
  docker/start-docker-test.sh,sha256=8ue4LfoUrZU8inEZhNjsSDqucoN73Kn1cC3--lUPqTo,222
5
5
  docs/requirements.txt,sha256=gVqMWeiE0PAEz41NGrLwgzx1WUGuEIE7sfPLkFV4vU4,141
@@ -44,9 +44,9 @@ tests/test-data/regionalisation/DWD-grid_ma_1991_2020_DGM25_clipped.tif,sha256=8
44
44
  tests/test-data/regionalisation/HYRAS_ma_1991_2020_DGM25_clipped.tif,sha256=HiSmi715dUpryQ1WSLSXR7GmGPHzK0rl6WOOrwjRwXw,2116377
45
45
  tests/test-data/regionalisation/README.md,sha256=equFOPJVaESGKIK1ZPVEJHY4TEqkW3NpJOFQzjsBy7M,151
46
46
  weatherdb/__init__.py,sha256=2BzziScTYzA65WS6nhtCRZOWSLfwHTCwvZdeyuHw79U,846
47
- weatherdb/_version.py,sha256=aFv1WGaOhOg9bRuL25OuA7ozD3PSckRRpjaC84FZ7uo,21
47
+ weatherdb/_version.py,sha256=U41WxbUOaQODXvEF16YxLPUtPZSDo9xzI0NA0DgmjLs,21
48
48
  weatherdb/broker.py,sha256=qJaKVwo1zcTLKmP-sF_DMod6_7jVsdHEoiKEMvsPx9A,24842
49
- weatherdb/cli.py,sha256=oZFQVteBjxI1tEK37CEO-8mJd9PQ7I-rHEI-kIl4T_A,11295
49
+ weatherdb/cli.py,sha256=b5p9SRP5aqQ3w89MLErAjFj37aZMy9OsF23nCDC8NJY,11358
50
50
  weatherdb/alembic/README.md,sha256=6hq24TPr8z3nqJCaqrmj6__kLikVG66kLGqfC_aFPWQ,440
51
51
  weatherdb/alembic/alembic.ini,sha256=Mc3-qkQfA42ApX9douZT77g1pWE9gn4oMVJEDoebmdQ,3087
52
52
  weatherdb/alembic/config.py,sha256=Q4aolMUUT7f6VmbY0uz_dWBtKkj3KgTUs_xOY_Gbzjw,264
@@ -56,7 +56,7 @@ weatherdb/alembic/versions/V1.0.0_initial_database_creation.py,sha256=Ztj21xNdJc
56
56
  weatherdb/alembic/versions/V1.0.2_more_charachters_for_settings+term_station_ma_raster.py,sha256=jrnBpgUxjaBt1oUFJb0PeTZ4L5hEDh9K8ncF33cLdQE,3738
57
57
  weatherdb/alembic/versions/V1.0.5_fix-ma-raster-values.py,sha256=EvJ_JLLJKUN5YXwWZdS1FHK2oHjhIlayvjtJuoK3eCI,6957
58
58
  weatherdb/alembic/versions/V1.0.6_update-views.py,sha256=ZA7cK5yeAqivFG2V8O7mvyKSkGRlphVOs0qKpBYgYKE,420
59
- weatherdb/config/ConfigParser.py,sha256=UEJlpeZSggG93C3MjpaNGpqKe_Ks6Jg6g5CjnhKCrpY,27978
59
+ weatherdb/config/ConfigParser.py,sha256=-ubnKwzUR9ryrPI_6aYULmyyaNzz4-TylPgHs3yoq4I,28403
60
60
  weatherdb/config/__init__.py,sha256=JBNlYPT43JnO8XMI8HTtg2hyA7C_JnMdtWmJ2vAtNZ8,85
61
61
  weatherdb/config/config_default.ini,sha256=5DQzOqOJ9EVRAu9IA_EO4c8aqnuUvTmocwidOhLLXbY,7884
62
62
  weatherdb/db/__init__.py,sha256=g6F66XR6UPz41kPtSRc1qvDoOEZ5OawYxYtYXCgZ06s,76
@@ -65,15 +65,15 @@ weatherdb/db/models.py,sha256=6Oor07T1sAD6qEtoxwEcpmY1SkLVVONChXIIcTjbUk4,15242
65
65
  weatherdb/db/views.py,sha256=DxY_IIonmiiRM-IhQrUMLwj12gIg6Q30rQAmR3wP3BE,6359
66
66
  weatherdb/db/fixtures/RichterParameters.json,sha256=CKxrB5FBX_BRKqxegXNyNtn9DUKmgibUtdvHoE8E5JI,836
67
67
  weatherdb/db/queries/get_quotient.py,sha256=9wVFmXE8tk8igGj-Xk5uSI0eiF_PQ9d-yRq7RJpvMAA,6787
68
- weatherdb/station/GroupStation.py,sha256=XAovs-zK5mZmJuvNJ3iCgpWH-1yWHL0axtygYu1mVi0,30292
69
- weatherdb/station/StationBases.py,sha256=1XylC_k2ZCSJf3-xs4SBE-JSfwrlZWzn1N154S0KzgU,130330
68
+ weatherdb/station/GroupStation.py,sha256=mLDZIQ2fAxSQs_zQl1cFJgOHizVlTyUG1uoEzm6uYqo,30292
69
+ weatherdb/station/StationBases.py,sha256=0OwEl85220DI6MIffjf4KpS4UA5zCR4yE2DNzydOlKE,130329
70
70
  weatherdb/station/StationET.py,sha256=hM6K8fCLC6mOLaE4cN92LHOyPGP01ifO6l2qO77I_bA,3621
71
- weatherdb/station/StationP.py,sha256=ENmWqEFwKR1WFsWmZ8-webEGTmrxODan8QO0gwIDDIU,32719
71
+ weatherdb/station/StationP.py,sha256=w_0l5cw8zTACIbmVFV4cdPwxuyP2Cnv97dnNrMElBDE,32691
72
72
  weatherdb/station/StationPD.py,sha256=Bcg_uQTgIQPffsMGhNEwKAXhYs1Ii4VeB75afdFG-Kk,3367
73
73
  weatherdb/station/StationT.py,sha256=-T1GKfUsvulm5c_-JufJ34H048fGlG21UF0_2z1dd9A,6012
74
74
  weatherdb/station/__init__.py,sha256=v1sPfmhhLRMOr5DJ2c5BLIFY7GWkP5iMLA5vtZm-osg,591
75
75
  weatherdb/station/constants.py,sha256=vtdhgcK8A2cJaknT6qI8w5tAh_Hb5i2SvxxtHZOPyVc,511
76
- weatherdb/stations/GroupStations.py,sha256=442gPqx0lKcOaqThffNIhJqrmDMI37DX1d_EHsfJzvM,21569
76
+ weatherdb/stations/GroupStations.py,sha256=5Xc5lW_crJdzMwldpbyalIFYbyQm2BPiGbl-VrXZZh8,21569
77
77
  weatherdb/stations/StationsBase.py,sha256=M7VyWJgUmIygJ2rByQy0Zz6RKsaDVT8-iaXzhPTa_b4,42991
78
78
  weatherdb/stations/StationsBaseTET.py,sha256=CuE5gXAF4eS4bHorI-sUqksm0jdj9SzAiOHtc4vv7aA,1032
79
79
  weatherdb/stations/StationsET.py,sha256=OjyEaEK0nPJ9txRfUbHfW9bEEx5HAISWmnk5F4GBs7I,433
@@ -87,9 +87,9 @@ weatherdb/utils/dwd.py,sha256=amEVVPLzXTSScBP5VAK35dBxuiy-Ua4hHyKnDGxD_4Q,12394
87
87
  weatherdb/utils/geometry.py,sha256=Od-RDAW1MASVAsGBXpHti9osbVJDqUbumSKBSJPbQqc,1823
88
88
  weatherdb/utils/get_data.py,sha256=62wV37fuzGhC2fLSCL7JyyMd3BAiRiimIhV95-mEROU,17294
89
89
  weatherdb/utils/logging.py,sha256=iaWnzCdBYxFmzWgLq9a6VAeBMdwy-rnt2d9PSAQq4lA,4242
90
- weatherdb-1.2.1.dist-info/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
91
- weatherdb-1.2.1.dist-info/METADATA,sha256=5auMHq9HFkOsckfAF-JKxImQ3v-a93_lm023SiGsTMk,44266
92
- weatherdb-1.2.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
93
- weatherdb-1.2.1.dist-info/entry_points.txt,sha256=kJemTd9Cm_QWPZt03KUWhpn1aB0-l_5ce6Ms3EoS_NM,55
94
- weatherdb-1.2.1.dist-info/top_level.txt,sha256=kLlRbXLn0GHvMWmciWRyvm0-FYEy56F6d0fGwfle9-g,28
95
- weatherdb-1.2.1.dist-info/RECORD,,
90
+ weatherdb-1.2.3.dist-info/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
91
+ weatherdb-1.2.3.dist-info/METADATA,sha256=Jza3CvJAIPtiQvlVeBM_NyRmw5XbjxUgFIZucFwaDIo,44286
92
+ weatherdb-1.2.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
93
+ weatherdb-1.2.3.dist-info/entry_points.txt,sha256=kJemTd9Cm_QWPZt03KUWhpn1aB0-l_5ce6Ms3EoS_NM,55
94
+ weatherdb-1.2.3.dist-info/top_level.txt,sha256=kLlRbXLn0GHvMWmciWRyvm0-FYEy56F6d0fGwfle9-g,28
95
+ weatherdb-1.2.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.1)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5