cfdm.NetCDF4Array¶
-
class
cfdm.NetCDF4Array(filename=None, address=None, dtype=None, shape=None, mask=True, unpack=True, attributes=None, storage_options=None, source=None, copy=True)[source]¶ Bases:
cfdm.data.mixin.indexmixin.IndexMixin,cfdm.data.mixin.netcdffilemixin.NetCDFFileMixin,cfdm.data.mixin.filearraymixin.FileArrayMixin,cfdm.data.abstract.array.ArrayA netCDF array accessed with
netCDF4.New in version (cfdm): 1.7.0
Initialisation
- Parameters
- filename: (sequence of)
str, optional The name of the netCDF file(s) containing the array.
- address: (sequence of)
strorint, optional The identity of the netCDF variable in each file defined by filename. Either a netCDF variable name or an integer netCDF variable ID.
New in version (cfdm): 1.10.1.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.
- mask:
bool, optional 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 attributes
_FillValue,missing_value,_Unsigned,valid_min,valid_max, andvalid_range.New in version (cfdm): 1.8.2
- unpack:
bool, optional If True (the default) then unpack by convention when reading data from disk.
A netCDF array is unpacked depending on the values of the netCDF attributes
add_offsetandscale_factor.New in version (cfdm): 1.11.2.0
- attributes:
dictorNone, optional Provide netCDF attributes for the data as a dictionary of key/value pairs.
If attributes is
None, the default, then the attributes will be set from the netCDF variable during the first__getitem__call.New in version (cfdm): 1.11.2.0
- storage_options:
dictorNone, optional Key/value pairs to be passed on to the creation of
s3fs.S3FileSystemfile systems to control the opening of files in S3 object stores. Ignored for files not in an S3 object store, i.e. those whose names do not start withs3:.By default, or if
None, then storage_options is taken as{}.If the
'endpoint_url'key is not in storage_options or is not in a dictionary defined by the'client_kwargskey (which is always the case when storage_options isNone), then one will be automatically inserted for accessing an S3 file. For example, for a file name of's3://store/data/file.nc', an'endpoint_url'key with value'https://store'would be created.- Parameter example:
For a file name of
's3://store/data/file.nc', the following are equivalent:None,{}, and{'endpoint_url': 'https://store'},{'client_kwargs': {'endpoint_url': 'https://store'}}- Parameter example:
{'key': 'scaleway-api-key...', 'secret': 'scaleway-secretkey...', 'endpoint_url': 'https://s3.fr-par.scw.cloud', 'client_kwargs': {'region_name': 'fr-par'}}
New in version (cfdm): 1.11.2.0
- source: optional
Convert source, which can be any type of object, to a
NetCDF4Arrayinstance.All other parameters, apart from copy, are ignored and their values are instead inferred from source by assuming that it has the
NetCDF4ArrayAPI. Any parameters that can not be retrieved from source in this way are assumed to have their default value.Note that if
xis also aNetCDF4Arrayinstance thencfdm.NetCDF4Array(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
- missing_values: Deprecated at version 1.11.2.0
The missing value indicators defined by the netCDF variable attributes. They may now be recorded via the attributes parameter
- ncvar: Deprecated at version 1.10.1.0
Use the address parameter instead.
- varid: Deprecated at version 1.10.1.0
Use the address parameter instead.
- group: Deprecated at version 1.10.1.0
Use the address parameter instead.
- units:
strorNone, optional Deprecated at version 1.11.2.0. Use the attributes parameter instead.
- calendar:
strorNone, optional Deprecated at version 1.11.2.0. Use the attributes parameter instead.
- filename: (sequence of)
Inspection¶
Methods
Returns the array’s compression type. |
|
|
|
The attributes of the array. |
|
The missing value indicators from the netCDF variable. |
|
The index to be applied when converting to a |
Attributes
Return an independent numpy array containing the data. |
|
Data-type of the array. |
|
Number of array dimensions. |
|
Shape of the array. |
|
Number of elements in the array. |
|
The original shape of the data, before any subspacing. |
Units¶
Methods
The calendar of the array. |
|
The units of the array. |
Attributes
The |
File¶
Methods
The name of the file containing the array. |
|
Return the names of the data addresses in the files. |
|
Close the dataset containing the data. |
|
Return a dataset file object and address. |
|
The name of the file containing the array. |
|
Return the names of files containing the data. |
|
The format of the files. |
|
Return the format of the files. |
|
The netCDF4 group structure of a netCDF variable. |
|
Whether or not to automatically mask the data. |
|
Whether or not to automatically unpack the data. |
|
Return |
Miscellaneous¶
Return a deep copy of the array. |
|
Bring data on disk into memory. |
Special¶
Returns a subspace of the data as a new |
Docstring substitutions¶
Methods
Return the special docstring substitutions. |
|
Returns the substitutions that apply to methods of the class. |
|
Returns the class {{package}} substitutions package depth. |
|
Returns method names excluded in the class substitutions. |