Promote GLOBE rank schema utilities to physicsnemo.mesh#1769
Queued
peterdsharpe wants to merge 3 commits into
Queued
Promote GLOBE rank schema utilities to physicsnemo.mesh#1769peterdsharpe wants to merge 3 commits into
peterdsharpe wants to merge 3 commits into
Conversation
physicsnemo/mesh/fields.py introduces representation-neutral RankSpecDict helpers for flattening, validation, rank counting, TensorDict inference, and declared-data checks. It also adds ScalarVectorFields and a deterministic FieldLayout that packs and unpacks named rank-0 scalars and rank-1 polar vectors without mixing their transformation laws. physicsnemo/mesh/__init__.py exports the schema and layout API from the stable mesh namespace so mesh-based models can share one field contract. physicsnemo/experimental/models/globe/field_kernel.py and model.py now import these neutral utilities from physicsnemo.mesh. The old GLOBE-specific rank_spec.py module and its utilities/__init__.py re-exports are removed, while tensordict_utils.py points schema users to the mesh module. test/mesh/test_fields.py verifies nested schemas, deterministic channel ordering, scalar/vector shape validation, round trips, empty layouts, and useful errors for missing or incorrectly ranked data. Centralizing these semantics avoids model-specific duplication and gives future mesh layers a common, explicitly representation-aware field interface.
Contributor
Greptile SummaryThis PR promotes GLOBE-specific rank-spec utilities into the shared
Important Files Changed
Reviews (1): Last reviewed commit: "Promote field schemas and layouts to phy..." | Re-trigger Greptile |
Remove a redundant point-count branch from FieldLayout.unpack(): the preceding full vector-shape check already enforces the same leading dimension. Restore the required separation between top-level field-schema tests.
Collaborator
Author
|
/ok to test e3a91e2 |
Remove FieldLayout, ScalarVectorFields, validate_rank_spec, and their supporting tests and exports because they have no consumers on main. Keep this branch as a pure relocation of the RankSpecDict helpers already used by GLOBE; representation-aware packing can be introduced with the feature that needs it.
Collaborator
Author
|
/ok to test 2e66c44 |
coreyjadams
approved these changes
Jul 1, 2026
coreyjadams
left a comment
Collaborator
There was a problem hiding this comment.
Straightforward relocation, seems reasonable to me!
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.
Summary
This moves the rank-schema helpers already used by GLOBE into
physicsnemo.mesh, where other mesh-based models can reuse them. GLOBE now imports the helpers from their shared location, and the old experimental module and re-exports are removed.This is a code-ownership move rather than a new field-layout or packing API; the existing rank-schema behavior is preserved.
Testing
test/mesh/test_fields.pycovers nested schemas, rank counting,TensorDictinference, and validation errors. Existing GLOBE tests continue to cover the consumers.