earthobservations / wetterdienst

Open weather data for humans.
https://wetterdienst.readthedocs.io/
MIT License
362 stars 55 forks source link

skip_empty not working #858

Open TheAnalystx opened 1 year ago

TheAnalystx commented 1 year ago

Describe the bug I want to find the latest weather data for one or multiple coordinates, I thought skip_empty would be the way to go, but this seem not to actually skip empty stations.

To Reproduce

from wetterdienst.provider.dwd.observation import DwdObservationRequest, DwdObservationDataset, \
    DwdObservationResolution, DwdObservationPeriod
r = DwdObservationRequest(
            parameter=[
                DwdObservationDataset.TEMPERATURE_AIR,
                DwdObservationDataset.WIND,
                DwdObservationDataset.PRECIPITATION
            ],
            resolution=DwdObservationResolution.MINUTE_10,
            period=DwdObservationPeriod.NOW,
        )
# search weather for coordinates:
print('skip_empty: ', r.skip_empty)  # -> True
hannover = {'latitude': 52.39197954397832, 'longitude': 9.80360833506706}
station = r.filter_by_rank(rank=1, latlon=(hannover['latitude'], hannover['longitude']))
assert not station.values.all().df.empty, 'empty dataframe found'  # <- error

Expected behavior not empty dataframe with values

Desktop (please complete the following information):

TheAnalystx commented 1 year ago

Is that actually a bug or do I missunderstand the use of skip_empty? Because if that isn't a bug but simply wrong parameter usage I would close the issue and implement something to find the nearest non-empty station for my problem.

gutzbenj commented 1 year ago

Dear @TheAnalystx ,

this option is currently not working as intended. Atm when using it we just skip the empty station however we don't request another alternative station! For this to work I'll have to put in some more work:

Would you want to work on this kind of topic? I could give you some hints on where to place to code!

TheAnalystx commented 1 year ago

Dear @gutzbenj ,

could be interesting to solve, maybe I can address this next month, if I can find the time.