pysal / momepy

Urban Morphology Measuring Toolkit
https://docs.momepy.org
BSD 3-Clause "New" or "Revised" License
496 stars 59 forks source link

TestDistribution.test_MeanInterbuildingDistance failure on dev #461

Closed martinfleis closed 5 months ago

martinfleis commented 1 year ago

We have a failure on dev most likely related to https://github.com/pysal/esda/issues/239 and caused by https://github.com/pysal/libpysal/pull/510.

martinfleis commented 1 year ago

Reproducer:

import geopandas
import momepy
from libpysal.weights import Queen

df = geopandas.read_file(momepy.datasets.get_path("bubenec"), layer="tessellation")

df["my_id"] = range(3, len(df) + 3)
W = Queen.from_dataframe(df, ids="my_id")
W_adj = W.to_adjlist(drop_islands=True)
print(W_adj)

The expected output, prior https://github.com/pysal/libpysal/pull/510:

     focal  neighbor  weight
0        3       116     1.0
1        3       124     1.0
2        3       136     1.0
3        3       137     1.0
4        4         5     1.0
..     ...       ...     ...
741    146        79     1.0
742    146        80     1.0
743    146        81     1.0
744    146        83     1.0
745    146       127     1.0

[746 rows x 3 columns]

That one is correctly using the ids I have assigned.

The output with libpysal master:

     focal  neighbor  weight
0        0       113     1.0
1        0       121     1.0
2        0       133     1.0
3        0       134     1.0
4        1         2     1.0
..     ...       ...     ...
741    143        76     1.0
742    143        77     1.0
743    143        78     1.0
744    143        80     1.0
745    143       124     1.0

[746 rows x 3 columns]

The values are now representing the integer location, not the custom id.

martinfleis commented 5 months ago

Solved in upstream