Skip to content

Commit

Permalink
[Breaking] Use start_date and end_date instead of from_date and to_date
Browse files Browse the repository at this point in the history
  • Loading branch information
gutzbenj committed Nov 8, 2023
1 parent 036fc99 commit 5ca8463
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
22 changes: 11 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -373,17 +373,17 @@ Library
... ).filter_by_station_id(station_id=(1048, 4411))
>>> stations = request.df
>>> stations.head()
┌────────────┬──────────────┬──────────────┬────────┬─────────────────────┬─────────────┬─────────┐
│ station_id ┆ start_date ┆ end_date ┆ heightlatitudelongitude ┆ name ┆ state │
------------------ ------
str ┆ datetime[μs, ┆ datetime[μs, ┆ f64 ┆ f64 ┆ f64 strstr
│ ┆ UTC] ┆ UTC] ┆ ┆ ┆ │
╞════════════╪══════════════╪══════════════╪════════╪═════════════════════╪═════════════╪═════════╡
010481934-01-01... 228.051.127813.7543 ┆ Dresden-Klo ┆ Sachsen │
│ ┆ 00:00:00 UTC00:00:00 UTC ┆ tzsche ┆ │
044111979-12-01... 155.049.91958.9672 ┆ Schaafheim- ┆ Hessen │
│ ┆ 00:00:00 UTC00:00:00 UTC ┆ Schlierbach ┆ │
└────────────┴──────────────┴──────────────┴────────┴─────────────────────┴─────────────┴─────────┘
┌────────────┬──────────────┬──────────────┬──────────┬───────────────────┬─────────────┬─────────┐
│ station_id ┆ start_date ┆ end_date ┆ latitudelongitudeheight ┆ name ┆ state │
------------ --- ---------
str ┆ datetime[μs, ┆ datetime[μs, ┆ f64 ┆ f64 ┆ f64 ┆ strstr
│ ┆ UTC] ┆ UTC] ┆ ┆ ┆ │
╞════════════╪══════════════╪══════════════╪══════════╪═══════════════════╪═════════════╪═════════╡
010481934-01-012023-11-07 51.127813.7543 228.0 ┆ Dresden-Klo ┆ Sachsen │
│ ┆ 00:00:00 UTC00:00:00 UTC ┆ tzsche ┆ │
044111979-12-012023-11-07 49.91958.9672 155.0 ┆ Schaafheim- ┆ Hessen │
│ ┆ 00:00:00 UTC00:00:00 UTC ┆ Schlierbach ┆ │
└────────────┴──────────────┴──────────────┴──────────┴───────────────────┴─────────────┴─────────┘
>>> values = request.values.all().df
>>> values.head()
┌────────────┬─────────────────┬───────────────────┬─────────────────────────┬───────┬─────────┐
Expand Down
10 changes: 5 additions & 5 deletions tests/core/timeseries/test_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,29 @@ def expected_stations_df():
(
"02480",
dt.datetime(2004, 9, 1, tzinfo=ZoneInfo("UTC")),
108.0,
50.0643,
8.993,
108.0,
"Kahl/Main",
"Bayern",
9.759384982994229,
),
(
"04411",
dt.datetime(2002, 1, 24, tzinfo=ZoneInfo("UTC")),
155.0,
49.9195,
8.9672,
155.0,
"Schaafheim-Schlierbach",
"Hessen",
10.160326,
),
(
"07341",
dt.datetime(2005, 7, 16, tzinfo=ZoneInfo("UTC")),
119.0,
50.0900,
8.7862,
119.0,
"Offenbach-Wetterpark",
"Hessen",
12.891318342515483,
Expand All @@ -54,9 +54,9 @@ def expected_stations_df():
schema={
"station_id": pl.Utf8,
"start_date": pl.Datetime(time_zone="UTC"),
"height": pl.Float64,
"latitude": pl.Float64,
"longitude": pl.Float64,
"height": pl.Float64,
"name": pl.Utf8,
"state": pl.Utf8,
"distance": pl.Float64,
Expand Down Expand Up @@ -296,7 +296,7 @@ def test_dwd_observation_stations_filter_by_rank_single(default_request, expecte
given_df = request.df.drop(columns="end_date")
assert_frame_equal(given_df[0, :], expected_stations_df[0, :])
values = request.values.all()
assert_frame_equal(values.df_stations[0, :].drop(columns="end_date"), expected_stations_df[0, :])
assert_frame_equal(values.df_stations.head(1).drop(columns="end_date"), expected_stations_df.head(1))


@pytest.mark.remote
Expand Down
4 changes: 2 additions & 2 deletions tests/provider/dwd/observation/test_api_stations.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def expected_df():
"station_id": ["00001"],
"start_date": [dt.datetime(1937, 1, 1, tzinfo=ZoneInfo("UTC"))],
"end_date": [dt.datetime(1986, 6, 30, tzinfo=ZoneInfo("UTC"))],
"height": [478.0],
"latitude": [47.8413],
"longitude": [8.8493],
"height": [478.0],
"name": ["Aach"],
"state": ["Baden-Württemberg"],
}
Expand Down Expand Up @@ -110,9 +110,9 @@ def test_dwd_observations_stations_minute_1(default_settings):
"station_id": "00003",
"start_date": dt.datetime(1891, 1, 1, tzinfo=ZoneInfo("UTC")),
"end_date": dt.datetime(2012, 4, 6, tzinfo=ZoneInfo("UTC")),
"height": 202.0,
"latitude": 50.7827,
"longitude": 6.0941,
"height": 202.0,
"name": "Aachen",
"state": "Nordrhein-Westfalen",
}
Expand Down
2 changes: 1 addition & 1 deletion wetterdienst/core/timeseries/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ def _values(self):
Columns.STATION_ID.value,
Columns.START_DATE.value,
Columns.END_DATE.value,
Columns.HEIGHT.value,
Columns.LATITUDE.value,
Columns.LONGITUDE.value,
Columns.HEIGHT.value,
Columns.NAME.value,
Columns.STATE.value,
)
Expand Down
2 changes: 1 addition & 1 deletion wetterdienst/provider/dwd/dmo/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1339,9 +1339,9 @@ def _setup_resolution_filter(cls, resolution):
Columns.ICAO_ID.value,
Columns.START_DATE.value,
Columns.END_DATE.value,
Columns.HEIGHT.value,
Columns.LATITUDE.value,
Columns.LONGITUDE.value,
Columns.HEIGHT.value,
Columns.NAME.value,
Columns.STATE.value,
]
Expand Down

0 comments on commit 5ca8463

Please sign in to comment.