pysal / segregation

Segregation Measurement, Inferential Statistics, and Decomposition Analysis
https://pysal.org/segregation/
BSD 3-Clause "New" or "Revised" License
111 stars 26 forks source link

Shapely Depreciation Warning (Absolute Clustering and Relative Clustering) #214

Closed PFurst2000 closed 1 year ago

PFurst2000 commented 1 year ago

While running the single group Absolute Clustering and Relative Clustering indices, I received the following warnings due to Shapely Depreciation. Is this an issue with the Segregation package or a problem with my own install of Shapely? It does successfully generate dataframe outputs but would this cause errors in the statistics?

Absolute Clustering Warning C:\Users\Hidden\anaconda3\envs\myenvpython3.6\lib\site-packages\libpysal\weights\util.py:1073: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead. data = np.vstack([np.array(shape.centroid) for shape in first_choice])

Relative Clustering Warning C:\Users\Hidden\anaconda3\envs\myenvpython3.6\lib\site-packages\libpysal\weights\util.py:1073: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead. data = np.vstack([np.array(shape.centroid) for shape in first_choice]

knaaptime commented 1 year ago

I’ll take a closer look at this when I’m back at a machine, but I think this is probably an incompatibility between pygeos and shapely. The latest version of segregation removes the legacy pygeos dependency, so this should be resolved by the next release. I’ll cut that this weekend.

Those are just deprecation warnings, not errors, so the indices you are calculating should be just fine.

Also it seems like you’re computing a bunch of indices all at once so you might find the batch_compute functions useful https://pysal.org/segregation/generated/segregation.batch.batch_compute_singlegroup.html#segregation.batch.batch_compute_singlegroup

PFurst2000 commented 1 year ago

Thank you, and sorry for the late reply! Glad to hear this doesn't effect the outputs. I will check out the batch input tool. Thank you for the reminder.

knaaptime commented 1 year ago

we did the release, so if you upgrade the package to the latest version (2.4.2) (and remove pygeos from your environment) you shouldn't get the warnings anymore