0
Fork 0
mirror of https://github.com/uber/h3-py.git synced 2026-11-16 07:44:46 +00:00
Commit graph

21 commits

Author SHA1 Message Date
AJ Friend
f9c1a944d1
Bump h3lib to v4.4.1 and add new functions/errors (#470)
* bump h3lib to v4.4.0

* bump h3lib to v4.4.1

* tests pass with new version

* add new error codes and some helper functions around error codes

* jupyter-book<2

* is_valid_index

* tests for is_valid_index and get_index_digit

* linting

* good set of tests

* lint

* thank you, coverage tests for tests!

* int api test

* function docstrings

* maybe not

* changelog. don't expose error code helper functions (yet)

* ticks

* don't even mention 'em

* `list` rather than `tuple`, since users are likely to mutate result

* remove justfile

* failing tests

* tests should be passing

* more tests

* swap docs order
2025-11-22 08:17:21 -08:00
AJ Friend
1ac484a8db
h3shape_to_cells_experimental takes string containment modes (#436)
* polygon to cells just takes string arguments

* don't need enum

* docstrings

* have tests use h3shape_to_cells_experimental

* clean up tests

* don't repeat tests

* experimental warning

* Being experimental, try `contain` instead of `containment` in params

* try typing with literal

* add polygon_to_cells_experimental.

Contains coverage and lint errors -- just checking that they raise in CI

* ruff fix

* docs and changelog

* add test_polygon_to_cells_experimental for full coverage

* test notes
2025-01-26 16:57:31 -08:00
AJ Friend
e9506ffa6d
2nd attempt at ruff (#428)
* starting

* ruff config

* fix notebook

* more rules

* F rules

* sort rules

* Q rules

* remove F401

* sort

* don't ignore F841

* being ridiculous

* some todo rules

* try gh action

* a few more ideas to try

* gitignore

* clean up toml
2024-10-28 13:31:38 -07:00
AJ Friend
259f31b6c8
cell_to_child_pos, child_pos_to_cell, cell_to_children_size (#405)
* cell_to_child_pos and child_pos_to_cell

* start exposing cell_to_children_size

* checking resolutions

* cell_to_children_size python function

* adding tests from https://github.com/uber/h3-py/pull/404

* fiddling

* fix test_cell_to_vertex; helps coverage by removing untouched branch

* more tests

* lint

* exhaustive test for a few resolution pairs

* lint

* doc strings

* error messages

* stricter test

* playing with argument order. example code in tests looks nicer

* use parent_res instead of res

* Use `res_*` instead of `*_res`

* fix up changelog
2024-09-27 15:25:56 -07:00
AJ Friend
6c4ae92b24
i like this order better (#400) 2024-09-26 12:44:01 -07:00
Shiran Yuan
46a7181b3f
Added Bindings for Vertex-Related Functions (#388)
* Update CHANGELOG.md

* Update h3lib.pxd

* Update latlng.pxd

* Update latlng.pyx

* Update util.pxd

* Update util.pyx

* Update _version.py

* Update __init__.py

* Update __init__.py

* Update test_h3.py

* Update __init__.py

* Update test_h3.py

* Update CHANGELOG.md

* Update __init__.py

* Update test_h3.py

* Update _version.py

* Update test_h3.py

* Update __init__.py

* Update CMakeLists.txt

* Update latlng.pxd

* Update latlng.pyx

* Create vertex.pxd

* Create vertex.pyx

* Update __init__.py

* Update test_h3.py

* Update __init__.py

* Update api_quick.md
2024-08-27 08:05:20 -07:00
AJ Friend
f0fc6df6c3
Introduce LatLngPoly and LatLngMultiPoly (#364)
* introduce LatLngPoly

* LatLngPoly in files other than *.py

* drop 3.7 tests

* intro LatLngMultiPoly to .py files

* ...and to non .py files

* h3shape to just shape in .py files

* Class names

* function names

* H3Shape -> Shape

* filename

* Revert "H3Shape -> Shape"

This reverts commit 389725312f.

* Revert "filename"

This reverts commit b263a3e9dc.

* revert

* fix docs

* fix what David found

* rename params from `shape` to `h3shape`

* ...and a few more

* one more

* def cells_to_h3shape(cells, *, tight=True)
2024-05-18 09:46:14 -07:00
AJ Friend
26285eff78
Docs for polygon interface (#362)
* initial stab at documenting polygon interface

* Separate out verbose descriptions

* Nicer flow

* improvements

* avoid using "set"

* move compact functions

* move geo functions

* "grid distance" is better than "H3 distance"

* lint

* units

* clean up contributing

* warning about function name changes

* don't need to specify title

* update copyright

* add a warning about lat/lng order

* try this

* give the geo_interface link

* sphinx 7.3 introduced an issue

* document bug

* better organization of functions

* green is a friendlier color

* don't need this

* sphinx bug is fixed with 7.3.3
2024-04-17 09:32:40 -07:00
AJ Friend
c09c43ef0a
Update docs to include polygon tutorial (#355)
* docs building correctly again

* drop beta announcement

* cleaning up docs a bit

* i think this is where it was at...

* bump beta in readme announcement

* update action

* pssssst. it's a secret

* separate upload docs step

* setps taken

* want --warningiserror

* need requirements for notebook

* no need to run linter here

* does this default thing work?

* alas, chatgpt led me astray

* gimme an artifact to check

* bump to actions/upload-artifact@v4.3.1

* slightly better names

* artifacts need names now

* set python version for sdist

* try this one

* all unique names

* try cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}

* try merge action

* try combining sdist and wheels into single result

* upload should work

* bump to pypa/gh-action-pypi-publish@v1.8.14

* try pypa/cibuildwheel@v2.17.0

* Revert "try pypa/cibuildwheel@v2.17.0"

This reverts commit fa8f7c9ab3.

* SDist doesn't need a strategy matrix

* shorten names for cibw

* bump actions/download-artifact@v4.1.4
2024-04-14 09:36:07 -07:00
AJ Friend
831d50bbe3
GeoJSON functions (#301)
* polygons_to_cells

* Helpers for cells_to_geojson and geojson_to_cells

* ValueError

* Remove gj (#316)

* Remove geojson logic from cell_to_boundary and directed_edge_to_boundary

* fix a warning about return values in tests from pytest

* Remove geo_json logic from cells_to_multi_polygon

* remove some unused tests

* add back in polygons_to_cells

* actions/setup-python@v4.5.0

* Solution copied from https://github.com/actions/setup-python/issues/544

* playing around with polygons

* make a directory

* bah

* start migrating `h3.Polygon` to `H3Poly`

* migrate most

* finish migrating

* H3MultiPoly repr

* shape_to_cells and cells_to_shape

* tests: polygon_to_cells to shape_to_cells

* finish migrating tests

* update util.py and example

* notes

* bah

* fix lint

* fix

* remove X_to_shape

* run tests

* run other CIs too

* don't use f-string

* test update

* change errors per review

* remove unused per review

* fix lint

* test run

* fix exclude logic in tests

* " to ' in yaml

* move conversion logic to geo_to_cells function

* linting

* few more tests

* lint

* clean up

* complete tests

* group geojson/polygon tests into a folder

* move MockGeoInterface into the file that uses it

* move test_input_format to its own file, since it has a lot of helper functions not used elsewhere

* test module description

* rename _polygon.py to _h3shape.py

* make H3Shape an ABC

* shape -> h3shape

* geos to polys

* rename geo files to latlng

* docstrings

* __init__.py

* lint

* notebooks

* more interface tests

* notebooks

* merp

* clean up geo_to_h3shape()

* simplify sydney coords

* simplify far east test

* simplify sf coords

* tuples

* geo interface tests

* more interface tests

* clean up maine lat/lngs

* messed up lat/lng order in tests. this mistake gets made all the time!

* expand geo_to_h3shape test

* plotting with contextily and geoviews

* reprs for H3Shape objects should work better with geopandas

* different representations of the same information. which is best?

* us "loopcode" in H3Poly and H3MultiPoly reprs

* set tight=True as default

* can't use f-strings in python 3.5

* notebooks

* basic plotting

* plotting

* plotting

* tutorial notebook

* cleaning up

* clean up geoviews example

* remove geoviews example

* todos

* reworking tutorial order

* notebook dump

* cleaner

* move tutorial

* Update src/h3/api/_api_template.py

Co-authored-by: Jongbin Jung <jungjongbin86@gmail.com>

* Update src/h3/api/_api_template.py

Co-authored-by: Isaac Brodsky <isaac@isaacbrodsky.com>

* Update src/h3/api/_api_template.py

Co-authored-by: Jongbin Jung <jungjongbin86@gmail.com>

* setting loops

* bug and lint

---------

Co-authored-by: Isaac Brodsky <isaac@isaacbrodsky.com>
Co-authored-by: Jongbin Jung <jungjongbin86@gmail.com>
2023-12-30 15:16:02 -08:00
AJ Friend
6462bf78a3
Merge dev_v4 into master (#250)
* 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 <isaac@unfolded.ai>

* 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 <ajfriend@gmail.com>

* add some error checks

* comments

* comments

* clearer logical flow

* arrays are different from memoryviews!

* little cleaner

* Revert "comments"

This reverts commit 80c3f4d382.

* Revert "Revert "comments""

This reverts commit a9d6590b04.

* Revert "comments"

This reverts commit 24904bdcea.

* 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 7e72adb590.

* clarify branches

* remove simple_mv

* moving around

* clean up

* comments

* comments

* comments

Co-authored-by: Isaac Brodsky <isaac@unfolded.ai>

* 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 <isaac@unfolded.ai>
Co-authored-by: David Ellis <isv.damocles@gmail.com>
2022-08-22 23:31:19 -07:00
AJ Friend
5f85b83353
Update to ilammy/msvc-dev-cmd@v1.10.0 based on #207 (#209)
* getting working

* bah warnings!

* docs in a good place

* add favicon

* warning on incomplete API

* note on keeping docs from deploying on PRs

* organizing function summaries

* api function grouping

* api types

* changelog

* admonitions

* api clean up

* compute time example

* function defs organization

* looking good

* DRY-up readme!

* clean up links

* api_comparison

* clean up readme

* shmallish changes

* absolute links in the readme.md

* fix readme links

* use the fancier markdown link reference syntax

* a version of the versioning docs

* make it personal

* 'with' a little more parallelism in our sentences

* Update docs/api_comparison.md

Co-authored-by: Kyle Barron <kylebarron2@gmail.com>

* clean makefile

* docs

* move timings to a single table

* clean

* Update docs/api_reference.md

Co-authored-by: Isaac Brodsky <isaac@isaacbrodsky.com>

* represent

* default api likes its str's

* docs nits

* Update actions based on #207

Co-authored-by: Kyle Barron <kylebarron2@gmail.com>
Co-authored-by: Isaac Brodsky <isaac@isaacbrodsky.com>
2022-02-13 13:55:52 -08:00
AJ Friend
c1bee7dff0
Docs improvements: Align readme and website intro, API documentation (#199)
* getting working

* bah warnings!

* docs in a good place

* add favicon

* warning on incomplete API

* note on keeping docs from deploying on PRs

* organizing function summaries

* api function grouping

* api types

* changelog

* admonitions

* api clean up

* compute time example

* function defs organization

* looking good

* DRY-up readme!

* clean up links

* api_comparison

* clean up readme

* shmallish changes

* absolute links in the readme.md

* fix readme links

* use the fancier markdown link reference syntax

* a version of the versioning docs

* make it personal

* 'with' a little more parallelism in our sentences

* Update docs/api_comparison.md

Co-authored-by: Kyle Barron <kylebarron2@gmail.com>

* clean makefile

* docs

* move timings to a single table

* clean

* Update docs/api_reference.md

Co-authored-by: Isaac Brodsky <isaac@isaacbrodsky.com>

* represent

* default api likes its str's

Co-authored-by: Kyle Barron <kylebarron2@gmail.com>
Co-authored-by: Isaac Brodsky <isaac@isaacbrodsky.com>
2021-09-07 20:40:27 -04:00
AJ Friend
e3668e6da8
Getting docs to a good starting point (#197)
* getting working

* bah warnings!

* docs in a good place

* add favicon

* warning on incomplete API
2021-08-20 11:59:30 -07:00
AJ Friend
53e7a42114 Uber Technologies as author 2021-08-13 17:39:09 -07:00
AJ Friend
232ca55e3e docs 2021-08-13 16:39:58 -07:00
Niel Hu
8f26f7308c delete docs, add link of h3-py-notebooks on readme 2019-07-01 13:48:07 -07:00
Sina Kashuk
d6b2726e1b
add unified data layers example 2018-11-14 14:12:46 -08:00
Isaac Brodsky
59c6405543 Remove unused imports & delete empty cell
Also gitignore the IPython checkpoints directory
2018-08-16 16:28:35 -07:00
Isaac Brodsky
c195c1b770 Fix cell boundary function name 2018-08-16 15:42:58 -07:00
Niel Hu
3e3a7fa090 first commit 2018-07-30 12:24:17 -07:00