From 0c3f902b845c313837ee731a290ad3138f214076 Mon Sep 17 00:00:00 2001 From: Robin Lenz Date: Fri, 28 Jul 2023 01:26:41 +0200 Subject: [PATCH 1/2] added nopython=True to jit decorators in alpha_shapes.py --- libpysal/cg/alpha_shapes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libpysal/cg/alpha_shapes.py b/libpysal/cg/alpha_shapes.py index bddf8855a..15a0cbb71 100644 --- a/libpysal/cg/alpha_shapes.py +++ b/libpysal/cg/alpha_shapes.py @@ -38,7 +38,7 @@ __all__ = ["alpha_shape", "alpha_shape_auto"] -@jit +@jit(nopython=False) def nb_dist(x, y): """numba implementation of distance between points `x` and `y` @@ -164,7 +164,7 @@ def r_circumcircle_triangle(a_s, b_s, c_s): return r2 -@jit +@jit(nopython=False) def get_faces(triangle): """Extract faces from a single triangle @@ -198,7 +198,7 @@ def get_faces(triangle): return faces -@jit +@jit(nopython=False) def build_faces(faces, triangles_is, num_triangles, num_faces_single): """Build facing triangles @@ -260,7 +260,7 @@ def build_faces(faces, triangles_is, num_triangles, num_faces_single): return faces -@jit +@jit(nopython=False) def nb_mask_faces(mask, faces): """Run over each row in `faces`, if the face in the following row is the same, then mark both as False on `mask` From 0281ca6f3632cf95ae95914600d871f2d3c8dd8f Mon Sep 17 00:00:00 2001 From: Robin Lenz Date: Fri, 28 Jul 2023 14:13:09 +0200 Subject: [PATCH 2/2] FutureWarning in voronoi.py: update construction of geopandas df voronoi.py imports geopandas (if available) and creates geodataframes, where a `'geometry'` column is manually assigned. This will lead to errors with future versions of geopandas. ``` libpysal/cg/voronoi.py:173: FutureWarning: You are adding a column named 'geometry' to a GeoDataFrame constructed without an active geometry column. Currently, this automatically sets the active geometry column to 'geometry' but in the future that will no longer happen. Instead, either provide geometry to the GeoDataFrame constructor (GeoDataFrame(... geometry=GeoSeries()) or use `set_geometry('geometry')` to explicitly set the active geometry column. ``` Instead, the geodataframe geometry is now specified in the gdf creation via `gpd.GeoDataFrame(geometry = gpd.GeoSeries( ...` --- libpysal/cg/voronoi.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libpysal/cg/voronoi.py b/libpysal/cg/voronoi.py index e283a3b25..0b2f26fc6 100644 --- a/libpysal/cg/voronoi.py +++ b/libpysal/cg/voronoi.py @@ -169,11 +169,16 @@ def as_dataframes(regions, vertices, points): from .shapes import Polygon, Point if gpd is not None: - region_df = gpd.GeoDataFrame() - region_df["geometry"] = [Polygon(vertices[region]) for region in regions] - - point_df = gpd.GeoDataFrame() - point_df["geometry"] = gpd.GeoSeries(Point(pnt) for pnt in points) + region_df = gpd.GeoDataFrame( + geometry = gpd.GeoSeries( + Polygon(vertices[region]) for region in regions + ) + ) + point_df = gpd.GeoDataFrame( + geometry = gpd.GeoSeries( + Point(pnt) for pnt in points + ) + ) else: import pandas as pd