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

h3_to_parent at resolution 0 labels it as direct parent #15

Closed
alpha-beta-soup opened this issue Mar 6, 2023 · 1 comment · Fixed by #21
Closed

h3_to_parent at resolution 0 labels it as direct parent #15

alpha-beta-soup opened this issue Mar 6, 2023 · 1 comment · Fixed by #21

Comments

@alpha-beta-soup
Copy link
Contributor

alpha-beta-soup commented Mar 6, 2023

h3_to_parent at resolution 0 calculates correctly, but returns a column called h3_parent, rather than h3_00 (or perhaps h3_0?) as expected based on the pattern for other resolutions.

I don't think there's anything unexpected about calculating the 0-level parent (I use it for partitioning; a higher resolution is used for my actual information). Rather it's just that this line checks for implicit False, not a strict check for None.

column = self._format_resolution(resolution) if resolution else "h3_parent"

Should be:

column = self._format_resolution(resolution) if resolution != None else "h3_parent"

>>> 'a' if 0 != None else 'b'
'a'
>>> 'a' if 0 else 'b'
'b'

The actual result is correct, it is a level-0 cell.

@alpha-beta-soup alpha-beta-soup changed the title h3_to_parent at resolution 0 calculates direct parent h3_to_parent at resolution 0 labels it as direct parent Mar 6, 2023
@DahnJ DahnJ closed this as completed in #21 Mar 19, 2023
@DahnJ
Copy link
Owner

DahnJ commented Mar 19, 2023

Hi @alpha-beta-soup, thank you for the bug report and for finding the solution! I implemented the change in #21

@DahnJ DahnJ reopened this Mar 19, 2023
@DahnJ DahnJ closed this as completed Mar 19, 2023
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 a pull request may close this issue.

2 participants