cfdm.NetCDFArray¶
-
class
cfdm.
NetCDFArray
(filename=None, ncvar=None, varid=None, dtype=None, ndim=None, shape=None, size=None)[source]¶ Bases:
cfdm.data.abstract.array.Array
An underlying array stored in a netCDF file.
New in version 1.7.0.
Initialization
Parameters: - filename:
str
The name of the netCDF file containing the array.
- ncvar:
str
, optional The name of the netCDF variable containing the array. Required unless varid is set.
- varid:
int
, optional The UNIDATA netCDF interface ID of the variable containing the array. Required if ncvar is not set, ignored if ncvar is set.
- dtype:
numpy.dtype
The data type of the array.
- shape:
tuple
The array dimension sizes.
- size:
int
Number of elements in the array.
- ndim:
int
The number of array dimensions.
Examples:
>>> import netCDF4 >>> nc = netCDF4.Dataset('file.nc', 'r') >>> v = nc.variable['tas'] >>> a = NetCDFFileArray(filename='file.nc', ncvar='tas', dtype=v.dtype, ... ndim=v.ndim, shape=v.shape, size=v.size)
- filename:
Inspection¶
Methods
get_ncvar |
The name of the netCDF variable containing the array. |
get_varid |
The UNIDATA netCDF interface ID of the variable containing the array. |
get_compression_type |
The type of compression that has been applied to the underlying array. |
get_subspace |
Return a subspace, defined by indices, of a numpy array. |
Attributes
array |
Return an independent numpy array containing the data. |
dtype |
Data-type of the data elements. |
ndim |
Number of array dimensions |
shape |
Tuple of array dimension sizes. |
size |
Number of elements in the array. |
File¶
Methods
close |
Close the netCDF4.Dataset for the file containing the data. |
open |
Return an open netCDF4.Dataset for the file containing the array. |
Special¶
__getitem__ |
x.__getitem__(indices) <==> x[indices] |