save#, **kwargs)[source]#

Save simulations, surveys, meshes, models, fields, and more to disk.

Serialize and save data to disk in different formats (see parameter description of fname for the supported file formats).

Any other (non-emg3d) object can be added too, as long as it knows how to serialize itself.

The serialized instances will be de-serialized if loaded with


File name with absolute or relative path including suffix, which defines the used data format. Implemented are currently:

  • .h5: Uses h5py to store inputs to a hierarchical, compressed binary HDF5 file. Recommended file format, but requires the module h5py.

  • .npz: Uses numpy to store inputs to a flat, compressed binary file.

  • .json: Uses json to store inputs to a hierarchical, plain text file.

compression{int, str}, default: ‘gzip’

Passed through to h5py.

json_indent{int, None}, default: 2

Passed through to json.

verbint, default: 1

Verbose if 1, if 0 silent; if -1 it returns the info as string instead of printing it.


Data to save using its key as name.

Note that the provided data cannot contain the before described parameters as keys.

infostr, returned if verb<0