cfdm.Field.dataset_compliance

Field.dataset_compliance(display=False)[source]

Return the dataset compliance report.

A report of problems encountered whilst reading the construct from a dataset.

If the dataset is partially CF-compliant to the extent that it is not possible to unambiguously map an element of the netCDF dataset to an element of the CF data model, then a construct is still returned by the read function, but may be incomplete.

Such “structural” non-compliance would occur, for example, if the coordinates attribute of a CF-netCDF data variable refers to another variable that does not exist, or refers to a variable that spans a netCDF dimension that does not apply to the data variable.

Other types of non-compliance are not checked, such whether or not controlled vocabularies have been adhered to.

When a dictionary is returned, the compliance report may be updated by changing the dictionary in-place.

New in version (cfdm): 1.7.0

See also

cfdm.read, _set_dataset_compliance

Parameters
display: bool, optional

If True print the compliance report. By default the report is returned as a dictionary.

Returns
None or dict

The report. If display is True then the report is printed and None is returned. Otherwise the report is returned as a dictionary.

Examples

If no problems were encountered, an empty dictionary is returned:

>>> f = cfdm.example_field(1)
>>> cfdm.write(f, 'example.nc')
>>> g = cfdm.read('example.nc')[0]
>>> g.dataset_compliance()
{}