cf.Field.nc_set_group_attributes¶
-
Field.
nc_set_group_attributes
(properties, copy=True)[source]¶ Set properties to be written as netCDF group attributes.
New in version (cfdm): 1.8.6
- Parameters
- properties:
dict
Set the properties be written as a netCDF group attribute from the dictionary supplied. The value of a netCDF group attribute, which will be created (if possible) in addition to the property as written to a netCDF data variable. If a value of
None
is used then this acts as an instruction to write the property (if possible) to a netCDF group attribute instead of to a netCDF data variable.- Parameter example:
properties={'Conventions': None, 'project': 'research'}
- copy:
bool
, optional If False then any property values provided by the properties parameter are not copied before insertion. By default they are deep copied.
- properties:
- Returns
Examples
>>> 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() {}