gordias.datahandling.save#
- gordias.datahandling.save(result: Cube, output_filename: str, iterative_storage: bool = False, client: Client | None = None, conventions_override: bool = False, configuration: dict[str, Any] | None = None) None#
Save a single cube (iris.cube.Cube) to the given output filename.
If there are outstanding computations in lazy data in the cube, this function realizes the results, i.e. performs all outstanding computations, loading the input data into memory. To avoid memory problems, we offer two different approaches on how this is done:
If iterative_storage is True, first an empty cube is saved, putting all metadata and coordinates in place, then the result is realized and stored one timeslice at a time, sequentially. This potentially reduces parallelism, but also reduces memory requirements. Furthermore, it means that on unplanned termination, all finished calculations are already stored.
If iterative_storage is False, the complete result is realized first, maximizing the parallel use of the cluster as exposed by client, but potentially leading to memory problems if there are large intermediate results. This also means that all results are lost in the case of unplanned termination. To use this option a client must be provided to the client input parameter.
If conventions_override is False, the global attribute Conventions will be added as the default CF conventions version in iris. If True and Conventions exists in the global attributes the default Conventions will be overrided.
A configuration can be given to apply the output configuration for creating global attributes to the output file.
- Parameters:
result (iris.cube.Cube) – The iris cube to be saved.
output_filename (string) – The filename of the output. Must refer to a netCDF4 file, i.e. .nc.
iterative_storage (bool, optional) – Whether to perform iterative storage (see above). By default set to False.
client (
distributed.Client, optional) – Thedistributed.Clientobject giving access to the cluster.conventions_override (bool, optional) – Whether the existing global attribute Conventions will override the default CF conventions version in iris. By default set to False.
configuration (dict[str, Any] or None, optional) – A dictionary with configuration objects.