cf.Field.nc_global_attributes

Field.nc_global_attributes()[source]

Return the selection of properties to be written as netCDF global attributes.

When multiple field constructs are being written to the same file, it is only possible to create a netCDF global attribute from a property that has identical values for each field construct. If any field construct’s property has a different value then the property will not be written as a netCDF global attribute, even if it has been selected as such, but will appear instead as attributes on the netCDF data variables corresponding to each field construct.

The standard description-of-file-contents properties are always written as netCDF global attributes, if possible, so selecting them is optional.

New in version 1.7.0.

Returns:
dict

The selection of properties requested for writting to netCDF global attributes.

Examples:

>>> f.nc_global_attributes()
{'Conventions': None, 'comment': None}
>>> f.nc_set_global_attribute('foo')
>>> f.nc_global_attributes()
{'Conventions': None, 'comment': None, 'foo'}
>>> f.nc_set_global_attribute('comment', 'global comment')
>>> f.nc_global_attributes()
{'Conventions': None, 'comment': 'global_comment', 'foo'}
>>> f.nc_clear_global_attributes()
{'Conventions': None, 'comment': 'global_comment', 'foo'}
>>> f.nc_global_attributes()
{}