meteostat / meteostat-python

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

Normals API does not accept expected inputs #112

Open avikarto opened 2 years ago

avikarto commented 2 years ago

According to the docs for Normals,

The loc parameter is required. You can pass one (String) or multiple Meteostat weather station identifiers (Tuple or List), a meteostat.Point or a DataFrame returned by the meteostat.Stations.fetch method.

However, none of these seem to be working correctly. I can get the Normals API to return data with the documented example Normals('10637'), but using any of a real station ID, the station ID DF response, or a Point does not work:

from meteostat import Stations, Normals, Point
Stations.cache_dir = '/my/path'
stations = Stations()

# using the station ID string
res = stations.nearby(lat=35, lon=-80)
station_id_df = res.fetch(1)
station_id = station_id_df.index.values[0]  # KAFP0
id_normals = Normals(station_id).fetch()  # empty DF

# using the station ID Stations DF
df_normals = Normals(station_id_df).fetch()  # empty DF

# using a Point
point = Point(lat=35, lon=-80)
point_normals = Normals(loc=point).fetch()  # empty DF
% pip show meteostat
Name: meteostat
Version: 1.6.5
clampr commented 1 year ago

Hi,

Probably, no climate normals are available for this location. You could check if there is sufficient amount of daily / monthly data available to aggregate the normals yourself.