Open rrrzhan opened 4 months ago
Can you check what happens with the latest libpysal 4.10? We have recently refactored the Voronoi logic and I suppose the issue will materialise differently now.
Thank you, we found this issued solved by libpysal >= 4.9.0. However, in our scenario python 3.9 is required, which only supports libpysal <= 4.8.1. How can I solve this problem without upgrading my python version?
I am not sure. I am afraid that we do not have a capacity to provide support on outdated versions. Sorry. You may try to adapt the codebase of current libpysal to be compatible with Python 3.9 and install that. It should not be too complicated.
@rrrzhan, the issue is that your points are coincident. Delaunay Triangulations/Voronoi Diagrams are not well-defined mathematically when this is the case. The underlying Qhull library used by scipy (upon which we rely) silently drops the values that are coincident.
The fastest way you can deal with this is to add a very small random component to the input points. This is one of the supported options in Qhull, too, and is also implemented in the new weights as the "jitter" option.
It would be more complicated, but you can compute the unique locations, then construct the weights on locations, and expand the weights from locations back to the points. This is the "expand clique" option in the new implementation.
We met a
Key Error
when using the APIlps.weights.Queen.from_iterable
when evaluating Moran's Index in spatial analysis, which caused by replicated points. We submitted our coordinates dataarray.tsv
and here is our code:Output:
We tried to locate where the bug happens and found in
voronoi.py
:Further, we evaluated the
p1
formvor.ridge_points
andvor.point_region
:We found that they were not matched:
And your code used p1 from
vor.point_region
as an index forall_ridges
, this would causeKey Error
. This may be caused by replicated points in our data. But in our scenario, removing the replicated points is not allowed. We hope the replicated points have same neighbors. We would be appreciated if you take this problem into your consideration.Also, please upload any relevant data as a file attachment. Please do not upload pickled objects, since it's nearly impossible to troubleshoot them without replicating your exact namespace. Instead, provide the minimal subset of the data required to replicate the problem. If it makes you more comfortable submitting the issue, feel free to: