cf.NetCDFArray¶
-
class
cf.NetCDFArray(filename=None, ncvar=None, varid=None, group=None, dtype=None, ndim=None, shape=None, size=None, mask=True, units=False, calendar=False, missing_values=None, source=None, copy=True)[source]¶ Bases:
cf.data.array.mixin.filearraymixin.FileArrayMixin,cf.mixin_container.Container,cfdm.data.netcdfarray.NetCDFArrayAn array stored in a netCDF file.
Initialisation
- 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.
- group:
Noneor sequence ofstr, optional Specify the netCDF4 group to which the netCDF variable belongs. By default, or if group is
Noneor an empty sequence, it assumed to be in the root group. The last element in the sequence is the name of the group in which the variable lies, with other elements naming any parent groups (excluding the root group).- Parameter example:
To specify that a variable is in the root group:
group=()orgroup=None- Parameter example:
To specify that a variable is in the group ‘/forecasts’:
group=['forecasts']- Parameter example:
To specify that a variable is in the group ‘/forecasts/model2’:
group=['forecasts', 'model2']
New in version (cfdm): 1.8.6.0
- dtype:
numpy.dtype The data type of the array in the netCDF file. May be
Noneif 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 If True (the default) then mask by convention when reading data from disk.
A netCDF array is masked depending on the values of any of the netCDF variable attributes
valid_min,valid_max,valid_range,_FillValueandmissing_value.New in version (cfdm): 1.8.2
- units:
strorNone, optional The units of the netCDF variable. Set to
Noneto indicate that there are no units. If unset then the units will be set during the first__getitem__call.New in version (cfdm): 1.10.0.1
- calendar:
strorNone, optional The calendar of the netCDF variable. By default, or if set to
None, then the CF default calendar is assumed, if applicable. If unset then the calendar will be set during the first__getitem__call.New in version (cfdm): 1.10.0.1
- missing_values:
dict, optional The missing value indicators defined by the netCDF variable attributes. See
get_missing_valuesfor details.New in version (cfdm): 1.10.0.3
- source: optional
Convert source, which can be any type of object, to a
NetCDFArrayinstance.All other parameters, apart from copy, are ignored and their values are instead inferred from source by assuming that it has the
NetCDFArrayAPI. Any parameters that can not be retrieved from source in this way are assumed to have their default value.Note that if
xis also aNetCDFArrayinstance thencf.NetCDFArray(source=x)is equivalent tox.copy().New in version (cfdm): 1.10.0.0
- copy:
bool, optional If True (the default) then deep copy the input parameters prior to initialisation. By default the parameters are not deep copied.
New in version (cfdm): 1.10.0.0
- filename:
Methods
Close the dataset containing the data. |
|
Return a deep copy of the array. |
|
The address in the file of the variable. |
|
The calendar of the array. |
|
Returns the array’s compression type. |
|
The name of the file containing the array. |
|
Return the names of any files containing the data array. |
|
The netCDF4 group structure of the netCDF variable. |
|
Whether or not to automatically mask the data. |
|
The missing value indicators from the netCDF variable. |
|
The name of the netCDF variable containing the array. |
|
Return a subspace, defined by indices, of a numpy array. |
|
The units of the array. |
|
The UNIDATA netCDF interface ID of the array’s variable. |
|
Returns an open dataset containing the data array. |
|
Bring data on disk into memory. |
Attributes
Return an independent numpy array containing the data. |
|
Data-type of the data elements. |
|
The file name and address. |
|
Number of array dimensions. |
|
Tuple of array dimension sizes. |
|
Number of elements in the array. |
Special¶
Methods
Returns a subspace of the array as a numpy array. |