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

fix index error if input gdf has own index [issue #8] #10

Merged
merged 1 commit into from Jun 30, 2021
Merged

Conversation

ks905383
Copy link
Owner

xa.get_pixel_overlaps() creates a poly_idx column in the gdf that takes as its value the index of the input gdf. However, if there is a pre-existing index, this can lead to bad behavior, since poly_idx is used as an .iloc indexer in the gdf. This update instead makes poly_idx np.arange(0,len(gdf)), which will avoid this indexing issue (and hopefully not cause any more? I figured there would've been a reason I used the existing index if not a new one... fingers crossed).

`xa.get_pixel_overlaps()` creates a `poly_idx` column in the `gdf` that takes as its value the index of the input `gdf`. However, if there is a pre-existing index, this can lead to bad behavior, since `poly_idx` is used as an `.iloc` indexer in the `gdf`. This update instead makes `poly_idx` `np.arange(0,len(gdf))`, which will avoid this indexing issue (and hopefully not cause any more? I figured there would've been a reason I used the existing index if not a new one... fingers crossed).
@codecov-commenter
Copy link

codecov-commenter commented Jun 30, 2021

Codecov Report

Merging #10 (65351d4) into main (1f91b14) will increase coverage by 0.16%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #10      +/-   ##
==========================================
+ Coverage   81.63%   81.80%   +0.16%     
==========================================
  Files          11       11              
  Lines         539      544       +5     
==========================================
+ Hits          440      445       +5     
  Misses         99       99              
Flag Coverage Δ
unittests 81.80% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tests/test_core.py 100.00% <100.00%> (ø)
xagg/core.py 83.62% <100.00%> (-0.14%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f91b14...65351d4. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants