feat: add variable-resolution latent graph builder#227
Merged
jacobbieker merged 1 commit intoJul 5, 2026
Conversation
This was referenced Jun 30, 2026
jacobbieker
approved these changes
Jul 5, 2026
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.
Pull Request
Description
Builds on #226.
build_variable_resolution_meshreturns a mixed-resolution cell set, coarse over the globe and fine over the region, and this PR turns that set into the latent graph the processor message-passes over.The problem is the seam between the two resolutions. Same-resolution neighbours come from
grid_disk, but that never crosses from a coarse cell to a fine one, so on its own the fine region is a disconnected island and no information flows in or out. Each fine cell is therefore also linked to the coarse cells bordering its coarse ancestor, found withcell_to_parentand thengrid_diskon that parent, keeping the coarse cells that are actually present in the mesh. Edges are bidirectional and carry[sin d, cos d]of the great-circle distance between cell centres, the same edge feature the single-resolution builder already uses.Pure function: it takes a cell list and returns a
torch_geometricData. No model or training changes yet - wiring it into the forecaster and resizing the embedding table come in later PRs.Related to #3
How Has This Been Tested?
Added
tests/test_stretched_latent_graph.py- plain pytest, runs entirely on h3, no network:edge_attris[E, 2]with each row on the unit circleCommands:
pytest tests/test_stretched_latent_graph.py -q-> 7 passedruff check graph_weather/models/layers/stretched_latent_graph.py tests/test_stretched_latent_graph.py-> cleanChecklist: