gempy.save_model

gempy.save_model(model: GeoModel, path: str | None = None, validate_serialization: bool = True)[source]

Save a GemPy geological model to a .gempy file.

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>.gempy in the current working directory. If the supplied path has no extension, .gempy is 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 to True.

Returns:

The path of the saved file, including the .gempy extension if it was added automatically.

Return type:

str

Raises:

ValueError – If path specifies a file extension other than .gempy.

Notes

Model serialization is currently under active development and the .gempy format 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.

Examples using gempy.save_model

Basics: Data Classes and Modeling API

Basics: Data Classes and Modeling API

Saving and Loading gempy Models

Saving and Loading gempy Models