You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm setting up my class and have now run the entire book with a conda environment built on Jan 9, 2023 on an Intel Mac. Here is the command that builds the environment.
I know we're supposed to be using the pre-built container, but I wanted the students to run the notebooks in their own environment. Below are some issues that came up in this particular environment. I hope this is useful for others teaching with this book.
1. Things that return errors in this environment
a. seaborn.kdeplot
In 08_point_pattern_analysis.ipynb, code cell 8, the seaborn.kdeplot API seems to have changed. The following fixes the issue:
x=db["x"],
y=db["y"],
b. PolygonPatch
In 08_point_pattern_analysis.ipynb, code cell 18, PolygonPatch from decartes is not working. This hack gets around the issue:
# Plot a green alpha shapeax.add_patch(
plt.Polygon(
alpha_shape.exterior.coords,
closed=True,
edgecolor="green",
facecolor="green",
alpha=0.2,
label="Tighest single alpha shape",
)
)
The following is needed in cell 23
# Make a purple alpha shapealpha_shape_patch=Polygon(
alpha_shape.exterior.coords,
closed=True,
edgecolor="purple",
facecolor="none",
linewidth=2,
label="Alpha Shape",
)
...
# a green minimum rotated rectanglemin_rot_rect_patch=Polygon(
min_rot_rect.exterior.coords,
edgecolor="green",
facecolor="none",
linestyle="--",
label="Min Rotated Rectangle",
linewidth=2,
)
c. Seaborn boxplot
In 11_regression.ipynb, code cell 10, the seaborn.boxplot API seems to have changed. The following fixes the issue:
x="neighborhood",
y="residual",
d. Seaborn regplot
In 11_regression.ipynb, code cell 12, the seaborn.regplot API seems to have changed. The following fixes the issue:
x=m1.u.flatten(),
y=lag_residual.flatten(),
Also in cell 19
x=m2.u.flatten(),
y=lag_residual.flatten(),
e. GeoPandas boxplot
In 12_feature_engineering.ipynb, code cell 71, something changed so that it cannot take an array of labels. The following fixes the issue:
# Group by cluster label, generating one box plot/clusterby=labels.tolist(),
2. Things that return warnings in this environment
a. Shapely 2.0 and GeoPandas migration
This issue will work itself out over time, but for now every notebook needs the first cell to be:
For some reason, from pysal.explore import esda and from pysal.explore import inequality return this (numba?) warning: OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
Changing the imports to import esda and import inequality in the following notebooks resolves the warning.
06_spatial_autocorrelation.ipynb (import esda)
07_local_autocorrelation.ipynb (import esda)
09_spatial_inequality.ipynb (import esda and import inequality)
11_regression.ipynb (import esda)
c. CRS warning
In 03_spatial_data.ipynb, cell 52, the following warning comes up. I don't have a fix for this. Warning 1: +init=epsg:XXXX syntax is deprecated. It might return a CRS with a non-EPSG compliant axis order.
d. GeoPandas spatial join
In 12_feature_engineering.ipynb code cell 16, the geopandas.sjoin API seems to have changed the op parameter to predicate. The following fixes the issue:
# Operation (spatial predicate) to use for the spatial join (`within`)predicate="within",
)
The warning comes up again in code cell 40, but I think it's happening within cenpy this time.
e. Tobler import
In 12_feature_engineering.ipynb code cell 45, the import from tobler is throwing the following warning which appears to be coming from inside tobler. I don't have a fix for this. .../lib/python3.10/site-packages/rasterstats/io.py:17: DeprecationWarning: ReadingError is deprecated and will be removed in a future version. Use ShapelyError instead (functions previously raising {name} will now raise a ShapelyError instead). from shapely.errors import ReadingError
f. PySAL weights
In 12_feature_engineering.ipynb code cell 55, numpy is unhappy about some of the values it's getting and throwing the following warning. I don't have a fix for this. .../lib/python3.10/site-packages/numpy/core/fromnumeric.py:3432: RuntimeWarning: Mean of empty slice. return _methods._mean(a, axis=axis, dtype=dtype, .../lib/python3.10/site-packages/numpy/core/_methods.py:190: RuntimeWarning: invalid value encountered in double_scalars ret = ret.dtype.type(ret / rcount)
The text was updated successfully, but these errors were encountered:
I'm setting up my class and have now run the entire book with a conda environment built on Jan 9, 2023 on an Intel Mac. Here is the command that builds the environment.
Click here to see all the package versions
I know we're supposed to be using the pre-built container, but I wanted the students to run the notebooks in their own environment. Below are some issues that came up in this particular environment. I hope this is useful for others teaching with this book.
1. Things that return errors in this environment
a. seaborn.kdeplot
In
08_point_pattern_analysis.ipynb
, code cell 8, theseaborn.kdeplot
API seems to have changed. The following fixes the issue:b. PolygonPatch
In
08_point_pattern_analysis.ipynb
, code cell 18,PolygonPatch
fromdecartes
is not working. This hack gets around the issue:The following is needed in cell 23
c. Seaborn boxplot
In
11_regression.ipynb
, code cell 10, theseaborn.boxplot
API seems to have changed. The following fixes the issue:d. Seaborn regplot
In
11_regression.ipynb
, code cell 12, theseaborn.regplot
API seems to have changed. The following fixes the issue:Also in cell 19
e. GeoPandas boxplot
In
12_feature_engineering.ipynb
, code cell 71, something changed so that it cannot take an array of labels. The following fixes the issue:2. Things that return warnings in this environment
a. Shapely 2.0 and GeoPandas migration
This issue will work itself out over time, but for now every notebook needs the first cell to be:
b. Importing PySAL
esda
andinequality
For some reason,
from pysal.explore import esda
andfrom pysal.explore import inequality
return this (numba?) warning:OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
Changing the imports to
import esda
andimport inequality
in the following notebooks resolves the warning.06_spatial_autocorrelation.ipynb
(import esda
)07_local_autocorrelation.ipynb
(import esda
)09_spatial_inequality.ipynb
(import esda
andimport inequality
)11_regression.ipynb
(import esda
)c. CRS warning
In
03_spatial_data.ipynb
, cell 52, the following warning comes up. I don't have a fix for this.Warning 1: +init=epsg:XXXX syntax is deprecated. It might return a CRS with a non-EPSG compliant axis order.
d. GeoPandas spatial join
In
12_feature_engineering.ipynb
code cell 16, thegeopandas.sjoin
API seems to have changed theop
parameter topredicate
. The following fixes the issue:The warning comes up again in code cell 40, but I think it's happening within
cenpy
this time.e. Tobler import
In
12_feature_engineering.ipynb
code cell 45, the import fromtobler
is throwing the following warning which appears to be coming from insidetobler
. I don't have a fix for this..../lib/python3.10/site-packages/rasterstats/io.py:17: DeprecationWarning: ReadingError is deprecated and will be removed in a future version. Use ShapelyError instead (functions previously raising {name} will now raise a ShapelyError instead). from shapely.errors import ReadingError
f. PySAL weights
In
12_feature_engineering.ipynb
code cell 55, numpy is unhappy about some of the values it's getting and throwing the following warning. I don't have a fix for this..../lib/python3.10/site-packages/numpy/core/fromnumeric.py:3432: RuntimeWarning: Mean of empty slice. return _methods._mean(a, axis=axis, dtype=dtype, .../lib/python3.10/site-packages/numpy/core/_methods.py:190: RuntimeWarning: invalid value encountered in double_scalars ret = ret.dtype.type(ret / rcount)
The text was updated successfully, but these errors were encountered: