gempy.save_model¶
- gempy.save_model(model: GeoModel, path: str | None = None, validate_serialization: bool = True)[source]¶
Save a GemPy geological model to a
.gempyfile.The saved file contains the model definition, including its structural data, model configuration, and grid information. Computed model solutions are not restored when the file is loaded and need to be recomputed with
gempy.compute_model().- Parameters:
model (GeoModel) – The geological model to save.
path (str | None) – Path where the model should be saved. If
None, the model name is used and the file is saved as<model_name>.gempyin the current working directory. If the supplied path has no extension,.gempyis appended automatically. Parent directories are created if they do not already exist.validate_serialization (bool) – If
True, GemPy deserializes the model in memory and validates the result before writing the file. Defaults toTrue.
- Returns:
The path of the saved file, including the
.gempyextension if it was added automatically.- Return type:
str
- Raises:
ValueError – If
pathspecifies a file extension other than.gempy.
Notes
Model serialization is currently under active development and the
.gempyformat may change in future versions. The saved file includes serialization metadata with the GemPy package version and serialization format version used to write the model.