From fe2aff3d73fb04ca7e73e812fbbfcefce2bcd26f Mon Sep 17 00:00:00 2001 From: Luc DURON Date: Fri, 23 Feb 2024 09:49:20 +0100 Subject: [PATCH] Fix NumPy 1.24: np.float has expired --- pyteltools/geom/Shapefile.py | 2 +- pyteltools/geom/conversion.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyteltools/geom/Shapefile.py b/pyteltools/geom/Shapefile.py index 9e3f356..563853d 100644 --- a/pyteltools/geom/Shapefile.py +++ b/pyteltools/geom/Shapefile.py @@ -142,7 +142,7 @@ def write_shp_lines(output_filename, shape_type, lines, attribute_name): if 10 < shape_type < 20 and poly.is_2d(): coords = np.hstack((coords, np.zeros((poly.nb_points(), 1)))) if shape_type > 10: - m = np.array(poly.m, dtype=np.float).reshape(coords.shape[0], 1) + m = np.array(poly.m, dtype=float).reshape(coords.shape[0], 1) coords = np.hstack((coords, m)) if shape_type == shapefile.POLYLINE: w.line([list(map(tuple, coords))]) diff --git a/pyteltools/geom/conversion.py b/pyteltools/geom/conversion.py index 5fe3d06..6ed3ace 100644 --- a/pyteltools/geom/conversion.py +++ b/pyteltools/geom/conversion.py @@ -787,7 +787,7 @@ def to_multi(self, new_shapes, to_file, shape_type): def to_multim(self, new_shapes, new_m, to_file, shape_type): w = self._to_multi_init(to_file, shape_type) for points, points_m, attributes in zip(new_shapes, new_m, self.attributes): - m = np.array(points_m, dtype=np.float).reshape(points.shape[0], 1) + m = np.array(points_m, dtype=float).reshape(points.shape[0], 1) if points.shape[1] == 3: points = np.delete(points, 2, 1) # remove Z array coords = np.hstack((points, m)) @@ -797,7 +797,7 @@ def to_multim(self, new_shapes, new_m, to_file, shape_type): def to_multiz(self, new_shapes, new_m, to_file, shape_type): w = self._to_multi_init(to_file, shape_type) for points, points_m, attributes in zip(new_shapes, new_m, self.attributes): - m = np.array(points_m, dtype=np.float).reshape(points.shape[0], 1) + m = np.array(points_m, dtype=float).reshape(points.shape[0], 1) coords = np.hstack((points, m)) w.multipointz(list(map(tuple, coords))) w.record(*attributes)