Skip to content
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

[BUG]: cuspatial API example notebook throws error ndarray attribute error when running pip #901

Closed
taureandyernv opened this issue Feb 6, 2023 · 3 comments · Fixed by #906
Assignees
Labels
bug Something isn't working

Comments

@taureandyernv
Copy link
Contributor

Version

23.02 nightly

On which installation method(s) does this occur?

Docker

Describe the issue

when running PIP, I get an Attribute error: AttributeError: 'ndarray' object has no attribute 'index'.

Minimum reproducible example

import cuspatial
import cupy
import geopandas
host_dataframe = geopandas.read_file(geopandas.datasets.get_path("naturalearth_lowres"))
gpu_dataframe = cuspatial.from_geopandas(host_dataframe)
x_points = (cupy.random.random(10000000) - 0.5) * 360
y_points = (cupy.random.random(10000000) - 0.5) * 180

short_dataframe = gpu_dataframe.iloc[0:32]
geometry = short_dataframe['geometry']
points_in_polygon = cuspatial.point_in_polygon(
    x_points,
    y_points,
    geometry.polygons.geometry_offset[0:31],
    geometry.polygons.ring_offset,
    geometry.polygons.x,
    geometry.polygons.y
)

Relevant log output

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_4178/1403701831.py in <module>
      6 short_dataframe = gpu_dataframe.iloc[0:32]
      7 geometry = short_dataframe['geometry']
----> 8 points_in_polygon = cuspatial.point_in_polygon(
      9     x_points,
     10     y_points,

/opt/conda/envs/rapids/lib/python3.10/site-packages/cuspatial/core/spatial/join.py in point_in_polygon(test_points_x, test_points_y, poly_offsets, poly_ring_offsets, poly_points_x, poly_points_y)
    116         {name: col.astype("bool") for name, col in result._data.items()}
    117     )
--> 118     result.columns = [x for x in list(reversed(poly_offsets.index))]
    119     result = result[list(reversed(result.columns))]
    120     return result

AttributeError: 'ndarray' object has no attribute 'index'

Environment details

This happens in all docker containers for the docker nightly builds as of 2/6

Other/Misc.

No response

@taureandyernv taureandyernv added Needs Triage Need team to review and classify bug Something isn't working labels Feb 6, 2023
@github-project-automation github-project-automation bot moved this to Todo in cuSpatial Feb 6, 2023
@isVoid
Copy link
Contributor

isVoid commented Feb 7, 2023

Though not ideal, this will be temporarily fixed by #906

@harrism
Copy link
Member

harrism commented Feb 7, 2023

Can you explain why the fix is not ideal, @isVoid ?

@isVoid
Copy link
Contributor

isVoid commented Feb 7, 2023

cuspatial.point_in_polygon documentation doesn't detail the requirement of the input arguments. It seems as though the inputs can just be cupy arrays, except for poly_offsets - .index property is accessed so this would need to be a series instead. I think some refactoring and additional documentation to the API is needed.

@isVoid isVoid self-assigned this Feb 8, 2023
@rapids-bot rapids-bot bot closed this as completed in bcf45ef Feb 9, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in cuSpatial Feb 9, 2023
@jarmak-nv jarmak-nv removed the Needs Triage Need team to review and classify label Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants