Skip to content

.filter_by_rank() not working (with DwdRoadRequest) #1353

Open
@SB-511

Description

@SB-511

Describe the bug
After applying .filter_by_rank() to a DwdRoadRequest it still returns all stations.
Sidenote: .filter_by_distance() still works fine.

To Reproduce

import datetime
from zoneinfo import ZoneInfo
from wetterdienst.provider.dwd.road.api import DwdRoadRequest, DwdRoadResolution

LOCATION = (49, 8.4)
NOW = datetime.datetime.now(ZoneInfo("UTC")).replace(tzinfo=None)

# Check the available parameters -> don't miss new ones!
road_parameters_dict = DwdRoadRequest.discover(
    resolution=DwdRoadResolution.MINUTE_10
)
road_params = list(road_parameters_dict["minute_10"].keys())

request = DwdRoadRequest(
    parameter=road_params,
    start_date=NOW - datetime.timedelta(minutes=60),
    end_date=NOW,
)

stations = request.filter_by_rank(latlon=LOCATION, rank=5)

print(stations.df)

Output:

shape: (1_653, 15)
[...]

If you replace .filter_by_rank(LOCATION, 5) with .filter_by_distance(LOCATION, 20) it works fine:

shape: (4, 15)
[...]

Expected behavior
Work as described = return the n closest stations.

Screenshots

Desktop (please complete the following information):

  • OS: Ubuntu
  • Python-Version 3.10.12
  • wetterdienst-Version: 0.95.1

Additional context
I'm not sure, but I thought it was working some releases ago.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions