Read fields from input files from disk or from an OPeNDAP server.
By default, all data arrays from all field components are not read from disk but are stored in the returned fields as file pointers. This behaviour may be changed with the read_data parameter.
NetCDF dimension names are stored in the nc_dimensions attribute of a field’s space and netCDF variable names are stored in the private attribute ncvar of the field and each of its space components.
Fields referenced by formula_terms transforms are not included in the returned list of fields. A field may be referenced in the transforms of multiple output fields, so in-place changes to that field in one transform will be seen in the other fields which reference it.
Parameters: |
|
---|---|
Returns: | A list of fields in a FieldList object. |
Examples:
>>> f = cf.read('file*.nc')
>>> type(f)
<class 'cf.field.FieldList'>
>>> f
[<CF Field: pmsl(30, 24)>,
<CF Field: z-squared(17, 30, 24)>,
<CF Field: temperature(17, 30, 24)>,
<CF Field: temperature_wind(17, 29, 24)>]
>>> cf.read('file*.nc')[0:2]
[<CF Field: pmsl(30, 24)>,
<CF Field: z-squared(17, 30, 24)>]
>>> cf.read('file*.nc', index=0)
[<CF Field: pmsl(30, 24)>]
>>> cf.read('file*.nc')[-1]
<CF Field: temperature_wind(17, 29, 24)>
>>> cf.read('file*.nc', extract={'units': 'K'})
[<CF Field: temperature(17, 30, 24)>,
<CF Field: temperature_wind(17, 29, 24)>]
>>> cf.read('file*.nc', standard_name='.*pmsl*', extract={'units': 'K|Pa'})[0]
<CF Field: pmsl(30, 24)>