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 "
2
2
"""
3
3
:mod:`esda` --- Exploratory Spatial Data Analysis
4
4
=================================================
Original file line number Diff line number Diff line change 1
- import numpy , pygeos , pandas , geopandas
1
+ import numpy , pandas
2
2
from scipy .special import entr
3
3
4
+ try :
5
+ import pygeos
6
+ except (ImportError , ModuleNotFoundError ):
7
+ pass # gets handled in the _cast function.
8
+
4
9
# from nowosad and stepinski
5
10
# https://doi.org/10.1080/13658816.2018.1511794
6
11
@@ -21,6 +26,13 @@ def _cast(collection):
21
26
"""
22
27
Cast a collection to a pygeos geometry array.
23
28
"""
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
+
24
36
if isinstance (collection , (geopandas .GeoSeries , geopandas .GeoDataFrame )):
25
37
return collection .geometry .values .data .squeeze ()
26
38
elif pygeos .is_geometry (collection ).all ():
Original file line number Diff line number Diff line change 1
- import pygeos
2
- import geopandas , pandas
3
1
import 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
+
5
11
6
12
# -------------------- UTILITIES --------------------#
7
13
def _cast (collection ):
8
14
"""
9
15
Cast a collection to a pygeos geometry array.
10
16
"""
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
+
11
22
if isinstance (collection , (geopandas .GeoSeries , geopandas .GeoDataFrame )):
12
23
return collection .geometry .values .data .squeeze ()
13
24
elif pygeos .is_geometry (collection ).all ():
You can’t perform that action at this time.
0 commit comments