From 9725cb24008e95ec527523d9f7c7cf48b0f579d6 Mon Sep 17 00:00:00 2001 From: Claudio Date: Tue, 11 Aug 2026 12:58:37 +1200 Subject: [PATCH 1/3] Fix typing --- qcore/coordinates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qcore/coordinates.py b/qcore/coordinates.py index c931ebce..cfb0656a 100644 --- a/qcore/coordinates.py +++ b/qcore/coordinates.py @@ -106,7 +106,7 @@ def nztm_to_wgs_depth(nztm_coordinates: np.ndarray) -> np.ndarray: def distance_between_wgs_depth_coordinates( point_a: npt.ArrayLike, point_b: npt.ArrayLike -) -> npt.ArrayLike: +) -> float | np.ndarray: """Return the distance between two points in lat, lon, depth format. Valid only for points that can be converted into NZTM format. From df7c5d7fedd67330f8aec09ec8274f173b009425 Mon Sep 17 00:00:00 2001 From: Claudio Date: Tue, 11 Aug 2026 13:02:17 +1200 Subject: [PATCH 2/3] More type fixes --- qcore/coordinates.py | 2 +- tests/test_coordinates.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qcore/coordinates.py b/qcore/coordinates.py index cfb0656a..fe7ab08e 100644 --- a/qcore/coordinates.py +++ b/qcore/coordinates.py @@ -133,7 +133,7 @@ def distance_between_wgs_depth_coordinates( return np.linalg.norm( wgs_depth_to_nztm(point_a) - wgs_depth_to_nztm(point_b), axis=1 ) - return np.linalg.norm(wgs_depth_to_nztm(point_a) - wgs_depth_to_nztm(point_b)) + return float(np.linalg.norm(wgs_depth_to_nztm(point_a) - wgs_depth_to_nztm(point_b))) def nztm_bearing_to_great_circle_bearing( diff --git a/tests/test_coordinates.py b/tests/test_coordinates.py index e8811a49..04223bfb 100644 --- a/tests/test_coordinates.py +++ b/tests/test_coordinates.py @@ -88,7 +88,7 @@ def test_distance_between_wgs_depth_coordinates_multiple_points() -> None: dist = coordinates.distance_between_wgs_depth_coordinates(points_a, points_b) assert isinstance(dist, np.ndarray) assert dist.shape == (2,) - assert np.all(dist > 0) # ty: ignore[unsupported-operator] + assert np.all(dist > 0) def test_nztm_to_gc_bearing_inverse() -> None: From 150f235117cd07f9a56ebd786c6ab5439cc3ed92 Mon Sep 17 00:00:00 2001 From: Claudio Date: Tue, 11 Aug 2026 13:08:51 +1200 Subject: [PATCH 3/3] Fix tests --- qcore/coordinates.py | 4 +++- tests/test_grid.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/qcore/coordinates.py b/qcore/coordinates.py index fe7ab08e..080d200e 100644 --- a/qcore/coordinates.py +++ b/qcore/coordinates.py @@ -133,7 +133,9 @@ def distance_between_wgs_depth_coordinates( return np.linalg.norm( wgs_depth_to_nztm(point_a) - wgs_depth_to_nztm(point_b), axis=1 ) - return float(np.linalg.norm(wgs_depth_to_nztm(point_a) - wgs_depth_to_nztm(point_b))) + return float( + np.linalg.norm(wgs_depth_to_nztm(point_a) - wgs_depth_to_nztm(point_b)) + ) def nztm_bearing_to_great_circle_bearing( diff --git a/tests/test_grid.py b/tests/test_grid.py index 5e0edaa0..42c680f9 100644 --- a/tests/test_grid.py +++ b/tests/test_grid.py @@ -70,7 +70,7 @@ def test_coordinate_meshgrid_x_boundary() -> None: resolution = coordinates.distance_between_wgs_depth_coordinates( x_upper, origin ) # 1 km resolution - assert isinstance(resolution, np.floating) + assert isinstance(resolution, float) meshgrid = grid.coordinate_patchgrid(origin, x_upper, y_bottom, resolution) assert meshgrid.shape[2] == 3 # Should have shape (ny, nx, 3) for (lat, lon, depth) _ny, _nx = meshgrid.shape[:2] @@ -119,8 +119,8 @@ def test_coordinate_patchgrid() -> None: ny, nx = meshgrid.shape[:2] width = coordinates.distance_between_wgs_depth_coordinates(y_bottom, origin) length = coordinates.distance_between_wgs_depth_coordinates(x_upper, origin) - assert isinstance(length, np.floating) - assert isinstance(width, np.floating) + assert isinstance(length, float) + assert isinstance(width, float) assert ny == round(length / resolution) assert nx == round(width / resolution)