ncdata.utils package#

General user utility functions.

ncdata.utils.save_errors(ncdata)#

Scan a dataset for it’s consistency and completeness.

Reports on anything that will make this fail to save. If there are any such problems, then an attempt to save the ncdata to a netcdf file will fail. If there are none, then a save should succeed.

The checks made are roughly the following

  1. check names in all components (dimensions, variables, attributes and groups):

  • all names are valid netcdf names

  • all element names match their key in the component, i.e. “component[key].name == key”

  1. check that all attribute values have netcdf-compatible dtypes. (E.G. no object or compound (recarray) dtypes).

  2. check that, for all contained variables :

  • it’s dimensions are all present in the enclosing dataset

  • it has an attached data array, of a netcdf-compatible dtype

  • the shape of it’s data matches the lengths of it’s dimensions

Parameters:

ncdata (NcData) – data to check

Returns:

A list of strings, error messages describing problems with the dataset. If no errors, returns an empty list.

Return type:

errors