Write fields to a CF-netCDF file.
NetCDF dimension and variable names will be taken from variables’ ncvar attributes and the space attribute nc_dimensions if present, otherwise they are inferred from standard names or set to defaults. NetCDF names may be automatically given a numerical suffix to avoid duplication.
Output netCDF file global attributes are those which occur in the set of CF global attributes and non-standard data variable attributes and which have equal values across all input fields.
Logically identical field components are only written to the file once, apart from when they need to fulfil both dimension coordinate and auxiliary coordinate roles for different data variables.
Parameters : |
|
---|---|
Returns : | None |
Raises : |
|
Examples
>>> f
[<CF Field: air_pressure(30, 24)>,
<CF Field: u_compnt_of_wind(19, 29, 24)>,
<CF Field: v_compnt_of_wind(19, 29, 24)>,
<CF Field: potential_temperature(19, 30, 24)>]
>>> write(f, 'file')
>>> type(f)
<class 'cf.field.FieldList'>
>>> type(g)
<class 'cf.field.Field'>
>>> cf.write([f, g], 'file.nc', verbose=True)
[<CF Field: air_pressure(30, 24)>,
<CF Field: u_compnt_of_wind(19, 29, 24)>,
<CF Field: v_compnt_of_wind(19, 29, 24)>,
<CF Field: potential_temperature(19, 30, 24)>]