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

No "tsun" values and month values for Jan., Feb. 2023 #120

Closed karumbis closed 5 months ago

karumbis commented 1 year ago

Dear all.

First of all, thanks for this very nice Python library!

I have found two issues:

  1. In the period between last year and now, there are no "tsun" values.
  2. For January and February 2023, there are no values when using 'Monthly'.

Thanks in advance for some help.

Code

# Import Meteostat library and dependencies
from datetime import datetime
import matplotlib.pyplot as plt
from meteostat import Point, Daily, Monthly, Hourly

# Set time period
start = datetime(2022, 1,  1)
end   = datetime(2023, 3,  1)

# Create Point
location = Point(43.2508325, 5.4258028, 286) 

data = Hourly(location, start, end)
data = data.fetch()
print(data)

data = Daily(location, start, end)
data = data.fetch()
print(data)

data = Monthly(location, start, end)
data = data.fetch()
print(data)

Output

                     temp  dwpt  rhum  prcp  snow   wdir  wspd  wpgt    pres  tsun  coco
time                                                                                    
2022-01-01 00:00:00   8.3   7.4  94.0   0.0   0.0    0.0   0.0   9.0  1025.6   NaN   5.0
2022-01-01 01:00:00   7.7   6.6  93.0   0.0   NaN  200.0   5.4  11.1  1025.4   NaN   5.0
2022-01-01 02:00:00   9.2   6.5  83.0   0.0   NaN  160.0   5.4  13.0  1025.6   NaN   5.0
2022-01-01 03:00:00   7.1   5.6  90.0   0.0   0.0   40.0  13.0   8.0  1025.4   NaN   5.0
2022-01-01 04:00:00   8.0   6.0  87.0   0.0   NaN  110.0   3.6  11.1  1025.4   NaN   5.0
...                   ...   ...   ...   ...   ...    ...   ...   ...     ...   ...   ...
2023-02-28 20:00:00   5.9   0.9  70.0   0.0   NaN  339.0  23.8  22.2  1015.6   NaN   3.0
2023-02-28 21:00:00   5.4   1.1  74.0   0.0   NaN  350.0  22.3  20.4  1015.5   NaN   3.0
2023-02-28 22:00:00   5.1   1.6  78.0   0.0   NaN    8.0  21.2  20.4  1015.6   NaN   3.0
2023-02-28 23:00:00   5.3   2.1  80.0   0.0   NaN  358.0  20.9  20.4  1015.7   NaN   3.0
2023-03-01 00:00:00   5.2   2.4  82.0   0.0   NaN  345.0  23.0  18.5  1015.3   NaN   3.0

[10177 rows x 11 columns]
            tavg  tmin  tmax  prcp  snow   wdir  wspd   wpgt    pres  tsun
time                                                                      
2022-01-01   9.4   6.7  12.8   0.0   NaN  232.0   4.7   24.1  1026.6   NaN
2022-01-02   8.9   6.6  12.3   0.0   NaN  339.0  12.7   24.0  1026.9   NaN
2022-01-03   9.7   7.8  13.5   0.0   NaN  295.0  30.5   21.0  1021.6   NaN
2022-01-04  11.2   8.0  14.0   0.3   NaN  113.0  22.7   42.6  1010.6   NaN
2022-01-05   6.9   2.8  11.3   0.5   NaN  311.0  47.7  117.0  1004.5   NaN
...          ...   ...   ...   ...   ...    ...   ...    ...     ...   ...
2023-02-25  10.6   8.8  13.5   3.2   NaN  330.0  10.7   30.0  1001.8   NaN
2023-02-26   6.4   2.1  11.2  17.8   NaN  320.0  33.0   85.0   997.9   NaN
2023-02-27   4.3   2.2   7.3   8.2   NaN  356.0  28.6   37.0  1009.0   NaN
2023-02-28   6.8   4.4  10.0   9.2   NaN  359.0  28.2   29.6  1014.9   NaN
2023-03-01   6.5   4.0   9.5   0.0   NaN  333.0  22.9   22.2  1013.9   NaN

[425 rows x 10 columns]
            tavg  tmin  tmax   prcp  wspd    pres  tsun
time                                                   
2022-01-01   7.0   3.7  11.3    1.3  20.2  1023.5   NaN
2022-02-01   9.0   5.8  12.4   28.0  32.6  1021.6   NaN
2022-03-01  10.2   4.2  15.9    NaN   NaN     NaN   NaN
2022-04-01  12.1   9.5  14.8   43.5  23.1  1012.6   NaN
2022-05-01  19.1  13.2  25.1    9.7  14.4  1016.6   NaN
2022-06-01  22.4  19.5  25.2   23.4  20.8  1014.5   NaN
2022-07-01  25.0  21.9  28.2    0.0  16.5  1016.0   NaN
2022-08-01  24.4  21.5  27.4   18.1  18.0  1012.9   NaN
2022-09-01  20.4  17.1  24.4   58.0  22.3  1012.8   NaN
2022-10-01  18.3  15.5  22.3   29.8  20.6  1021.0   NaN
2022-11-01  12.7  10.2  15.7   97.2  27.5  1015.6   NaN
2022-12-01   9.9   7.6  12.6  141.0  16.8  1015.1   NaN
clampr commented 1 year ago

Hi @karumbis,

Unfortunately, there isn't much we can do about it. tsun is one of the parameters which isn't well covered by most weather stations. We can only try to incorporate more data sources moving forward. But it might be the data simply isn't available for the weather stations in this area.

Regarding the delay in monthly data, I'm planning something for v2 of the library which will eliminate this delay (almost) completely by querying (most) data sources directly. However, this is more a mid to long-term solution. In the meanwhile, can you manually aggregate monthly values from daily data?

karumbis commented 1 year ago

Hi Clampr,

Thanks for your comments. No problem with the sunshine data and the monthly values. The latter can be indeed build from the daily values. Cheers.