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

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

If not exactly one field is found in the input files then an error is raised. Files should be read with unless it is known that only one field will be created from them.

Note that if field aggregation is on (as is it by default), then the number of fields is that after teh inputs have been aggregated.

Files may be on disk or on a OPeNDAP server.

Any amount of any combination of CF-netCDF and CFA-netCDF files (or URLs if DAP access is enabled), Met Office (UK) PP files and Met Office (UK) fields files format files may be read.

Notes for PP and UM fields files
  • The aggregate option 'relaxed_units' is set to True for all input files.
  • STASH code to standard conversion uses the table in cf/etc/STASH_to_CF.txt.
Notes for files on OPeNDAP servers
  • All files on OPeNDAP servers are assumed to be netCDF files.

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

New in version 2.0.3.

See also, cf.write

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

Any arguments and keyword arguments accepted by

out cf.Field

The unique field from the input file(s).

Examples 2:
>>> f = cf.read_field('')
>>> f = cf.read_field('file[1-9].nc', select='air_temperature')