improver.utilities.load module

Module for loading cubes.

improver.utilities.load.load_cube(filepath, constraints=None, no_lazy_load=False, allow_none=False)[source]

Load the filepath provided using Iris into a cube.

Parameters
  • filepath (str or list) – Filepath that will be loaded or list of filepaths that can be merged into a single cube upon loading.

  • constraints (iris.Constraint, str or None) – Constraint to be applied when loading from the input filepath. This can be in the form of an iris.Constraint or could be a string that is intended to match the name of the cube. The default is None.

  • no_lazy_load (bool) – If True, bypass cube deferred (lazy) loading and load the whole cube into memory. This can increase performance at the cost of memory. If False (default) then lazy load.

  • allow_none (bool) – If True, when the filepath is None, returns None. If False, normal error handling applies. Default is False.

Returns

Cube that has been loaded from the input filepath given the constraints provided.

Return type

iris.cube.Cube

improver.utilities.load.load_cubelist(filepath, constraints=None, no_lazy_load=False)[source]

Load one cube from each of the filepath(s) provided using Iris into a cubelist.

Parameters
  • filepath (str or list) – Filepath(s) that will be loaded, each containing a single cube. If wildcarded, this will be expanded into a list of file names so that only one cube is loaded per file.

  • constraints (iris.Constraint, str or None) – Constraint to be applied when loading from the input filepath. This can be in the form of an iris.Constraint or could be a string that is intended to match the name of the cube. The default is None.

  • no_lazy_load (bool) – If True, bypass cube deferred (lazy) loading and load the whole cube into memory. This can increase performance at the cost of memory. If False (default) then lazy load.

Returns

CubeList that has been created from the input filepath given the constraints provided.

Return type

iris.cube.CubeList