cf.read_field

cf.read_field(*args, **kwargs)[source]

Read a single field from netCDF, PP or UM fields files.

Note that f=cf.read_field(*args, **kwargs) is equivalent to f=cf.read(*args, nfields=1, **kwargs)[0].

New in version 2.0.3.

See also

cf.read

Examples 1:
>>> f = cf.read_field('file.nc')
Parameters:
args, kwargs: optional

Any arguments and keyword arguments accepted by cf.read.

Returns:
out cf.Field

The unique field from the input file(s).

Examples 2:
>>> fl = cf.read('file[1-9].nc')
>>> len(fl)
27
>>> fl = cf.read('file[1-9].nc', select='air_temperature')
>>> fl
[<CF Field: air_temperature(time(12), latitude(73), longitude(96) K>]
>>> f = cf.read_field('file[1-9].nc', select='air_temperature')
>>> f
<CF Field: air_temperature(time(12), latitude(73), longitude(96) K>