File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed
Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 1- __version__ = "2.4.0 "
1+ __version__ = "2.4.1 "
22"""
33:mod:`esda` --- Exploratory Spatial Data Analysis
44=================================================
Original file line number Diff line number Diff line change 1- import numpy , pygeos , pandas , geopandas
1+ import numpy , pandas
22from scipy .special import entr
33
4+ try :
5+ import pygeos
6+ except (ImportError , ModuleNotFoundError ):
7+ pass # gets handled in the _cast function.
8+
49# from nowosad and stepinski
510# https://doi.org/10.1080/13658816.2018.1511794
611
@@ -21,6 +26,13 @@ def _cast(collection):
2126 """
2227 Cast a collection to a pygeos geometry array.
2328 """
29+ try :
30+ import pygeos , geopandas
31+ except (ImportError , ModuleNotFoundError ) as exception :
32+ raise type (exception )(
33+ "pygeos and geopandas are required for map comparison statistics."
34+ )
35+
2436 if isinstance (collection , (geopandas .GeoSeries , geopandas .GeoDataFrame )):
2537 return collection .geometry .values .data .squeeze ()
2638 elif pygeos .is_geometry (collection ).all ():
Original file line number Diff line number Diff line change 1- import pygeos
2- import geopandas , pandas
31import numpy
4- from numba import njit , prange
2+ import pandas
3+
4+ try :
5+ import pygeos
6+ except (ImportError , ModuleNotFoundError ):
7+ pass # gets handled at the _cast level.
8+
9+ from .crand import njit , prange
10+
511
612# -------------------- UTILITIES --------------------#
713def _cast (collection ):
814 """
915 Cast a collection to a pygeos geometry array.
1016 """
17+ try :
18+ import pygeos , geopandas
19+ except (ImportError , ModuleNotFoundError ) as exception :
20+ raise type (exception )("pygeos and geopandas are required for shape statistics." )
21+
1122 if isinstance (collection , (geopandas .GeoSeries , geopandas .GeoDataFrame )):
1223 return collection .geometry .values .data .squeeze ()
1324 elif pygeos .is_geometry (collection ).all ():
You can’t perform that action at this time.
0 commit comments