-
-
Notifications
You must be signed in to change notification settings - Fork 262
[ENH] Add model serialization validation and refactor grid modules #1032
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
Conversation
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
This was referenced May 22, 2025
4 tasks
4 tasks
Graphite Automations"Add gempy label" took an action on this PR • (05/23/25)1 label was added to this PR based on Miguel de la Varga's automation. |
Merge activity
|
Refactored `StructuralElement` attributes to use Pydantic's `Field` for improved data validation and added `exclude=True` where necessary. Enhanced serialization test to include model save after computation with validation.
Add warnings to indicate that save/load functions are in development and may not work as expected. Updated test cases by commenting unused computations, modifying object serialization, and adding placeholders for future functionality.
Add detailed validation for serialized GeoModel instances, including debugging for string differences and hash checks. Introduce `verify_model_serialization` with pre/post-deserialization checks, and update gravity tests for structured verification and data type consistency.
Expose `geophysics_input` and integrate gravity gradient calculation during deserialization. This ensures proper resetting of geophysics-specific fields when grid data is available.
Replaced hardcoded file paths with `tempfile.NamedTemporaryFile` to ensure safe and temporary file handling during serialization tests. This improves test reliability and avoids residual files on disk.
Simplified imports and removed unused `SectionDefinition` class. Adjusted and clarified type annotations while ensuring internal fields are properly excluded from serialization.
Refactored `regular_grid` to `_regular_grid` to indicate it as a private attribute. This change ensures better encapsulation and aligns with naming conventions.
Introduces a new approved test file to validate grid sections in `test_grids_sections`. This ensures consistency and accuracy in grid-related functionality during testing.
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.

Description
Refactored grid modules to improve serialization and added validation capabilities to the model computation process. Key changes include:
Relates to #serialization-improvements
Checklist
or 2. verifies that outputs are as expected for given inputs (e.g. unit tests).