meteostat / meteostat-python

Access and analyze historical weather and climate data with Python.
https://dev.meteostat.net/python/
MIT License
437 stars 60 forks source link

Wrong end date in the returned data from Hourly method #106

Closed ArdeoDeo closed 2 years ago

ArdeoDeo commented 2 years ago

Hi,

in the code below I have set the end date to 2021-6-6, but returned data ends on 2020-12-31.

from datetime import datetime
from meteostat import Point, Hourly

start = datetime(2018, 1, 1)
end = datetime(2021, 6, 6)

print(end)

vancouver = Point(49.2497, -123.1193, 70)

data = Hourly(vancouver, start, end)
data = data.fetch()

print(data)

Output:

image

and if I set end date to 2022-6-6, this script will return data ending on 2021-12-31. So it works a bit as if the end date was rounded down with respect to the year.

Interesting is that the problem only affects dates above 2020. For end dates: 2020-6-6, 2019-6-6 and 2018-6-6 script works ok.

Seam8 commented 2 years ago

I have the same behavior when I'am trying to load 4 years history including current 2022 year.

I then have to load the current year separately, in order to merge the two datasets.

clampr commented 2 years ago

Fixed in version 1.6.4