Open SB-511 opened 2 months ago
(Short test with the DwdObservationRequest
shows same problem)
This may be a bit confusing but
stations = request.filter_by_rank(latlon=LOCATION, rank=5)
result = stations.values.all()
print(result.df_stations)
would give you what you need.
We'll probably need to make this more clear but when going through those distance sorted stations we don't really know if any of those has the requested values so what it does is consume K of N stations until RANK stations with values were found. It then stops and df_stations
is a view on the stations df based on the consumed stations WITH values.
Hey @gutzbenj , thank you for the clarification!
Is there a way to access the actual values of these 5 closest stations?
So you'd either have to set ts_skip_empty
to false or lower the ts_skip_threshold
to something more pessimistic like 0.75. See https://wetterdienst.readthedocs.io/en/latest/usage/settings.html#settings for reference.
Oh okay, so there is no way of accessing the values of these stations directly as .filter_by_rank()
is searching for the closest stations, not the closest stations with data?
It is doing exactly that - looking for stations with data in accordance to the settings. But if you set ts_skip_empty=False
it would just hand you the X closest stations' data.
Describe the bug After applying
.filter_by_rank()
to aDwdRoadRequest
it still returns all stations. Sidenote:.filter_by_distance()
still works fine.To Reproduce
Output:
If you replace
.filter_by_rank(LOCATION, 5)
with.filter_by_distance(LOCATION, 20)
it works fine:Expected behavior Work as described = return the n closest stations.
Screenshots
Desktop (please complete the following information):
Additional context I'm not sure, but I thought it was working some releases ago.