bundles / scipy 1.17.1 / scipy / io / _netcdf / netcdf_variable
class
scipy.io._netcdf:netcdf_variable
source: /scipy/io/_netcdf.py :811
Signature
class netcdf_variable ( data , typecode , size , shape , dimensions , attributes = None , maskandscale = False ) Members
-
__getitem__ -
__init__ -
__setattr__ -
__setitem__ -
_apply_missing_value -
_default_encoded_fill_value -
_get_encoded_fill_value -
_get_missing_value -
assignValue -
getValue -
itemsize -
typecode
Summary
A data object for netcdf files.
Extended Summary
netcdf_variable objects are constructed by calling the method netcdf_file.createVariable on the netcdf_file object. netcdf_variable objects behave much like array objects defined in numpy, except that their data resides in a file. Data is read by indexing and written by assigning to an indexed subset; the entire array can be accessed by the index [:] or (for scalars) by using the methods getValue and assignValue. netcdf_variable objects also have attribute shape with the same meaning as for arrays, but the shape cannot be modified. There is another read-only attribute dimensions, whose value is the tuple of dimension names.
All other attributes correspond to variable attributes defined in the NetCDF file. Variable attributes are created by assigning to an attribute of the netcdf_variable object.
Parameters
data: array_likeThe data array that holds the values for the variable. Typically, this is initialized as empty, but with the proper shape.
typecode: dtype character codeDesired data-type for the data array.
size: intDesired element size for the data array.
shape: sequence of intsThe shape of the array. This should match the lengths of the variable's dimensions.
dimensions: sequence of stringsThe names of the dimensions used by the variable. Must be in the same order of the dimension lengths given by
shape.attributes: dict, optionalAttribute values (any type) keyed by string names. These attributes become attributes for the netcdf_variable object.
maskandscale: bool, optionalWhether to automatically scale and/or mask data based on attributes. Default is False.
Attributes
dimensions: list of strList of names of dimensions used by the variable object.
isrec, shapeProperties
Notes
For a more recent version of the NetCDF standard and additional features, please consider the permissively-licensed netcdf4-python.
See also
- isrec
- shape
Aliases
-
scipy.io.netcdf_variable