MCPcopy Create free account
hub / github.com/Cantera/cantera / save

Method save

interfaces/cython/cantera/composite.py:1236–1280  ·  view source on GitHub ↗

Save current `SolutionArray` contents to a data file. Data can be saved either in CSV format (extension ``*.csv``), YAML container format (extension ``*.yaml``/``*.yml``) or HDF container format (extension ``*.h5``/``*.hdf5``/``*.hdf``). The output format is automat

(self, fname, name=None, sub=None, description=None, *,
             overwrite=False, compression=0, basis=None)

Source from the content-addressed store, hash-verified

1234 self.restore_data(data_dict, normalize)
1235
1236 def save(self, fname, name=None, sub=None, description=None, *,
1237 overwrite=False, compression=0, basis=None):
1238 """
1239 Save current `SolutionArray` contents to a data file.
1240
1241 Data can be saved either in CSV format (extension ``*.csv``), YAML container
1242 format (extension ``*.yaml``/``*.yml``) or HDF container format (extension
1243 ``*.h5``/``*.hdf5``/``*.hdf``). The output format is automatically inferred from
1244 the file extension.
1245
1246 CSV files preserve state data and auxiliary data for a single `SolutionArray` in
1247 a comma-separated text format, container files may hold multiple `SolutionArray`
1248 entries in an internal hierarchical structure. While YAML is a human-readable
1249 text format, HDF is a binary format that supports compression and is recommended
1250 for large datasets.
1251
1252 For container files (YAML and HDF), header information contains automatically
1253 generated time stamps, version information and an optional description.
1254 Container files also preserve `SolutionArray` metadata (example:
1255 `SolutionArray` objects generated by `Sim1D` store simulation settings).
1256
1257 :param fname:
1258 Name of output file (CSV, YAML or HDF)
1259 :param name:
1260 Identifier of storage location within the container file; this node/group
1261 contains header information and a subgroup holding actual `SolutionArray`
1262 data (YAML/HDF only).
1263 :param sub:
1264 Name identifier for the subgroup holding the `SolutionArray` data and
1265 metadata objects. If `None`, the subgroup name defaults to ``data``
1266 (YAML/HDF only).
1267 :param description:
1268 Custom comment describing the dataset to be stored (YAML/HDF only).
1269 :param overwrite:
1270 Force overwrite if file/name exists; optional (default=`False`)
1271 :param compression:
1272 Compression level (0-9); optional (default=0; HDF only)
1273 :param basis:
1274 Output mass (``Y``/``mass``) or mole (``Y``/``mass``) fractions;
1275 if not specified (`None`), the native basis of the underlying `ThermoPhase`
1276 manager is used.
1277
1278 .. versionadded:: 3.0
1279 """
1280 self._cxx_save(fname, name, sub, description, overwrite, compression, basis)
1281
1282 def restore(self, fname, name=None, sub=None):
1283 """

Callers 1

_to_picklableMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected