Field.nc_set_group_attribute(prop, value=None)[source]

Select a property to be written as a netCDF group attribute.

New in version (cfdm): 1.8.6

prop: str

Select the property to be written (if possible) as a netCDF group attribute.

value: optional

The value of the netCDF group attribute, which will be created (if possible) in addition to the property as written to a netCDF data variable. If unset (or None) then this acts as an instruction to write the property (if possible) to a netCDF group attribute instead of to a netCDF data variable.




>>> f.nc_group_attributes()
{'comment': None}
>>> f.nc_set_group_attribute('foo')
>>> f.nc_group_attributes()
{'comment': None, 'foo': None}
>>> f.nc_set_group_attribute('foo', 'bar')
>>> f.nc_group_attributes()
{'comment': None, 'foo': 'bar'}
>>> f.nc_group_attributes(values=True)
{'comment': 'forecast comment', 'foo': 'bar'}
>>> f.nc_clear_group_attributes()
{'comment': None, 'foo': 'bar'}
>>> f.nc_group_attributes()