cf.NetCDFArray¶
-
class
cf.
NetCDFArray
(filename=None, ncvar=None, varid=None, dtype=None, ndim=None, shape=None, size=None, mask=True)[source]¶ Bases:
cfdm.data.netcdfarray.NetCDFArray
,cf.data.abstract.filearray.FileArray
A sub-array stored in a netCDF file.
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 in the netCDF file. May be
None
if the numpy data-type is not known (which can be the case for netCDF string types, for example).- shape:
tuple
The array dimension sizes in the netCDF file.
- size:
int
Number of elements in the array in the netCDF file.
- ndim:
int
The number of array dimensions in the netCDF file.
- mask:
bool
, optional If False then do not mask by convention when reading data from disk. By default data is masked by convention.
A netCDF array is masked depending on the values of any of the netCDF variable attributes
valid_min
,valid_max
,valid_range
,_FillValue
andmissing_value
.New in version 3.4.0.
- filename:
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)
Inspection¶
Methods
The name of the netCDF variable containing the array. |
|
The UNIDATA netCDF interface ID of the variable containing the array. |
|
The type of compression that has been applied to the underlying array. |
|
Return a subspace, defined by indices, of a numpy array. |
Attributes
Return an independent numpy array containing the data. |
|
Data-type of the data elements. |
|
Number of array dimensions |
|
Tuple of array dimension sizes. |
|
Number of elements in the array. |
File¶
Methods
Close the file containing the data array. |
|
The name of the netCDF file containing the array. |
|
Return a |
Attributes
TODO |
|
TODO |
Miscellaneous¶
Return a deep copy of the array. |
|
Return a subspace, defined by indices, of a numpy array. |
|
Inspect the object for debugging. |
|
TODO |