weatherdb 1.2.3__tar.gz → 1.2.5__tar.gz

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 (112) hide show
  1. {weatherdb-1.2.3 → weatherdb-1.2.5}/.gitlab-ci.yml +45 -2
  2. {weatherdb-1.2.3 → weatherdb-1.2.5}/CHANGES.md +14 -0
  3. {weatherdb-1.2.3 → weatherdb-1.2.5}/PKG-INFO +3 -2
  4. weatherdb-1.2.5/weatherdb/_version.py +1 -0
  5. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/cli.py +57 -8
  6. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/config/ConfigParser.py +1 -1
  7. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/station/GroupStation.py +54 -23
  8. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/station/StationBases.py +3 -1
  9. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/station/StationT.py +1 -0
  10. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/stations/GroupStations.py +33 -13
  11. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb.egg-info/PKG-INFO +3 -2
  12. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb.egg-info/SOURCES.txt +1 -0
  13. weatherdb-1.2.5/zenodo.json +57 -0
  14. weatherdb-1.2.3/weatherdb/_version.py +0 -1
  15. {weatherdb-1.2.3 → weatherdb-1.2.5}/.dockerignore +0 -0
  16. {weatherdb-1.2.3 → weatherdb-1.2.5}/.github/workflows/cleanup-cache.yml +0 -0
  17. {weatherdb-1.2.3 → weatherdb-1.2.5}/.github/workflows/python-publish.yml +0 -0
  18. {weatherdb-1.2.3 → weatherdb-1.2.5}/.github/workflows/python-test.yml +0 -0
  19. {weatherdb-1.2.3 → weatherdb-1.2.5}/.gitignore +0 -0
  20. {weatherdb-1.2.3 → weatherdb-1.2.5}/.gitlab/merge_request_templates/new_version.md +0 -0
  21. {weatherdb-1.2.3 → weatherdb-1.2.5}/.readthedocs.yaml +0 -0
  22. {weatherdb-1.2.3 → weatherdb-1.2.5}/LICENSE +0 -0
  23. {weatherdb-1.2.3 → weatherdb-1.2.5}/MANIFEST.in +0 -0
  24. {weatherdb-1.2.3 → weatherdb-1.2.5}/README.md +0 -0
  25. {weatherdb-1.2.3 → weatherdb-1.2.5}/docker/Dockerfile +0 -0
  26. {weatherdb-1.2.3 → weatherdb-1.2.5}/docker/docker-compose.yaml +0 -0
  27. {weatherdb-1.2.3 → weatherdb-1.2.5}/docker/docker-compose_test.yaml +0 -0
  28. {weatherdb-1.2.3 → weatherdb-1.2.5}/docker/start-docker-test.sh +0 -0
  29. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/requirements.txt +0 -0
  30. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/Changelog.md +0 -0
  31. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/License.rst +0 -0
  32. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/Methode.md +0 -0
  33. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/_static/custom.css +0 -0
  34. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/_static/favicon.ico +0 -0
  35. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/_static/logo.png +0 -0
  36. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/api.rst +0 -0
  37. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/cli.rst +0 -0
  38. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.broker.rst +0 -0
  39. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.config.rst +0 -0
  40. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.db.rst +0 -0
  41. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.rst +0 -0
  42. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.station.GroupStation.rst +0 -0
  43. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.station.StationBases.rst +0 -0
  44. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.station.StationET.rst +0 -0
  45. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.station.StationP.rst +0 -0
  46. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.station.StationPD.rst +0 -0
  47. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.station.StationT.rst +0 -0
  48. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.station.rst +0 -0
  49. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.stations.StationsBase.rst +0 -0
  50. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.stations.StationsET.rst +0 -0
  51. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.stations.StationsP.rst +0 -0
  52. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.stations.StationsPD.rst +0 -0
  53. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.stations.StationsT.rst +0 -0
  54. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.stations.rst +0 -0
  55. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/api/weatherdb.utils.rst +0 -0
  56. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/conf.py +0 -0
  57. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/index.rst +0 -0
  58. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/setup/Configuration.md +0 -0
  59. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/setup/Hosting.md +0 -0
  60. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/setup/Install.md +0 -0
  61. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/setup/Quickstart.md +0 -0
  62. {weatherdb-1.2.3 → weatherdb-1.2.5}/docs/source/setup/setup.rst +0 -0
  63. {weatherdb-1.2.3 → weatherdb-1.2.5}/pyproject.toml +0 -0
  64. {weatherdb-1.2.3 → weatherdb-1.2.5}/setup.cfg +0 -0
  65. {weatherdb-1.2.3 → weatherdb-1.2.5}/tests/test-data/DEM/COP-DEM_GLO-30-DGED__2023_1_clipped.tif +0 -0
  66. {weatherdb-1.2.3 → weatherdb-1.2.5}/tests/test-data/DEM/README.md +0 -0
  67. {weatherdb-1.2.3 → weatherdb-1.2.5}/tests/test-data/DEM/eula_F.pdf +0 -0
  68. {weatherdb-1.2.3 → weatherdb-1.2.5}/tests/test-data/regionalisation/DWD-grid_ma_1991_2020_DGM25_clipped.tif +0 -0
  69. {weatherdb-1.2.3 → weatherdb-1.2.5}/tests/test-data/regionalisation/HYRAS_ma_1991_2020_DGM25_clipped.tif +0 -0
  70. {weatherdb-1.2.3 → weatherdb-1.2.5}/tests/test-data/regionalisation/README.md +0 -0
  71. {weatherdb-1.2.3 → weatherdb-1.2.5}/tests/test-data/test-data-config.ini +0 -0
  72. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/__init__.py +0 -0
  73. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/alembic/README.md +0 -0
  74. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/alembic/alembic.ini +0 -0
  75. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/alembic/config.py +0 -0
  76. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/alembic/env.py +0 -0
  77. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/alembic/script.py.mako +0 -0
  78. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/alembic/versions/V1.0.0_initial_database_creation.py +0 -0
  79. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/alembic/versions/V1.0.2_more_charachters_for_settings+term_station_ma_raster.py +0 -0
  80. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/alembic/versions/V1.0.5_fix-ma-raster-values.py +0 -0
  81. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/alembic/versions/V1.0.6_update-views.py +0 -0
  82. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/broker.py +0 -0
  83. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/config/__init__.py +0 -0
  84. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/config/config_default.ini +0 -0
  85. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/db/__init__.py +0 -0
  86. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/db/connections.py +0 -0
  87. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/db/fixtures/RichterParameters.json +0 -0
  88. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/db/models.py +0 -0
  89. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/db/queries/get_quotient.py +0 -0
  90. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/db/views.py +0 -0
  91. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/station/StationET.py +0 -0
  92. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/station/StationP.py +0 -0
  93. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/station/StationPD.py +0 -0
  94. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/station/__init__.py +0 -0
  95. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/station/constants.py +0 -0
  96. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/stations/StationsBase.py +0 -0
  97. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/stations/StationsBaseTET.py +0 -0
  98. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/stations/StationsET.py +0 -0
  99. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/stations/StationsP.py +0 -0
  100. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/stations/StationsPD.py +0 -0
  101. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/stations/StationsT.py +0 -0
  102. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/stations/__init__.py +0 -0
  103. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/utils/TimestampPeriod.py +0 -0
  104. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/utils/__init__.py +0 -0
  105. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/utils/dwd.py +0 -0
  106. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/utils/geometry.py +0 -0
  107. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/utils/get_data.py +0 -0
  108. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb/utils/logging.py +0 -0
  109. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb.egg-info/dependency_links.txt +0 -0
  110. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb.egg-info/entry_points.txt +0 -0
  111. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb.egg-info/requires.txt +0 -0
  112. {weatherdb-1.2.3 → weatherdb-1.2.5}/weatherdb.egg-info/top_level.txt +0 -0
@@ -12,8 +12,9 @@ workflow:
12
12
  test_single:
13
13
  stage: test_single
14
14
  rules:
15
- - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
15
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TAG == null
16
16
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
17
+ - if: $CI_COMMIT_TAG =~ /^[Vv]*\d+\.\d+\.\d+$/
17
18
  image: "python:$PYTHON_VERSION"
18
19
  services:
19
20
  - name: timescale/timescaledb-ha:pg17
@@ -144,4 +145,46 @@ release_gitlab:
144
145
  release:
145
146
  name: '$CI_COMMIT_TAG'
146
147
  tag_name: '$CI_COMMIT_TAG'
147
- description: '$CI_COMMIT_TAG_MESSAGE'
148
+ description: '$CI_COMMIT_TAG_MESSAGE'
149
+
150
+ # deploying to Zenodo
151
+ include:
152
+ - remote: 'https://gitlab.com/deploy2zenodo/deploy2zenodo/-/releases/permalink/latest/downloads/deploy2zenodo.yaml'
153
+
154
+ deploy2zenodo:
155
+ stage: release
156
+ rules:
157
+ - !reference [build, rules]
158
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
159
+ when: never
160
+ - when: manual
161
+ allow_failure: true
162
+ needs:
163
+ - job: release_pypi
164
+ optional: true
165
+ variables:
166
+ DEPLOY2ZENODO_JSON: zenodo.json
167
+ DEPLOY2ZENODO_ADD_IsNewVersionOf: yes
168
+ DEPLOY2ZENODO_GET_METADATA: "result.json"
169
+ before_script:
170
+ - apk add --no-cache curl jq git pandoc
171
+ # pack
172
+ - TAG=$(echo $CI_COMMIT_TAG | cut -d "v" -f 2)
173
+ - if [ -z "$TAG" ]; then echo "TAG is empty, exiting"; exit 1; fi
174
+ - DEPLOY2ZENODO_UPLOAD=v$TAG.zip
175
+ - git archive --format zip --output "$DEPLOY2ZENODO_UPLOAD" $CI_COMMIT_SHA
176
+ # prepare zenodo.json
177
+ - publication_date=$(echo "$CI_COMMIT_TIMESTAMP" | grep -Eo "^[0-9]{4}-[0-9]{2}-[0-9]{2}")
178
+ - pandoc -o README.html README.md
179
+ - tmpjson="$(mktemp)"
180
+ - |
181
+ jq . $DEPLOY2ZENODO_JSON | \
182
+ jq ".metadata.version = \"$TAG\"" | \
183
+ jq ".metadata.publication_date = \"$publication_date\"" | \
184
+ jq --rawfile README README.html '.metadata.description = $README' | \
185
+ jq . | tee "$tmpjson"
186
+ - mv "$tmpjson" "$DEPLOY2ZENODO_JSON"
187
+ artifacts:
188
+ paths:
189
+ - $DEPLOY2ZENODO_JSON
190
+ - $DEPLOY2ZENODO_GET_METADATA
@@ -1,5 +1,19 @@
1
1
  # Change-log
2
2
 
3
+ ## Version 1.2.5
4
+
5
+ - cli updating methods have now additional parameters for stids, period and para to be able to update only a some specific stations
6
+ - fillup: update also Temperature values if the filled_max and filled_min are NULL.
7
+
8
+ ## Version 1.2.4
9
+
10
+ - added Zenodo upload
11
+ - fix problem with creating user config
12
+ - add format placeholders for GroupStations.create_ts for file_names parameter
13
+ - translate Parameter name for Precipitation for create_roger_ts back to german names to work with actual RoGeR version
14
+ - fix problem when create_ts is invoked with a zip file.
15
+ Previously the precipitation timeseries did not get expanded to the last complete date and stopped at 00:00 o'clock
16
+
3
17
  ## Version 1.2.3
4
18
 
5
19
  - fix: dropping stations
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: weatherdb
3
- Version: 1.2.3
3
+ Version: 1.2.5
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
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -714,6 +714,7 @@ Requires-Dist: setuptools_scm
714
714
  Provides-Extra: optionals
715
715
  Requires-Dist: coloredlogs; extra == "optionals"
716
716
  Requires-Dist: colorama; extra == "optionals"
717
+ Dynamic: license-file
717
718
 
718
719
  # WeatherDB - module
719
720
 
@@ -0,0 +1 @@
1
+ __version__ = "1.2.5"
@@ -7,6 +7,43 @@ from textwrap import dedent
7
7
  sys.path.insert(0, Path(__file__).resolve().parent.parent.as_posix())
8
8
  import weatherdb
9
9
 
10
+ # Reusable option decorators
11
+ # ---------------------------------------
12
+
13
+ def period_options(f):
14
+ """Add period options only"""
15
+ f = click.option("--period_from", "-f",
16
+ default=None, show_default=True,
17
+ help="The from timestamp of the period to apply the method on. Timestamp should be in the format YYYY-MM-DD.")(f)
18
+ f = click.option("--period_until", "-u",
19
+ default=None, show_default=True,
20
+ help="The until timestamp of the period to apply the method on. Timestamp should be in the format YYYY-MM-DD.")(f)
21
+ return f
22
+
23
+ def stid_option(f):
24
+ """Add station ID options"""
25
+ f = click.option("--stid", "-i",
26
+ default=["all"], show_default=True, multiple=True,
27
+ callback=lambda ctx, param, value: "all" if "all" in value else [int(v) for v in value],
28
+ help="The station IDs to apply the method to. Options are 'all' or a specific station ID. " +
29
+ "You can enter multiple values to add multiple station IDs.")(f)
30
+ return f
31
+
32
+ def para_options(f):
33
+ """Add parameter options"""
34
+ f = click.option("--para", "-p",
35
+ default=["p", "t", "et"], show_default=True, multiple=True,
36
+ help="The parameters to work with. Options are 'p', 't' and 'et'. " +
37
+ "You can enter multiple values to add multiple parameters.")(f)
38
+ return f
39
+
40
+ def common_update_options(f):
41
+ """Add common options for processing commands (para, stid, period)"""
42
+ f = para_options(f)
43
+ f = stid_option(f)
44
+ f = period_options(f)
45
+ return f
46
+
10
47
  # main cli group
11
48
  # ---------------------------------------
12
49
 
@@ -185,31 +222,43 @@ def update_ma_raster():
185
222
 
186
223
 
187
224
  @cli.command(short_help="Update the raw data of the complete database.")
188
- def update_raw():
225
+ @common_update_options
226
+ def update_raw(para, stid, period_from, period_until):
189
227
  click.echo("starting updating the raw data")
190
228
  broker = weatherdb.broker.Broker()
191
- broker.update_raw()
229
+ broker.update_raw(paras=para,
230
+ stids=stid,
231
+ period=(period_from, period_until))
192
232
 
193
233
 
194
234
  @cli.command(short_help="Do the quality check of the complete database.")
195
- def quality_check():
235
+ @common_update_options
236
+ def quality_check(para, stid, period_from, period_until):
196
237
  click.echo("starting quality check")
197
238
  broker = weatherdb.broker.Broker()
198
- broker.quality_check()
239
+ broker.quality_check(paras=para,
240
+ stids=stid,
241
+ period=(period_from, period_until))
199
242
 
200
243
 
201
244
  @cli.command(short_help="Do the filling of the complete database.")
202
- def fillup():
245
+ @common_update_options
246
+ def fillup(para, stid, period_from, period_until):
203
247
  click.echo("starting filling up")
204
248
  broker = weatherdb.broker.Broker()
205
- broker.fillup()
249
+ broker.fillup(paras=para,
250
+ stids=stid,
251
+ period=(period_from, period_until))
206
252
 
207
253
 
208
254
  @cli.command(short_help="Do the richter correction of the complete database.")
209
- def richter_correct():
255
+ @stid_option
256
+ @period_options
257
+ def richter_correct(stid, period_from, period_until):
210
258
  click.echo("starting richter correction")
211
259
  broker = weatherdb.broker.Broker()
212
- broker.richter_correct()
260
+ broker.richter_correct(stids=stid,
261
+ period=(period_from, period_until))
213
262
 
214
263
 
215
264
  # cli admin stuff
@@ -357,7 +357,7 @@ class ConfigParser(configparser.ConfigParser):
357
357
  user_config_file = "ask"
358
358
 
359
359
  # ask for the user config file
360
- if user_config_file == "ask":
360
+ if user_config_file.lower().strip()[0] == "a":
361
361
  try:
362
362
  from tkinter import Tk
363
363
  from tkinter import filedialog
@@ -344,8 +344,13 @@ class GroupStation(object):
344
344
  def get_name(self):
345
345
  return self.station_parts[0].get_name()
346
346
 
347
- def create_roger_ts(self, dir, period=(None, None),
348
- kind="best", r_r0=1, add_t_min=False, add_t_max=False,
347
+ def create_roger_ts(self,
348
+ dir,
349
+ period=(None, None),
350
+ kind="best",
351
+ r_r0=1,
352
+ add_t_min=False,
353
+ add_t_max=False,
349
354
  do_toolbox_format=False,
350
355
  **kwargs):
351
356
  """Create the timeserie files for roger as csv.
@@ -394,10 +399,15 @@ class GroupStation(object):
394
399
  """
395
400
  if do_toolbox_format:
396
401
  return self.create_ts(
397
- dir=dir, period=period, kinds=kind,
398
- agg_to="10 min", r_r0=r_r0, split_date=True,
402
+ dir=dir,
403
+ period=period,
404
+ kinds=kind,
405
+ agg_to="10 min",
406
+ r_r0=r_r0,
407
+ split_date=True,
399
408
  nas_allowed=False,
400
- add_t_min=add_t_min, add_t_max=add_t_max,
409
+ add_t_min=add_t_min,
410
+ add_t_max=add_t_max,
401
411
  file_names={"P":"PREC.txt", "T":"TA.txt", "ET":"PET.txt"},
402
412
  col_names={"P":"PREC", "ET":"PET",
403
413
  "T":"TA", "T_min":"TA_min", "T_max":"TA_max",
@@ -408,18 +418,34 @@ class GroupStation(object):
408
418
  **kwargs)
409
419
  else:
410
420
  return self.create_ts(
411
- dir=dir, period=period, kinds=kind,
412
- agg_to="10 min", r_r0=r_r0, split_date=True,
421
+ dir=dir,
422
+ period=period,
423
+ kinds=kind,
424
+ agg_to="10 min",
425
+ r_r0=r_r0,
426
+ split_date=True,
413
427
  nas_allowed=False,
414
- add_t_min=add_t_min, add_t_max=add_t_max,
428
+ file_names={"P":"N_{id:0>5}.txt"},
429
+ col_names={"P":"N"},
430
+ add_t_min=add_t_min,
431
+ add_t_max=add_t_max,
415
432
  **kwargs)
416
433
 
417
- def create_ts(self, dir, period=(None, None),
418
- kinds="best", paras="all",
419
- agg_to="10 min", r_r0=None, split_date=False,
420
- nas_allowed=True, add_na_share=False,
421
- add_t_min=False, add_t_max=False,
422
- add_meta=True, file_names={}, col_names={},
434
+ def create_ts(self,
435
+ dir,
436
+ period=(None, None),
437
+ kinds="best",
438
+ paras="all",
439
+ agg_to="10 min",
440
+ r_r0=None,
441
+ split_date=False,
442
+ nas_allowed=True,
443
+ add_na_share=False,
444
+ add_t_min=False,
445
+ add_t_max=False,
446
+ add_meta=True,
447
+ file_names={},
448
+ col_names={},
423
449
  keep_date_parts=False,
424
450
  **kwargs):
425
451
  """Create the timeserie files as csv.
@@ -485,6 +511,7 @@ class GroupStation(object):
485
511
  file_names : dict, optional
486
512
  A dictionary with the file names for the different parameters.
487
513
  e.g.{"P":"PREC.txt", "T":"TA.txt", "ET":"ET.txt"}
514
+ Additionally, the station ID ("{id}" as int) and period ({period} as TimestampPeriod) are available as placeholders.
488
515
  If an empty dictionary is given, then the standard names are used.
489
516
  The default is {}.
490
517
  col_names : dict, optional
@@ -536,19 +563,22 @@ class GroupStation(object):
536
563
  del kwargs["_skip_period_check"]
537
564
 
538
565
  # prepare loop
539
- name_suffix = "_{stid:0>5}.txt".format(stid=self.id)
566
+ name_suffix = "_{id:0>5}.txt".format(id=self.id)
540
567
  x, y = self.get_geom().coords.xy
541
- name = self.get_name() + " (ID: {stid})".format(stid=self.id)
568
+ name = self.get_name() + " (ID: {id})".format(id=self.id)
542
569
  do_zip = isinstance(dir, zipfile.ZipFile)
543
570
 
544
571
  for para in paras:
545
572
  # get the timeserie
546
573
  df = self.get_df(
547
- period=period, kinds=kinds,
548
- paras=[para], agg_to=agg_to,
574
+ period=period,
575
+ kinds=kinds,
576
+ paras=[para],
577
+ agg_to=agg_to,
549
578
  nas_allowed=nas_allowed,
550
579
  add_na_share=add_na_share,
551
- add_t_min=add_t_min, add_t_max=add_t_max,
580
+ add_t_min=add_t_min,
581
+ add_t_max=add_t_max,
552
582
  _skip_period_check=True,
553
583
  **kwargs)
554
584
 
@@ -573,8 +603,7 @@ class GroupStation(object):
573
603
  # check for NAs
574
604
  filled_cols = [col for col in df.columns if "filled_by" in col]
575
605
  if not nas_allowed and df.drop(filled_cols, axis=1).isna().sum().sum() > 0:
576
- warnings.warn("There were NAs in the timeserie for Station {stid}.".format(
577
- stid=self.id))
606
+ warnings.warn(f"There were NAs in the timeseries for Station {self.id}.")
578
607
 
579
608
  # special operations for et
580
609
  if para == "et" and r_r0 is not None:
@@ -609,9 +638,11 @@ class GroupStation(object):
609
638
 
610
639
  # get file name
611
640
  if para.upper() in file_names:
612
- file_name = file_names[para.upper()]
641
+ file_name = file_names[para.upper()]\
642
+ .format(id=self.id, period=period)
613
643
  elif para in file_names:
614
- file_name = file_names[para]
644
+ file_name = file_names[para]\
645
+ .format(id=self.id, period=period)
615
646
  else:
616
647
  file_name = para.upper() + name_suffix
617
648
 
@@ -1447,7 +1447,8 @@ class StationBase:
1447
1447
  {sql_format_dict["extra_exec_cols"].format(i=i)}
1448
1448
  filled_by[{i}]=%1$s
1449
1449
  FROM timeseries.%2$I nb
1450
- WHERE nf.filled IS NULL AND nf.nb_mean[{i}] IS NULL {prev_check}
1450
+ WHERE (nf.filled IS NULL {sql_format_dict["extra_fillup_update_where"]})
1451
+ AND nf.nb_mean[{i}] IS NULL {prev_check}
1451
1452
  AND nf.timestamp = nb.timestamp;"""
1452
1453
  prev_check += f" AND nf.nb_mean[{i}] IS NOT NULL AND nf.filled_by[{i}] != %1$s"
1453
1454
 
@@ -1689,6 +1690,7 @@ class StationBase:
1689
1690
  "extra_fillup_where": "",
1690
1691
  "mul_elev_order": "",
1691
1692
  "extra_exec_cols": "",
1693
+ "extra_fillup_update_where": "",
1692
1694
  "extra_after_loop_extra_col": ""}
1693
1695
 
1694
1696
  @db_engine.deco_update_privilege
@@ -135,6 +135,7 @@ class StationT(StationTETBase):
135
135
  ' OR ts."filled_max" IS DISTINCT FROM new."filled_max"',
136
136
  "extra_exec_cols": "nb_max[{i}]=round(nb.raw_max + %3$s, 0)::int,"+
137
137
  "nb_min[{i}]=round(nb.raw_min + %3$s, 0)::int,",
138
+ "extra_fillup_update_where": ' OR nf."filled_min" IS NULL OR nf."filled_max" IS NULL',
138
139
  "extra_after_loop_extra_col": """,
139
140
  filled_min=(SELECT percentile_cont(0.5) WITHIN GROUP (ORDER BY v)
140
141
  FROM unnest(nb_min) as T(v)),
@@ -293,10 +293,17 @@ class GroupStations(object):
293
293
 
294
294
  return stations
295
295
 
296
- def create_ts(self, dir, period=(None, None), kinds="best",
297
- stids="all", agg_to="10 min", r_r0=None, split_date=False,
298
- nas_allowed=True, add_na_share=False,
299
- add_t_min=False, add_t_max=False,
296
+ def create_ts(self, dir,
297
+ period=(None, None),
298
+ kinds="best",
299
+ stids="all",
300
+ agg_to="10 min",
301
+ r_r0=None,
302
+ split_date=False,
303
+ nas_allowed=True,
304
+ add_na_share=False,
305
+ add_t_min=False,
306
+ add_t_max=False,
300
307
  **kwargs):
301
308
  """Download and create the weather tables as csv files.
302
309
 
@@ -393,7 +400,6 @@ class GroupStations(object):
393
400
  add_na_share=add_na_share,
394
401
  add_t_min=add_t_min,
395
402
  add_t_max=add_t_max,
396
- _skip_period_check=True,
397
403
  **kwargs)
398
404
  pbar.variables["last_station"] = stat.id
399
405
  pbar.update(pbar.value + 1)
@@ -498,10 +504,16 @@ class GroupStations(object):
498
504
  """
499
505
  if do_toolbox_format:
500
506
  return self.create_ts(
501
- dir=dir, period=period, kinds=kind,
502
- agg_to="10 min", r_r0=r_r0, stids=stids,
503
- split_date=True, nas_allowed=False,
504
- add_t_min=add_t_min, add_t_max=add_t_max,
507
+ dir=dir,
508
+ period=period,
509
+ kinds=kind,
510
+ agg_to="10 min",
511
+ r_r0=r_r0,
512
+ stids=stids,
513
+ split_date=True,
514
+ nas_allowed=False,
515
+ add_t_min=add_t_min,
516
+ add_t_max=add_t_max,
505
517
  file_names={"P":"PREC.txt", "T":"TA.txt", "ET":"PET.txt"},
506
518
  col_names={"P":"PREC", "ET":"PET",
507
519
  "T":"TA", "T_min":"TA_min", "T_max":"TA_max",
@@ -512,8 +524,16 @@ class GroupStations(object):
512
524
  **kwargs)
513
525
  else:
514
526
  return self.create_ts(
515
- dir=dir, period=period, kinds=kind,
516
- agg_to="10 min", r_r0=r_r0, stids=stids,
517
- split_date=True, nas_allowed=False,
518
- add_t_min=add_t_min, add_t_max=add_t_max,
527
+ dir=dir,
528
+ period=period,
529
+ kinds=kind,
530
+ agg_to="10 min",
531
+ r_r0=r_r0,
532
+ stids=stids,
533
+ split_date=True,
534
+ nas_allowed=False,
535
+ file_names={"P": "N_{id:0>5}.txt"},
536
+ col_names={"P":"N"},
537
+ add_t_min=add_t_min,
538
+ add_t_max=add_t_max,
519
539
  **kwargs)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: weatherdb
3
- Version: 1.2.3
3
+ Version: 1.2.5
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
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -714,6 +714,7 @@ Requires-Dist: setuptools_scm
714
714
  Provides-Extra: optionals
715
715
  Requires-Dist: coloredlogs; extra == "optionals"
716
716
  Requires-Dist: colorama; extra == "optionals"
717
+ Dynamic: license-file
717
718
 
718
719
  # WeatherDB - module
719
720
 
@@ -7,6 +7,7 @@ LICENSE
7
7
  MANIFEST.in
8
8
  README.md
9
9
  pyproject.toml
10
+ zenodo.json
10
11
  .github/workflows/cleanup-cache.yml
11
12
  .github/workflows/python-publish.yml
12
13
  .github/workflows/python-test.yml
@@ -0,0 +1,57 @@
1
+ {
2
+ "metadata":{
3
+ "creators":[
4
+ {
5
+ "name": "Schmit, Max",
6
+ "affiliation": "University of Freiburg",
7
+ "orcid": "0000-0002-0712-4116"
8
+ }
9
+ ],
10
+ "contributors":[
11
+ {
12
+ "name": "Weiler, Markus",
13
+ "affiliation": "University of Freiburg",
14
+ "orcid": "0000-0001-6245-6917",
15
+ "type": "Supervisor"
16
+ }
17
+ ],
18
+ "license": {"id":"GPL-3.0-or-later"},
19
+ "title": "WeatherDB",
20
+ "version": "***",
21
+ "publication_date": "***",
22
+ "upload_type":"software",
23
+ "related_identifiers": [
24
+ {
25
+ "relation": "cites",
26
+ "identifier": "10.5281/zenodo.10066044",
27
+ "resource_type": "dataset"
28
+ },
29
+ {
30
+ "relation": "requires",
31
+ "identifier": "https://opendata.dwd.de/climate_environment/CDC/",
32
+ "resource_type": "dataset"
33
+ }
34
+ ],
35
+ "references": [
36
+ "DWD Climate Data Center (CDC): Historical daily station observations (temperature, pressure, precipitation, sunshine duration, etc.) for Germany, version v21.3, 2021, online available: https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/daily/kl/historical/",
37
+ "DWD Climate Data Center (CDC): Recent daily station observations (temperature, pressure, precipitation, sunshine duration, etc.) for Germany, quality control not completed yet, version recent, online available: https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/daily/kl/recent/",
38
+ "DWD Climate Data Center: Berechnete historische Tageswerte von charakteristischen Elementen aus dem Boden und dem Pflanzenbestand, historic values, Version v2, parameter \"VPGFAO\" online available: https://opendata.dwd.de/climate_environment/CDC/derived_germany/soil/daily/historical/",
39
+ "DWD Climate Data Center: Berechnete historische Tageswerte von charakteristischen Elementen aus dem Boden und dem Pflanzenbestand, recent values, Version v2, parameter \"VPGFAO\", online available: https://opendata.dwd.de/climate_environment/CDC/derived_germany/soil/daily/recent/",
40
+ "DWD Climate Data Center (CDC): Historical 10-minute station observations of precipitation for Germany, version V1, 2019, online available: https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/10_minutes/precipitation/historical/",
41
+ "DWD Climate Data Center (CDC): Recent 10-minute station observations of precipitation for Germany,version recent, 2019, online available: https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/10_minutes/precipitation/recent",
42
+ "DWD Climate Data Center (CDC): Historical daily station observations (temperature, pressure, precipitation, sunshine duration, etc.) for Germany, version v21.3, 2021, online available: https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/daily/kl/historical/",
43
+ "DWD Climate Data Center (CDC): Recent daily station observations (temperature, pressure, precipitation, sunshine duration, etc.) for Germany, quality control not completed yet, version recent, online available: https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/daily/kl/recent/",
44
+ "Schmit, M., & Weiler, M. (2023). German weather services (DWD) multi annual meteorological rasters for the climate period 1991-2020 refined to 25m grid (1.0.0) [Data set]. Zenodo. DOI:10.5281/zenodo.10066045",
45
+ "Richter, D. 1995. Ergebnisse methodischer Untersuchungen zur Korrektur des systematischen Meßfehlers des Hellmann-Niederschlagsmessers. Offenbach am Main: Selbstverl. des Dt. Wetterdienstes.",
46
+ "Copernicus. 2016. European Digital Elevation Model (EU-DEM), version 1.1. online available: https://land.copernicus.eu/imagery-in-situ/eu-dem/eu-dem-v1.1",
47
+ "Stoelzle, Michael & Weiler, Markus & Steinbrich, Andreas. (2016) Starkregengefährdung in Baden-Württemberg – von der Methodenentwicklung zur Starkregenkartierung. Tag der Hydrologie.",
48
+ "LARSIM Dokumentation, Stand 06.04.2023, online available: https://www.larsim.info/dokumentation/LARSIM-Dokumentation.pdf"
49
+ ],
50
+ "subjects": [
51
+ {"term": "Meteorology", "identifier": "mesh:D055904"},
52
+ {"term": "Meteorology", "identifier": "euroscivoc:281"},
53
+ {"term": "Meteorology", "identifier": "gemet:concept/5197"}
54
+ ],
55
+ "language": "eng"
56
+ }
57
+ }
@@ -1 +0,0 @@
1
- __version__ = "1.2.3"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes