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

ajfriend/more v4 funcs #241

Merged
merged 3 commits into from
May 25, 2022
Merged

ajfriend/more v4 funcs #241

merged 3 commits into from
May 25, 2022

Conversation

ajfriend
Copy link
Contributor

No description provided.

@ajfriend ajfriend changed the base branch from master to dev_v4 May 21, 2022 22:49
@codecov
Copy link

codecov bot commented May 21, 2022

Codecov Report

Merging #241 (56135e3) into dev_v4 (298f17f) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##            dev_v4      #241   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines          427       427           
=========================================
  Hits           427       427           
Impacted Files Coverage Δ
src/h3/_cy/__init__.py 100.00% <ø> (ø)

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 298f17f...56135e3. Read the comment docs.

@ajfriend ajfriend marked this pull request as ready for review May 23, 2022 01:26
Comment on lines +50 to +55
# mean_hex_area,
# cell_area,
# line,
# is_res_class_iii,
get_pentagon_indexes,
get_res0_indexes,
# get_pentagon_indexes,
# get_res0_indexes,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just delete these lines. They are not planned to be uncommented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My plan (which I probably haven't communicated well) was that once we finish the migration to remove h2fake2 that this file will be unchanged compared to the v3 version on master. So eventually, yes, they will be uncommented.

I agree that all these function names should be changed to something better, I just want to avoid that to minimize the surface area of what we're changing at this step.

Copy link
Contributor Author

@ajfriend ajfriend May 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And to be clear, this file will eventually change with better names, just not at this stage.

# 'km^2': 1.0,
# 'm^2': 1000*1000.0
# }
err = h3lib.getHexagonAreaAvgKm2(resolution, &area)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except -1 is unused because this doesn't propagate err

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except -1 would still be used if something else failed, like check_res, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory yes, but I don't think this function will return -1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great discussion to have, but my plan is to defer these till later when we can examine our strategy around exceptions as a whole, instead of a function-by-function basis.

That's why I want to minimize the changes we're making at this stage. I just want us to focus on removing h3fake2 right now. That should be a fairly straightforward and mechanical process.

Error handling/naming/API will probably require more of an open discussion, so I'm hoping to handle those as their own separate issues/PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be discussed in #243

# s = "Couldn't find line between cells {} and {}"
# s = s.format(hex(start), hex(end))
# raise H3ValueError(s)
cpdef H3int[:] line(H3int start, H3int end):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this needs except * to check for an exception?
I would suggest renaming this to grid_path_cells as we update the underlying C call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above. Totally agree we should have this discussion, but let's defer until we remove h3fake2.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be discussed in #243

# ptr = create_ptr(n)
# h3lib.getRes0Indexes(ptr)
# mv = create_mv(ptr, n)
cpdef H3int[:] get_res0_indexes():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, would suggest updating the name

Copy link
Contributor Author

@ajfriend ajfriend May 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, but in next stage.

@ajfriend
Copy link
Contributor Author

ajfriend commented May 24, 2022

@isaacbrodsky At a high level, for this stage, I want us to focus on removing h3fake2 and avoid any changes that might spark reasonable discussion. I'd like this stage to be entirely a mechanical process of moving over to the v4 C functions.

I'd like to have those reasonable discussions once we're past this stage.

Copy link
Collaborator

@isaacbrodsky isaacbrodsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline, we’ll land this as an interim step

@ajfriend ajfriend merged commit 4ec0a92 into dev_v4 May 25, 2022
@ajfriend ajfriend deleted the ajfriend/more_v4_funcs branch May 25, 2022 03:18
This was referenced May 25, 2022
ajfriend added a commit that referenced this pull request Aug 23, 2022
* WIP: Starting work on v4, The Sequel (#238)

* cimport for h3fake2 doesn't seem to work

* back to where we were

* meh, close to what i was hoping for

* h3fake2 in github actions

* comment out current bindings that consume the h3c v3 library

* don't need the coveragerc file at the moment; clear out c files in /tests

* sdist needs h3fake2

* try CIBW_BEFORE_BUILD to get h3fake2

* need h3fake2 for cibuildwheel tests

* update h3 C library

* comment out most of h3lib.pxd

* calling from v4 c lib works! (tests dont' work yet tho)

* tests shall pass

* starting to move over first few functions

* little steps

* util submodule fully moved over; some hackery with h3fake2 errors

* getting even trickier with h3fake2 errors

* few more simple functions

* geo_to_h3 and h3_to_geo

* grid_distance function

* grid_disk

* parents and kids

* compact/uncompact

* getNumCells

* comment out sdist test temporarily

* commenting out `make_sdist` seems to have turned off the other CI jobs

* no, it was that we're pushing to the dev branch

* keep the sdist job in there, but commented out

* ajfriend/more v4 funcs (#241)

* get_pentagon_indexes and get_res0_indexes

* line

* cell area functions

* get_faces (#248)

* initial pass

* thoughts

* the results of thinking

* this commit is associated with the previous commits

* nogil

* i'm a bill

* remove the typical nonsense

* v4: local ij functions to v4 cython (#240)

* move local ij functions to v4 implementation

* revert some changes and add gridPathCells

* swap implementation

* revert gridPathCells

* ring (#251)

* Uncomment cython example, and exclude sdist from wheels test temporarilty (#252)

* uncomment cython test

* exclude make_sdist temporarily from the wheels tests

* v4: polygonToCells (#254)

* v4: geo boundary, set to multi polygon (#255)

* v4: cell boundary

* v4: h3_set_to_multi_polygon

* v4: convert edge from h3fake2 (#253)

* v4: convert edge from h3fake2

* on error not neighbors

* except *

* check for neighbor error

* Fix sdist build (#239)

* make sure `make_sdist` CI job still broken

* reproduce locally

* update h3lib

* still seems broken

* try sdist on mac and ubuntu

* pyest!

* debugging

* ensurepath

* Disable building docs

* just build sdist once

* colon

Co-authored-by: Isaac Brodsky <[email protected]>

* remove h3fake2 transitional library (#257)

* Remove more sdist files (#259)

* remove scripts/examples/apps

* BUILD_FUZZERS OFF

* ENABLE_FORMAT off

* turn off all the things (and sort options)

* mac attack

* see if there's a build time difference

* back to the future

* New error system (#260)

* starting to play around with new error system

* move enum to h3lib.pxd

* this structure is weird :(

* error system gets its own file

* go back to using H3ErrorCodes

* extern the H3ErrorCodes

* remove H3Index in favor of just H3int

* " to '

* import ordering

* something

* exception hierarchy

* formatting

* errors list

* remove H3ResolutionError

* remove H3EdgeError

* remove H3CellError

* remove H3DistanceError

* H3FailedError

* domain error

* H3UnrecognizedException

* most of em done

* remove H3ValueError

* remove some checks

* ideas ideas

* document what the function raises?

* thoughts

* lint

* one half idea for DRYing (kinda)

* potentially make the E_SUCCESS path faster

* typos

* maple syrup

* cimport H3ErrorCodes as ec

* clean up

* whitespace

* clarify cases

* trying new error idiom

* thanks comment

* notes

* applied idiom a few times now

* alternative idiom?

* handling some more potential errors

* idioms and ideas

* clean

* removing check

* interesting allocation example

* lint

* just trying to beat 2.7 for sport right now

* works?

* bow to lint

* using enum values directly!

* now that's a hierarchy

* remove raise_with_msg

* ij funcs

* lint

* remove some checks

* remove err

* comment

* cleaned up `ring`, and i think i fixed a memory leak bug

* think i fixed another memory leak bug

* another memory leak bug

* memory leaks!

* clean

* removing some comments

* meh

* H3Exception shouldn't be appearing as a concrete object

* renaming some base exceptions

* clean up

* don't have a test for this anyway

* documented

* puttering around

* words

* backing up this nonsense with an airtight argument

* air toight

* todos

* more words

* skepticism

* rewording

* editing

* ordering

* tests on the error codes

* more error code tests

* note

* address some comments

* we raise!

* lint

* comments

* Squash #261: Use new H3MemoryManager system (#268)

* Squash #261: Use new H3MemoryManager system

Co-authored-by: AJ Friend <[email protected]>

* add some error checks

* comments

* comments

* clearer logical flow

* arrays are different from memoryviews!

* little cleaner

* Revert "comments"

This reverts commit 80c3f4d.

* Revert "Revert "comments""

This reverts commit a9d6590.

* Revert "comments"

This reverts commit 24904bd.

* comments

* arrays are different from memoryviews!

* try _copy_to_mv

* i don't get enough opportunities to consider using the word "penultimate"

* ugh, and there i go using it incorrectly...

* hmmm. was this really all it was?

* That's what it was!

This reverts commit 7e72adb.

* clarify branches

* remove simple_mv

* moving around

* clean up

* comments

* comments

* comments

Co-authored-by: Isaac Brodsky <[email protected]>

* remove: from h3 import h3 (#270)

* is_valid_cell (#269)

* Remove alias functions (#271)

* remove alias function hex_range

* note test_k_ring and test_hex_range are the same

* remove test_hex_range

* duplicate tests

* remove test_hex_range2

* same test

* remove test_hex_range_pentagon

* remove alias: k_ring_distances

* tests are the same!

* same test

* combine tests

* remove alias: h3_is_res_class_iii

* lint

* Update most functions to v4.0 names (#272)

* grid_distance

* cell_to_parent

* get_resolution

* is_pentagon

* is_res_class_III

* get_pentagons

* get_res0_cells

* get_base_cell_number

* compact and uncompact

* get_faces

* cell_to_boundary

* cell_to_latlng

* latlng_to_cell

* cell_to_children

* int_to_string and string_to_int

* cell_to_center_child

* moving things around

* is_valid_directed_edge

* grid_path_cells

* moving around

* cells_to_multi_polygon

* are_neighbor_cells

* cell_to_local_ij and local_ij_to_cell

* get_icosahedron_faces

* great_circle_distance

* get_num_cells

* note

* remove hex_range_distances and hex_ranges (easily implementable by user)

* grid_ring

* grid_disk

* moving around

* origin_to_directed_edges

* directed_edge_to_boundary

* cells_to_directed_edge

* directed_edge_to_cells

* todo: directedEdgeToCells

* get_directed_edge_origin

* get_directed_edge_destination

* grouping functions

* more grouping

* _binding to _b

* todos

* average_hexagon_area

* average_edge_length

* average_edge_length and edge_length

* average_hexagon_edge_length

* ordering

* more ordering

* Get the makefile working on Linux (#274)

* bump core lib to 4.0 rc5 (#275)

* bump core lib to 4.0 rc5

* more pythonic names for string<->int conversion functions

* cython hex2int to str_to_int to match the python functions

* better argument names for great_circle_distance

* great_circle_distance comments

* revert great_circle_distance tuple unpacking since it breaks python2. drop python 2 before release

* polygon_to_cells (#276)

* start converting tests over

* converted main tests

* linting

* better null island test

* test_compact_and_uncompact_cells

* convert a few more tests

* add h3.Polygon class

* lint

* migrating some tests

* this shift_circular_list thing makes these tests too hard to understand...

* remove shift_circular_list and convert a few more tests

* last of the tests in test_h3.py converted

* last of the tests converted

* note for polygons_to_cells in the future

* Try out a __repr__ for h3.Polygon

* test_polygon_class.py

* use `cells` instead of `hexes` throughout the library and tests

* docstring for Polygon

* docstrings for functions

* use `res` convention for resolution parameters

Co-authored-by: Isaac Brodsky <[email protected]>
Co-authored-by: David Ellis <[email protected]>
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.

3 participants