fix: migrate AssimilatorEncoder to H3 v4 API#218
Merged
jacobbieker merged 1 commit intoJun 2, 2026
Conversation
- Replace 6 deprecated h3 v3 calls with v4 equivalents - Fix np.random.random(1) -> np.random.random() for numpy 2.x - Matches existing pattern in encoder.py and assimilator_decoder.py
Contributor
Author
|
@jacobbieker Gentle ping on this one , just the H3 v3 → v4 API migration (6 call sites in AssimilatorEncoder + numpy 2.x test fixes). No functional changes, all existing tests pass. Let me know if anything needs adjusting. |
Collaborator
Hi, When you open ones, please assign me as a reviewer, otherwise I don't get notified. |
jacobbieker
approved these changes
Jun 2, 2026
jacobbieker
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, thanks for this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
AssimilatorEncoderuses deprecated H3 v3 API calls (geo_to_h3,h3_to_geo,point_dist,k_ring, etc.), but the repo pinsh3==4.3.1. This causesAttributeErroron instantiation — the class is unusable under the pinned version.The sibling classes (
Encoder,AssimilatorDecoder) were already migrated to v4. This bringsAssimilatorEncoderin line.Changes
assimilator_encoder.py— 6 mechanical name substitutions:h3.uncompact(h3.get_res0_indexes(), ...)→h3.uncompact_cells(h3.get_res0_cells(), ...)h3.num_hexagons()→h3.get_num_cells()h3.geo_to_h3()→h3.latlng_to_cell()h3.h3_to_geo()→h3.cell_to_latlng()h3.point_dist()→h3.great_circle_distance()h3.k_ring()→h3.grid_disk()tests/test_model.py:h3.num_hexagons→h3.get_num_cells(same migration)np.random.random(1)→np.random.random()(fixes numpy 2.x incompatibility that was hidden behind the H3 crash)Testing
test_assimilation_encoder_uneven_grid: was crashing withAttributeError, now passestest_assimilator_model,test_assimilator_model_grad_checkpoint: same, now passtorch-clusterfailures unchanged)