Skip to content

Parameters start_date and end_date not working as expected. #859

@TheAnalystx

Description

@TheAnalystx

Describe the bug
Parameters start_date and end_date not working as expected. They don't return stations data even tough there should be data available.

To Reproduce

import pytz
from datetime import datetime, timezone, timedelta
from wetterdienst.provider.dwd.observation import DwdObservationRequest, DwdObservationDataset, \
    DwdObservationResolution, DwdObservationPeriod
now = datetime.now(tz=pytz.timezone('Europe/Berlin')).astimezone(tz=timezone.utc)
r = DwdObservationRequest(
            parameter=[
                DwdObservationDataset.TEMPERATURE_AIR,
                DwdObservationDataset.WIND,
                DwdObservationDataset.PRECIPITATION
            ],
            resolution=DwdObservationResolution.MINUTE_10,
            period=DwdObservationPeriod.NOW,
            start_date=now - timedelta(minutes=360),  # <- comment out and it works
            end_date=now  # <- comment out and it works
        )
# search weather for coordinates:
wernigerode = {'latitude': 51.8395648304923, 'longitude': 10.780834955884814}
station = r.filter_by_rank(rank=1, latlon=(wernigerode['latitude'], wernigerode['longitude']))
assert not station.values.all().df.empty, 'empty dataframe found'  # <- error

You can see that data is available for the specific interval if you comment out start_date and end_date.

Expected behavior
Should return data for only the time frame specified.

Desktop (please complete the following information):

  • OS: [Windows]
  • Python-Version [3.9]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions