Variable¶
-
class
metpy.io.cdm.
Variable
(group, name, datatype, dimensions, fill_value, wrap_array)[source]¶ Holds typed data (using a
numpy.ndarray
), as well as attributes (e.g. units).In addition to its various attributes, the Variable supports getting and setting data using the
[]
operator and indices or slices. Getting data returnsnumpy.ndarray
instances.Initialize a Variable.
Instead of constructing a Variable directly, you should use
Group.createVariable()
.Parameters: - group (Group) – The parent
Group
that owns this Variable. - name (str) – The name of this Variable.
- datatype (str or numpy.dtype) – A valid Numpy dtype that describes the layout of each element of the data
- dimensions (tuple[str], optional) – The dimensions of this Variable. Defaults to empty, which implies a scalar variable.
- fill_value (scalar, optional) – A scalar value that is used to fill the created storage. Defaults to None, which performs no filling, leaving the storage uninitialized.
- wrap_array (numpy.ndarray, optional) – Instead of creating an array, the Variable instance will assume ownership of the passed in array as its data storage. This is a performance optimization to avoid copying large data blocks. Defaults to None, which means a new array will be created.
See also
Methods Summary
__init__
(group, name, datatype, dimensions, …)Initialize a Variable. group
()Get the Group that owns this Variable. ncattrs
()Get a list of the names of the netCDF attributes. Methods Documentation
-
__init__
(group, name, datatype, dimensions, fill_value, wrap_array)[source]¶ Initialize a Variable.
Instead of constructing a Variable directly, you should use
Group.createVariable()
.Parameters: - group (Group) – The parent
Group
that owns this Variable. - name (str) – The name of this Variable.
- datatype (str or numpy.dtype) – A valid Numpy dtype that describes the layout of each element of the data
- dimensions (tuple[str], optional) – The dimensions of this Variable. Defaults to empty, which implies a scalar variable.
- fill_value (scalar, optional) – A scalar value that is used to fill the created storage. Defaults to None, which performs no filling, leaving the storage uninitialized.
- wrap_array (numpy.ndarray, optional) – Instead of creating an array, the Variable instance will assume ownership of the passed in array as its data storage. This is a performance optimization to avoid copying large data blocks. Defaults to None, which means a new array will be created.
See also
- group (Group) – The parent
-
ncattrs
()¶ Get a list of the names of the netCDF attributes.
Returns: List[str]
- group (Group) – The parent