Skip to content

CI fails for spatial.get_closest_points_to_point for Python 3.11 and 3.12 #121

Description

@cchwala

Test fail for Python 3.11 and 3.12 forplg.spatial.get_closest_points_to_point, see this CI run

_______________________ test_get_closest_points_to_point _______________________

    def test_get_closest_points_to_point():
        closest_neighbors = plg.spatial.get_closest_points_to_point(
            ds_points=ds_gauge.sel(id=["g2", "g3"]),
            ds_points_neighbors=ds_gauge,
            max_distance=1.1,
            n_closest=5,
        )
        expected_distances = np.array(
            [[0.0, 1.0, 1.0, np.inf, np.inf], [0.0, 1.0, np.inf, np.inf, np.inf]]
        )
        expected_neighbor_ids = np.array(
            [["g2", "g3", "g1", None, None], ["g3", "g2", None, None, None]], dtype=object
        )
        assert closest_neighbors.distance.data == pytest.approx(
            expected_distances, abs=1e-6
        )
        assert (
            closest_neighbors.neighbor_id.data[expected_distances != np.inf]
            == expected_neighbor_ids[expected_distances != np.inf]
        ).all()
        assert np.isnan(
            closest_neighbors.neighbor_id.data[expected_distances == np.inf].astype(float)
        ).all()
>       assert closest_neighbors.neighbor_id.data[0, 3] is None
E       assert nan is None

Metadata

Metadata

Assignees

No one assigned

    Labels

    automationautomation of testing, linting, releasing etcbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions