Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
gutzbenj committed Dec 3, 2024
1 parent ba92107 commit eb9ab59
Show file tree
Hide file tree
Showing 107 changed files with 789 additions and 882 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Development
***********

- Add support for Python 3.13 and deprecate Python 3.9
- [Breaking] Add new metadata model
- Rename `parameter` to `parameters`

0.97.0 (06.10.2024)
*******************
Expand Down
37 changes: 17 additions & 20 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,13 @@ Library
... ts_si_units=True # convert values to SI units
... )
>>> request = DwdObservationRequest(
... parameter="climate_summary",
... resolution="daily",
... start_date="1990-01-01", # if not given timezone defaulted to UTC
... end_date="2020-01-01", # if not given timezone defaulted to UTC
... parameters=[
... ("daily", "climate_summary", "precipitation_height"),
... ],
... start_date="2002-08-11", # if not given timezone defaulted to UTC
... end_date="2002-08-13", # if not given timezone defaulted to UTC
... settings=settings
... ).filter_by_station_id(station_id=(1048, 4411))
... ).filter_by_station_id(station_id=(5779, ))
>>> stations = request.df
>>> stations.head()
┌────────────┬──────────────┬──────────────┬──────────┬───────────┬────────┬─────────────┬─────────┐
Expand All @@ -278,24 +279,20 @@ Library
str ┆ datetime[μs, ┆ datetime[μs, ┆ f64 ┆ f64 ┆ f64 ┆ strstr
│ ┆ UTC] ┆ UTC] ┆ ┆ ┆ ┆ ┆ │
╞════════════╪══════════════╪══════════════╪══════════╪═══════════╪════════╪═════════════╪═════════╡
010481934-01-01...51.127813.7543228.0 ┆ Dresden-Klo ┆ Sachsen │
│ ┆ 00:00:00 UTC00:00:00 UTC ┆ ┆ ┆ ┆ tzsche ┆ │
044111979-12-01...49.91958.9672155.0 ┆ Schaafheim- ┆ Hessen │
│ ┆ 00:00:00 UTC00:00:00 UTC ┆ ┆ ┆ ┆ Schlierbach ┆ │
057791971-01-012024-12-0150.731313.7516877.0 ┆ Zinnwald-Ge ┆ Sachsen │
│ ┆ 00:00:00 UTC00:00:00 UTC ┆ ┆ ┆ ┆ orgenfeld ┆ │
└────────────┴──────────────┴──────────────┴──────────┴───────────┴────────┴─────────────┴─────────┘
>>> values = request.values.all().df
>>> values.head()
┌────────────┬─────────────────┬───────────────────┬─────────────────────────┬───────┬─────────┐
│ station_id ┆ dataset ┆ parameter ┆ date ┆ value ┆ quality │
------------------
strstrstr ┆ datetime[μs, UTC] ┆ f64 ┆ f64 │
╞════════════╪═════════════════╪═══════════════════╪═════════════════════════╪═══════╪═════════╡
01048 ┆ climate_summary ┆ cloud_cover_total ┆ 1990-01-01 00:00:00 UTC100.010.0
01048 ┆ climate_summary ┆ cloud_cover_total ┆ 1990-01-02 00:00:00 UTC100.010.0
01048 ┆ climate_summary ┆ cloud_cover_total ┆ 1990-01-03 00:00:00 UTC91.2510.0
01048 ┆ climate_summary ┆ cloud_cover_total ┆ 1990-01-04 00:00:00 UTC28.7510.0
01048 ┆ climate_summary ┆ cloud_cover_total ┆ 1990-01-05 00:00:00 UTC91.2510.0
└────────────┴─────────────────┴───────────────────┴─────────────────────────┴───────┴─────────┘
┌────────────┬─────────────────┬──────────────────────┬─────────────────────────┬───────┬─────────┐
│ station_id ┆ dataset ┆ parameter ┆ date ┆ value ┆ quality │
------------------
strstrstr ┆ datetime[μs, UTC] ┆ f64 ┆ f64 │
╞════════════╪═════════════════╪══════════════════════╪═════════════════════════╪═══════╪═════════╡
05779 ┆ climate_summary ┆ precipitation_height ┆ 2002-08-11 00:00:00 UTC67.910.0
05779 ┆ climate_summary ┆ precipitation_height ┆ 2002-08-12 00:00:00 UTC312.010.0
05779 ┆ climate_summary ┆ precipitation_height ┆ 2002-08-13 00:00:00 UTC26.310.0
└────────────┴─────────────────┴──────────────────────┴─────────────────────────┴───────┴─────────┘
.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def request_weather_data(
end_date: dt.datetime,
):
stations = DwdObservationRequest(
parameter=parameter,
parameters=parameter,
resolution="hourly",
start_date=start_date,
end_date=end_date,
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/interpolation_over_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

def get_interpolated_df(parameter: str, start_date: datetime, end_date: datetime) -> pl.DataFrame:
stations = DwdObservationRequest(
parameter=parameter,
parameters=parameter,
resolution=DwdObservationResolution.HOURLY,
start_date=start_date,
end_date=end_date,
Expand All @@ -30,7 +30,7 @@ def get_interpolated_df(parameter: str, start_date: datetime, end_date: datetime

def get_regular_df(parameter: str, start_date: datetime, end_date: datetime, exclude_stations: list) -> pl.DataFrame:
stations = DwdObservationRequest(
parameter=parameter,
parameters=parameter,
resolution=DwdObservationResolution.HOURLY,
start_date=start_date,
end_date=end_date,
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/interpolation_precipitation_difference.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

def get_interpolated_df(start_date: datetime, end_date: datetime) -> pl.DataFrame:
stations = DwdObservationRequest(
parameter=Parameter.PRECIPITATION_HEIGHT,
parameters=Parameter.PRECIPITATION_HEIGHT,
resolution=DwdObservationResolution.DAILY,
start_date=start_date,
end_date=end_date,
Expand All @@ -25,7 +25,7 @@ def get_interpolated_df(start_date: datetime, end_date: datetime) -> pl.DataFram

def get_regular_df(start_date: datetime, end_date: datetime, exclude_stations: list) -> pl.DataFrame:
stations = DwdObservationRequest(
parameter=Parameter.PRECIPITATION_HEIGHT.name,
parameters=Parameter.PRECIPITATION_HEIGHT.name,
resolution=DwdObservationResolution.DAILY,
start_date=start_date,
end_date=end_date,
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/summary_over_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

def get_summarized_df(start_date: datetime, end_date: datetime, lat, lon) -> pl.DataFrame:
stations = DwdObservationRequest(
parameter=Parameter.TEMPERATURE_AIR_MEAN_2M,
parameters=Parameter.TEMPERATURE_AIR_MEAN_2M,
resolution=DwdObservationResolution.DAILY,
start_date=start_date,
end_date=end_date,
Expand All @@ -25,7 +25,7 @@ def get_summarized_df(start_date: datetime, end_date: datetime, lat, lon) -> pl.

def get_regular_df(start_date: datetime, end_date: datetime, station_id) -> pl.DataFrame:
stations = DwdObservationRequest(
parameter=Parameter.TEMPERATURE_AIR_MEAN_2M,
parameters=Parameter.TEMPERATURE_AIR_MEAN_2M,
resolution=DwdObservationResolution.DAILY,
start_date=start_date,
end_date=end_date,
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/dwd/road/minute_15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Metadata
Datasets
********

Road_weather
============
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/ea/hydrology/daily.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Metadata
Datasets
********

Daily
=====
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/ea/hydrology/hour_6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Metadata
Datasets
********

Hour_6
======
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/ea/hydrology/minute_15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Metadata
Datasets
********

Minute_15
=========
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/eaufrance/hubeau/dynamic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Metadata
Datasets
********

Dynamic
=======
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/eccc/observation/annual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Annual
======
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/eccc/observation/daily.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Daily
=====
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/eccc/observation/hourly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Hourly
======
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/eccc/observation/monthly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Monthly
=======
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/geosphere/observation/daily.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Daily
=====
Data
====

Metadata
--------
Expand Down
6 changes: 2 additions & 4 deletions docs/data/coverage/geosphere/observation/hourly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Hourly
======
Data
====

Metadata
--------
Expand All @@ -37,8 +37,6 @@ Metadata
* - description
- Historical hourly station observations of 2m air temperature and humidity for Germany

.. _hourly dataset description:

Parameters
----------

Expand Down
6 changes: 2 additions & 4 deletions docs/data/coverage/geosphere/observation/minute_10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Minute_10
=========
Data
====

Metadata
--------
Expand All @@ -37,8 +37,6 @@ Metadata
* - description
- historical 10 minute data

.. _minute_10 dataset description:

Parameters
----------

Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/geosphere/observation/monthly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Monthly
=======
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/imgw/meteorology/monthly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Climate
=======
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/noaa/ghcn/daily.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Daily
=====
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/noaa/ghcn/hourly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Hourly
======
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/nws/observation/hourly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Metadata
Datasets
********

Hourly
======
Data
====

Metadata
--------
Expand Down
4 changes: 2 additions & 2 deletions docs/data/coverage/wsv/pegel/dynamic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Metadata
Datasets
********

Dynamic
=======
Data
====

Metadata
--------
Expand Down
8 changes: 4 additions & 4 deletions examples/notebooks/wetterdienst_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
},
"source": [
"request = DwdObservationRequest(\n",
" parameter=DwdObservationDataset.PRECIPITATION_MORE,\n",
" parameters=DwdObservationDataset.PRECIPITATION_MORE,\n",
" resolution=DwdObservationResolution.DAILY,\n",
" period=DwdObservationPeriod.HISTORICAL,\n",
").all()\n",
Expand Down Expand Up @@ -259,7 +259,7 @@
"source": [
"values = (\n",
" DwdObservationRequest(\n",
" parameter=DwdObservationDataset.PRECIPITATION_MORE,\n",
" parameters=DwdObservationDataset.PRECIPITATION_MORE,\n",
" resolution=DwdObservationResolution.DAILY,\n",
" period=DwdObservationPeriod.HISTORICAL,\n",
" )\n",
Expand Down Expand Up @@ -297,7 +297,7 @@
"]\n",
"values = (\n",
" DwdObservationRequest(\n",
" parameter=parameters,\n",
" parameters=parameters,\n",
" resolution=DwdObservationResolution.DAILY,\n",
" period=DwdObservationPeriod.HISTORICAL,\n",
" )\n",
Expand Down Expand Up @@ -422,7 +422,7 @@
},
"source": [
"request = DwdObservationRequest(\n",
" parameter=DwdObservationParameter.DAILY.CLIMATE_SUMMARY.TEMPERATURE_AIR_MEAN_2M,\n",
" parameters=DwdObservationParameter.DAILY.CLIMATE_SUMMARY.TEMPERATURE_AIR_MEAN_2M,\n",
" resolution=DwdObservationResolution.DAILY,\n",
" period=DwdObservationPeriod.HISTORICAL,\n",
" start_date=\"1930-01-01\",\n",
Expand Down
Loading

0 comments on commit eb9ab59

Please sign in to comment.