gordias.datahandling.save#
- gordias.datahandling.save(result: Cube, output_filename: str, split_output: str | None = None, client: Client | None = None, overwrite: bool = False, conventions_override: bool = False, configuration: dict[str, Any] | None = None) None#
Save a single cube (iris.cube.Cube) to the given output filename.
Uses iris save function to store the result chunkwise in parallel.
If split_output is used, the cube will be split into multiple cubes. These cubes are then saved separately and the date in the output filename will be replaced with the date of the stored cube.
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.
spit_output (str | None) – A string defining if the output should be split into multiple files. Valid options: month, season, year, and year[nr]. Default is None, which means the output will not be split.
client (
distributed.Client, optional) – Thedistributed.Clientobject giving access to the cluster.overwrite (bool) – Can be used to overwrite already existing files with the same output_filename. Default is False.
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.
- Raises:
RuntimeError – If overwrite is not activated and the output filename already exists.