-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle larger than 32bit distances when creating Hilbert distance and spatially partitioning. #219
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,9 @@ def _hilbert_distance(gdf, total_bounds=None, level=16): | |
# Compute distance along hilbert curve | ||
distances = _encode(level, x, y) | ||
|
||
return pd.Series(distances, index=gdf.index, name="hilbert_distance") | ||
return pd.Series( | ||
distances, index=gdf.index, name="hilbert_distance", dtype=np.int64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes you are right, i had missed that this is actually an unsigned int. The reason for the overflow is actually that the value is greater than the max value for int but not uint, and dask simply isn't respecting the dtype. |
||
) | ||
|
||
|
||
def _continuous_to_discrete_coords(bounds, level, total_bounds): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be an option provided by the user, rather than assuming int64. The default should be uint32 for backwards compatability.