cfdm.XnetcdfArray¶
- class cfdm.XnetcdfArray(filename=None, address=None, dtype=None, shape=None, mask=True, unpack=True, attributes=None, filesystem=None, backend=None, backend_options=None, variable=None, source=None, copy=True)[source]¶
Bases:
IndexMixin,FileArrayA netCDF array accessed with
xnetcdf.Added in version (cfdm): 1.13.3.0
Initialisation
- Parameters:
- filename: (sequence of
str), optional The location of the dataset containing the array.
- address: (sequence of
str), optional How to find the array in the dataset.
- dtype:
numpy.dtype, optional The data type of the array. May be
Noneif is not known. This may differ from the data type of the array in the dataset.- shape:
tuple, optional The shape of the dataset array.
- mask:
bool, optional If True (the default) then mask by convention when reading data from disk.
- unpack:
bool, optional If True (the default) then unpack by convention when reading data from disk.
- 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 those in the dataset during the first__getitem__call.- filesystem: optional
A pre-authenticated filesystem object (for example an
fsspecfilesystem instance) to use for opening the filename. When the dataset is given as a string, it is treated as a path understood by filesystem and the dataset will be opened by callingfilesystem.open(dataset, 'rb'), the result of which will be passed to the backend(s) (see the backend parameter). S3 is a special case for which the leading scheme and authority is automatically removed from the dataset name passed to the filesystemopenmethod; for instance, the dataset's3://authority/bucket/file.nc'is treated asfilesystem.open('bucket/file.nc', 'rb').If filename is not a string then filesystem is ignored.
If
None(the default) then filename, regardless of its type, is passed unchanged to the backends.Added in version (cfdm): 1.13.1.0
- backend:
Noneor (sequence of)str, optional Which library to use for opening a dataset.
Added in version (cfdm): 1.13.3.0
- backend_options:
Noneordict, optional The options to use with each backend when opening a dataset.
Added in version (cfdm): 1.13.1.0
- variable: optional
An open dataset variable object. Setting variable does not replace the need for the filename and address parameters, instead it complements them by allowing faster data access.
Added in version (cfdm): 1.13.1.0
- source: optional
Convert source, which can be any type of object, to a
XnetcdfArrayinstance.All other parameters, apart from copy, are ignored and their values are instead inferred from source by assuming that it has the
XnetcdfArrayAPI. Any parameters that can not be retrieved from source in this way are assumed to have their default value.Note that if
xis also aXnetcdfArrayinstance thencfdm.XnetcdfArray(source=x)is equivalent tox.copy().- copy:
bool, optional If True (the default) then deep copy the input parameters prior to initialisation. By default the parameters are not deep copied.
- storage_options: Deprecated at version (cfdm) 1.13.3.0
Use filesystem instead.
- storage_protocol: Deprecated at version (cfdm) 1.13.3.0
Use filesystem instead.
- filename: (sequence of
Inspection¶
Methods
Returns the array's compression type. |
|
The attributes of the array. |
|
The missing values of the data. |
|
The index to be applied when converting to a |
|
True if the index represents a subspace of the data. |
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 shape of the data in the file. |
|
The shape of the data in the file with added dimensions. |
Units¶
Methods
The calendar of the array. |
|
The units of the array. |
Attributes
The |
File¶
Methods
The file directory. |
|
The name of the file containing the array. |
|
Close the dataset containing the data. |
|
Return a dataset object and address. |
|
The name of the file containing the array. |
|
Whether or not to automatically mask the data. |
|
Whether or not to automatically unpack the data. |
|
Return the file system options. |
|
Replace the file directory. |
|
Replace the file location. |
|
The file system protocol. |
|
Get the open dataset variable object for the data. |
|
Whether or not there is a remote file system protocol. |
|
The names of the packages for accessing the dataset. |
|
Backend options when opening a dataset. |
|
Return the file system which contains the dataset. |
Miscellaneous¶
|
Return a deep copy of the array. |
|
Bring data on disk into memory. |
|
Cast the data to a specified type. |
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. |