cf.read1

cf.read1(files, data=False, verbose=False, exact=False, **kwargs)

Read the first matching space from netCDF files.

This function is exactly equivalent to calling the cf.read() function with the index argument set to 0. Refer to cf.read() for more details.

Note that if the first space contains other spaces as part of a coordinate transform or in a list ancillary variables, then these supplementary spaces will also be read from the file.

Parameters:
  • files (str or sequence) – Refer to cf.read()
  • data (bool) – Optional. Refer to cf.read()
  • exact (bool) – Optional. Refer to cf.read()
  • verbose (bool) – Optional. Refer to cf.read()
  • **kwargs

    Optional. Refer to cf.read()

Returns:

A space.

See also

read()

Examples

>>> cf.read('file.nc')
[<CF Space: pmsl(30, 24)>,
 <CF Space: z-squared(17, 30, 24)>,
 <CF Space: temperature(17, 30, 24)>
 <CF Space: temperature_wind(17, 29, 24)>]
>>> cf.read1('file.nc')
<CF Space: pmsl(30, 24)>
>>> cf.read1('file.nc').extract(units='Pa')
True
>>> cf.read1('file.nc').extract(units='K')
False
>>> cf.read1('file.nc', units='K')
<CF Space: temperature(17, 30, 24)>

Previous topic

cf.read

Next topic

cf.write

This Page