From e1e6134ec0a2eebc0bab323ab8e7e3be76e499e9 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Mon, 29 Jul 2024 02:11:04 -0700 Subject: [PATCH 1/2] use asarray (since copy=False meaning changes in numpy 2.0) --- gridlock/draw.py | 4 ++-- gridlock/grid.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gridlock/draw.py b/gridlock/draw.py index 2fb0b47..e10d4ff 100644 --- a/gridlock/draw.py +++ b/gridlock/draw.py @@ -53,7 +53,7 @@ class GridDrawMixin(GridPosMixin): if surface_normal not in range(3): raise GridError('Invalid surface_normal direction') center = numpy.squeeze(center) - poly_list = [numpy.array(poly, copy=False) for poly in polygons] + poly_list = [numpy.asarray(poly) for poly in polygons] # Check polygons, and remove redundant coordinates surface = numpy.delete(range(3), surface_normal) @@ -293,7 +293,7 @@ class GridDrawMixin(GridPosMixin): sizes of the cuboid foreground: Value to draw with ('brush color'). See `draw_polygons()` for details. """ - dimensions = numpy.array(dimensions, copy=False) + dimensions = numpy.asarray(dimensions) p = numpy.array([[-dimensions[0], +dimensions[1]], [+dimensions[0], +dimensions[1]], [+dimensions[0], -dimensions[1]], diff --git a/gridlock/grid.py b/gridlock/grid.py index 91f3c6b..c8fe998 100644 --- a/gridlock/grid.py +++ b/gridlock/grid.py @@ -94,7 +94,7 @@ class Grid(GridDrawMixin, GridReadMixin, GridPosMixin): Raises: `GridError` on invalid input """ - edge_arrs = [numpy.array(cc, copy=False) for cc in pixel_edge_coordinates] + edge_arrs = [numpy.asarray(cc) for cc in pixel_edge_coordinates] self.exyz = [numpy.unique(edges) for edges in edge_arrs] self.shifts = numpy.array(shifts, dtype=float) From 045b0c0228860f7983d3f867a47cb357080e40e6 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Mon, 29 Jul 2024 02:12:37 -0700 Subject: [PATCH 2/2] enable numpy 2.0 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 672910c..1df2e8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,8 +38,8 @@ include = [ ] dynamic = ["version"] dependencies = [ - "numpy~=1.26", - "float_raster", + "numpy>=1.26", + "float_raster>=0.8", ]