Skip to content

Commit d79b957

Browse files
committed
[ENH/WIP] Add warnings for development status and adjust tests
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.
1 parent 69c5b58 commit d79b957

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

docs/developers_notes/dev_log/2025_05.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@
2626
- Solutions (Not sure if I want to save them)
2727
- RawArraysSolutions
2828
- Solutions
29+
- Testing
30+
- [ ] 10 Test to go in modules
31+
- [ ] test api
2932

3033
## What do I have in the engine server logic?

gempy/modules/serialization/save_load.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
from ...core.data import GeoModel
24
from ...core.data.encoders.converters import loading_model_from_binary
35
from ...optional_dependencies import require_zlib
@@ -21,6 +23,10 @@ def save_model(model: GeoModel, path: str | None = None, validate_serialization:
2123
ValueError
2224
If the file has an extension other than .gempy
2325
"""
26+
27+
# Warning about preview
28+
warnings.warn("This function is still in development. It may not work as expected.")
29+
2430
# Define the valid extension for gempy models
2531
VALID_EXTENSION = ".gempy"
2632
if path is None:
@@ -80,6 +86,10 @@ def load_model(path: str) -> GeoModel:
8086
FileNotFoundError
8187
If the file doesn't exist
8288
"""
89+
90+
# Warning about preview
91+
warnings.warn("This function is still in development. It may not work as expected.")
92+
8393
VALID_EXTENSION = ".gempy"
8494

8595
# Check if path has the valid extension

test/test_modules/_geophysics_TO_UPDATE/test_gravity.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def test_gravity():
5757
structural_frame=frame,
5858
)
5959

60-
gp.compute_model(geo_model)
60+
# gp.compute_model(geo_model)
6161

6262
import gempy_viewer as gpv
6363
gpv.plot_2d(geo_model, cell_number=0)
@@ -75,6 +75,15 @@ def test_gravity():
7575
densities=np.array([2.6, 2.4, 3.2]),
7676
)
7777

78+
model_json = geo_model.model_dump_json(by_alias=True, indent=4)
79+
80+
return
81+
from pydantic_core import from_json
82+
83+
json = from_json(model_json, allow_partial=True)
84+
model_deserialized = gp.data.GeoModel.model_validate(json)
85+
86+
return
7887
gp.compute_model(geo_model)
7988

8089
print(geo_model.solutions.gravity)

test/test_modules/test_serialize_model.test_generate_horizontal_stratigraphic_model.verify/Horizontal Stratigraphic Model serialization.approved.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
},
2929
"_model_transform": null
3030
},
31-
"vertices": null,
32-
"edges": null,
3331
"scalar_field_at_interface": null,
3432
"_id": 117776925
3533
},
@@ -51,8 +49,6 @@
5149
},
5250
"_model_transform": null
5351
},
54-
"vertices": null,
55-
"edges": null,
5652
"scalar_field_at_interface": null,
5753
"_id": 67239155
5854
}

0 commit comments

Comments
 (0)