Read spaces from input files from disk or from an OPeNDAP server.
By default, all data arrays from all space components are not read from disk but are stored in the returned spaces 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 space’s grid and netCDF variable names are stored in the private attribute ncvar of the space and each of its grid components.
Parameters: |
|
---|---|
Returns: | A list of spaces in a SpaceList object. |
Examples:
>>> s = cf.read('file*.nc')
>>> type(s)
<class 'cf.space.SpaceList'>
>>> s
[<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.read('file*.nc')[0:2]
[<CF Space: pmsl(30, 24)>,
<CF Space: z-squared(17, 30, 24)>]
>>> cf.read('file*.nc', index=0)
[<CF Space: pmsl(30, 24)>]
>>> cf.read('file*.nc')[-1]
<CF Space: temperature_wind(17, 29, 24)>
>>> cf.read('file*.nc', extract={'units': 'K'})
[<CF Space: temperature(17, 30, 24)>,
<CF Space: temperature_wind(17, 29, 24)>]
>>> cf.read('file*.nc', standard_name='.*pmsl*', extract={'units': 'K|Pa'})[0]
<CF Space: pmsl(30, 24)>