<?xml version="1.0" encoding="ascii"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>netCDF4.Variable</title> <link rel="stylesheet" href="epydoc.css" type="text/css" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body bgcolor="white" text="black" link="blue" vlink="#204080" alink="#204080"> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="netCDF4-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <th class="navbar" width="100%"></th> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="100%"> <span class="breadcrumbs"> <a href="netCDF4-module.html">Module netCDF4</a> :: Class Variable </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> </table> </td> </tr> </table> <!-- ==================== CLASS DESCRIPTION ==================== --> <h1 class="epydoc">Class Variable</h1><p class="nomargin-top"></p> <pre class="base-tree"> object --+ | <strong class="uidshort">Variable</strong> </pre> <hr /> <p>Variable(self, group, name, datatype, dimensions=(), zlib=False, complevel=4, shuffle=True, fletcher32=False, contiguous=False, chunksizes=None, endian='native', least_significant_digit=None,fill_value=None)</p> <p>A netCDF <a href="netCDF4.Variable-class.html" class="link">Variable</a> is used to read and write netCDF data. They are analagous to numpy array objects.</p> <p><a href="netCDF4.Variable-class.html" class="link">Variable</a> instances should be created using the <a href="netCDF4.Dataset-class.html#createVariable" class="link">createVariable</a> method of a <a href="netCDF4.Dataset-class.html" class="link">Dataset</a> or <a href="netCDF4.Group-class.html" class="link">Group</a> instance, not using this class directly.</p> <p><b>Parameters:</b></p> <p><b><code>group</code></b> - <a href="netCDF4.Group-class.html" class="link">Group</a> or <a href="netCDF4.Dataset-class.html" class="link">Dataset</a> instance to associate with variable.</p> <p><b><code>name</code></b> - Name of the variable.</p> <p><b><code>datatype</code></b> - <a href="netCDF4.Variable-class.html" class="link">Variable</a> data type. Can be specified by providing a numpy dtype object, or a string that describes a numpy dtype object. Supported values, corresponding to <code>str</code> attribute of numpy dtype objects, include <code>'f4'</code> (32-bit floating point), <code>'f8'</code> (64-bit floating point), <code>'i4'</code> (32-bit signed integer), <code>'i2'</code> (16-bit signed integer), <code>'i8'</code> (64-bit singed integer), <code>'i4'</code> (8-bit singed integer), <code>'i1'</code> (8-bit signed integer), <code>'u1'</code> (8-bit unsigned integer), <code>'u2'</code> (16-bit unsigned integer), <code>'u4'</code> (32-bit unsigned integer), <code>'u8'</code> (64-bit unsigned integer), or <code>'S1'</code> (single-character string). From compatibility with Scientific.IO.NetCDF, the old Numeric single character typecodes can also be used (<code>'f'</code> instead of <code>'f4'</code>, <code>'d'</code> instead of <code>'f8'</code>, <code>'h'</code> or <code>'s'</code> instead of <code>'i2'</code>, <code>'b'</code> or <code>'B'</code> instead of <code>'i1'</code>, <code>'c'</code> instead of <code>'S1'</code>, and <code>'i'</code> or <code>'l'</code> instead of <code>'i4'</code>). <code>datatype</code> can also be a <a href="netCDF4.CompoundType-class.html" class="link">CompoundType</a> instance (for a structured, or compound array), a <a href="netCDF4.VLType-class.html" class="link">VLType</a> instance (for a variable-length array), or the python <code>str</code> builtin (for a variable-length string array).</p> <p><b>Keywords:</b></p> <p><b><code>dimensions</code></b> - a tuple containing the variable's dimension names (defined previously with <code>createDimension</code>). Default is an empty tuple which means the variable is a scalar (and therefore has no dimensions).</p> <p><b><code>zlib</code></b> - if <code>True</code>, data assigned to the <a href="netCDF4.Variable-class.html" class="link">Variable</a> instance is compressed on disk. Default <code>False</code>.</p> <p><b><code>complevel</code></b> - the level of zlib compression to use (1 is the fastest, but poorest compression, 9 is the slowest but best compression). Default 4. Ignored if <code>zlib=False</code>.</p> <p><b><code>shuffle</code></b> - if <code>True</code>, the HDF5 shuffle filter is applied to improve compression. Default <code>True</code>. Ignored if <code>zlib=False</code>.</p> <p><b><code>fletcher32</code></b> - if <code>True</code> (default <code>False</code>), the Fletcher32 checksum algorithm is used for error detection.</p> <p><b><code>contiguous</code></b> - if <code>True</code> (default <code>False</code>), the variable data is stored contiguously on disk. Default <code>False</code>. Setting to <code>True</code> for a variable with an unlimited dimension will trigger an error.</p> <p><b><code>chunksizes</code></b> - Can be used to specify the HDF5 chunksizes for each dimension of the variable. A detailed discussion of HDF chunking and I/O performance is available <a href="http://www.hdfgroup.org/HDF5/doc/H5.user/Chunking.html" target="_top">here</a>. Basically, you want the chunk size for each dimension to match as closely as possible the size of the data block that users will read from the file. <code>chunksizes</code> cannot be set if <code>contiguous=True</code>.</p> <p><b><code>endian</code></b> - Can be used to control whether the data is stored in little or big endian format on disk. Possible values are <code>little, big</code> or <code>native</code> (default). The library will automatically handle endian conversions when the data is read, but if the data is always going to be read on a computer with the opposite format as the one used to create the file, there may be some performance advantage to be gained by setting the endian-ness.</p> <p>The <code>zlib, complevel, shuffle, fletcher32, contiguous, chunksizes</code> and <code>endian</code> keywords are silently ignored for netCDF 3 files that do not use HDF5.</p> <p><b><code>least_significant_digit</code></b> - If specified, variable data will be truncated (quantized). In conjunction with <code>zlib=True</code> this produces 'lossy', but significantly more efficient compression. For example, if <code>least_significant_digit=1</code>, data will be quantized using around(scale*data)/scale, where scale = 2**bits, and bits is determined so that a precision of 0.1 is retained (in this case bits=4). Default is <code>None</code>, or no quantization.</p> <p><b><code>fill_value</code></b> - If specified, the default netCDF <code>_FillValue</code> (the value that the variable gets filled with before any data is written to it) is replaced with this value. If fill_value is set to <code>False</code>, then the variable is not pre-filled. The default netCDF fill values can be found in netCDF4.default_fillvals.</p> <p><b>Returns:</b></p> <p>a <a href="netCDF4.Variable-class.html" class="link">Variable</a> instance. All further operations on the netCDF Variable are accomplised via <a href="netCDF4.Variable-class.html" class="link">Variable</a> instance methods.</p> <p>A list of attribute names corresponding to netCDF attributes defined for the variable can be obtained with the <code>ncattrs()</code> method. These attributes can be created by assigning to an attribute of the <a href="netCDF4.Variable-class.html" class="link">Variable</a> instance. A dictionary containing all the netCDF attribute name/value pairs is provided by the <code>__dict__</code> attribute of a <a href="netCDF4.Variable-class.html" class="link">Variable</a> instance.</p> <p>The instance variables <code>dimensions, dtype, ndim, shape</code> and <code>least_significant_digit</code> are read-only (and should not be modified by the user).</p> <!-- ==================== INSTANCE METHODS ==================== --> <a name="section-InstanceMethods"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Instance Methods</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#__delattr__" class="summary-sig-name">__delattr__</a>(<span class="summary-sig-arg">...</span>)</span><br /> x.__delattr__('name') <==> del x.name</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="__delitem__"></a><span class="summary-sig-name">__delitem__</span>(<span class="summary-sig-arg">x</span>, <span class="summary-sig-arg">y</span>)</span><br /> del x[y]</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="__getattr__"></a><span class="summary-sig-name">__getattr__</span>(<span class="summary-sig-arg">...</span>)</span></td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#__getattribute__" class="summary-sig-name">__getattribute__</a>(<span class="summary-sig-arg">...</span>)</span><br /> x.__getattribute__('name') <==> x.name</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="__getitem__"></a><span class="summary-sig-name">__getitem__</span>(<span class="summary-sig-arg">x</span>, <span class="summary-sig-arg">y</span>)</span><br /> x[y]</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">group</span>, <span class="summary-sig-arg">name</span>, <span class="summary-sig-arg">datatype</span>, <span class="summary-sig-arg">dimensions</span>=<span class="summary-sig-default">()</span>, <span class="summary-sig-arg">zlib</span>=<span class="summary-sig-default">False</span>, <span class="summary-sig-arg">complevel</span>=<span class="summary-sig-default">4</span>, <span class="summary-sig-arg">shuffle</span>=<span class="summary-sig-default">True</span>, <span class="summary-sig-arg">fletcher32</span>=<span class="summary-sig-default">False</span>, <span class="summary-sig-arg">contiguous</span>=<span class="summary-sig-default">False</span>, <span class="summary-sig-arg">chunksizes</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">endian</span>=<span class="summary-sig-default">'native'</span>, <span class="summary-sig-arg">least_significant_digit</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">fill_value</span>=<span class="summary-sig-default">None</span>)</span><br /> x.__init__(...) initializes x; see help(type(x)) for signature</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="__len__"></a><span class="summary-sig-name">__len__</span>(<span class="summary-sig-arg">x</span>)</span><br /> len(x)</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">a new object with type S, a subtype of T</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#__new__" class="summary-sig-name">__new__</a>(<span class="summary-sig-arg">T</span>, <span class="summary-sig-arg">S</span>, <span class="summary-sig-arg">...</span>)</span></td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#__setattr__" class="summary-sig-name">__setattr__</a>(<span class="summary-sig-arg">...</span>)</span><br /> x.__setattr__('name', value) <==> x.name = value</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="__setitem__"></a><span class="summary-sig-name">__setitem__</span>(<span class="summary-sig-arg">x</span>, <span class="summary-sig-arg">i</span>, <span class="summary-sig-arg">y</span>)</span><br /> x[i]=y</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#__str__" class="summary-sig-name">__str__</a>(<span class="summary-sig-arg">x</span>)</span><br /> str(x)</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="__unicode__"></a><span class="summary-sig-name">__unicode__</span>(<span class="summary-sig-arg">...</span>)</span></td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#assignValue" class="summary-sig-name">assignValue</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">val</span>)</span><br /> assign a value to a scalar variable.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#chunking" class="summary-sig-name">chunking</a>(<span class="summary-sig-arg">self</span>)</span><br /> return variable chunking information.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#delncattr" class="summary-sig-name">delncattr</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">name</span>, <span class="summary-sig-arg">value</span>)</span><br /> delete a netCDF variable attribute.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="endian"></a><span class="summary-sig-name">endian</span>(<span class="summary-sig-arg">self</span>)</span><br /> return endian-ness (little,big,native) of variable (as stored in HDF5 file).</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="filters"></a><span class="summary-sig-name">filters</span>(<span class="summary-sig-arg">self</span>)</span><br /> return dictionary containing HDF5 filter parameters.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#getValue" class="summary-sig-name">getValue</a>(<span class="summary-sig-arg">self</span>)</span><br /> get the value of a scalar variable.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#get_var_chunk_cache" class="summary-sig-name">get_var_chunk_cache</a>(<span class="summary-sig-arg">self</span>)</span><br /> return variable chunk cache information in a tuple (size,nelems,preemption).</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#getncattr" class="summary-sig-name">getncattr</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">name</span>)</span><br /> retrievel a netCDF variable attribute.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="group"></a><span class="summary-sig-name">group</span>(<span class="summary-sig-arg">self</span>)</span><br /> return the group that this <a href="netCDF4.Variable-class.html" class="link">Variable</a> is a member of.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="ncattrs"></a><span class="summary-sig-name">ncattrs</span>(<span class="summary-sig-arg">self</span>)</span><br /> return netCDF attribute names for this <a href="netCDF4.Variable-class.html" class="link">Variable</a> in a list.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#set_auto_maskandscale" class="summary-sig-name">set_auto_maskandscale</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">maskandscale</span>)</span><br /> turn on or off automatic conversion of variable data to and from masked arrays and automatic packing/unpacking of variable data using <code>scale_factor</code> and <code>add_offset</code> attributes.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#set_var_chunk_cache" class="summary-sig-name">set_var_chunk_cache</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">size</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">nelems</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">preemption</span>=<span class="summary-sig-default">None</span>)</span><br /> change variable chunk cache settings.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#setncattr" class="summary-sig-name">setncattr</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">name</span>, <span class="summary-sig-arg">value</span>)</span><br /> set a netCDF variable attribute using name,value pair.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="netCDF4.Variable-class.html#setncatts" class="summary-sig-name">setncatts</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">attdict</span>)</span><br /> set a bunch of netCDF variable attributes at once using a python dictionary.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td colspan="2" class="summary"> <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: <code>__format__</code>, <code>__hash__</code>, <code>__reduce__</code>, <code>__reduce_ex__</code>, <code>__repr__</code>, <code>__sizeof__</code>, <code>__subclasshook__</code> </p> </td> </tr> </table> <!-- ==================== INSTANCE VARIABLES ==================== --> <a name="section-InstanceVariables"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Instance Variables</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a name="dimensions"></a><span class="summary-name">dimensions</span><br /> A tuple containing the names of the dimensions associated with this variable. </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a name="dtype"></a><span class="summary-name">dtype</span><br /> A numpy dtype object describing the variable's data type. </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="netCDF4.Variable-class.html#least_significant_digit" class="summary-name">least_significant_digit</a><br /> Describes the power of ten of the smallest decimal place in the data the contains a reliable value. </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a name="ndim"></a><span class="summary-name">ndim</span><br /> The number of variable dimensions. </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a name="shape"></a><span class="summary-name">shape</span><br /> a tuple describing the current size of all the variable's dimensions. </td> </tr> </table> <!-- ==================== PROPERTIES ==================== --> <a name="section-Properties"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Properties</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a name="maskandscale"></a><span class="summary-name">maskandscale</span> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a name="size"></a><span class="summary-name">size</span><br /> Return the number of stored elements. </td> </tr> <tr> <td colspan="2" class="summary"> <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: <code>__class__</code> </p> </td> </tr> </table> <!-- ==================== METHOD DETAILS ==================== --> <a name="section-MethodDetails"></a> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Method Details</span></td> </tr> </table> <a name="__delattr__"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">__delattr__</span>(<span class="sig-arg">...</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>x.__delattr__('name') <==> del x.name</p> <dl class="fields"> <dt>Overrides: object.__delattr__ </dt> </dl> </td></tr></table> </div> <a name="__getattribute__"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">__getattribute__</span>(<span class="sig-arg">...</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>x.__getattribute__('name') <==> x.name</p> <dl class="fields"> <dt>Overrides: object.__getattribute__ </dt> </dl> </td></tr></table> </div> <a name="__init__"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>, <span class="sig-arg">group</span>, <span class="sig-arg">name</span>, <span class="sig-arg">datatype</span>, <span class="sig-arg">dimensions</span>=<span class="sig-default">()</span>, <span class="sig-arg">zlib</span>=<span class="sig-default">False</span>, <span class="sig-arg">complevel</span>=<span class="sig-default">4</span>, <span class="sig-arg">shuffle</span>=<span class="sig-default">True</span>, <span class="sig-arg">fletcher32</span>=<span class="sig-default">False</span>, <span class="sig-arg">contiguous</span>=<span class="sig-default">False</span>, <span class="sig-arg">chunksizes</span>=<span class="sig-default">None</span>, <span class="sig-arg">endian</span>=<span class="sig-default">'native'</span>, <span class="sig-arg">least_significant_digit</span>=<span class="sig-default">None</span>, <span class="sig-arg">fill_value</span>=<span class="sig-default">None</span>)</span> <br /><em class="fname">(Constructor)</em> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>x.__init__(...) initializes x; see help(type(x)) for signature</p> <dl class="fields"> <dt>Overrides: object.__init__ </dt> </dl> </td></tr></table> </div> <a name="__new__"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">__new__</span>(<span class="sig-arg">T</span>, <span class="sig-arg">S</span>, <span class="sig-arg">...</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <dl class="fields"> <dt>Returns: a new object with type S, a subtype of T</dt> <dt>Overrides: object.__new__ </dt> </dl> </td></tr></table> </div> <a name="__setattr__"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">__setattr__</span>(<span class="sig-arg">...</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>x.__setattr__('name', value) <==> x.name = value</p> <dl class="fields"> <dt>Overrides: object.__setattr__ </dt> </dl> </td></tr></table> </div> <a name="__str__"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">__str__</span>(<span class="sig-arg">x</span>)</span> <br /><em class="fname">(Informal representation operator)</em> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>str(x)</p> <dl class="fields"> <dt>Overrides: object.__str__ </dt> </dl> </td></tr></table> </div> <a name="assignValue"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">assignValue</span>(<span class="sig-arg">self</span>, <span class="sig-arg">val</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>assign a value to a scalar variable. Provided for compatibility with Scientific.IO.NetCDF, can also be done by assigning to a slice ([:]).</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="chunking"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">chunking</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>return variable chunking information. If the dataset is defined to be contiguous (and hence there is no chunking) the word 'contiguous' is returned. Otherwise, a sequence with the chunksize for each dimension is returned.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="delncattr"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">delncattr</span>(<span class="sig-arg">self</span>, <span class="sig-arg">name</span>, <span class="sig-arg">value</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>delete a netCDF variable attribute. Only use if you need to delete a netCDF attribute with the same name as one of the reserved python attributes.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="getValue"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">getValue</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>get the value of a scalar variable. Provided for compatibility with Scientific.IO.NetCDF, can also be done by slicing ([:]).</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="get_var_chunk_cache"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_var_chunk_cache</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>return variable chunk cache information in a tuple (size,nelems,preemption). See netcdf C library documentation for <code>nc_get_var_chunk_cache</code> for details.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="getncattr"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">getncattr</span>(<span class="sig-arg">self</span>, <span class="sig-arg">name</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>retrievel a netCDF variable attribute. Only use if you need to set a netCDF attribute with the same name as one of the reserved python attributes.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="set_auto_maskandscale"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">set_auto_maskandscale</span>(<span class="sig-arg">self</span>, <span class="sig-arg">maskandscale</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>turn on or off automatic conversion of variable data to and from masked arrays and automatic packing/unpacking of variable data using <code>scale_factor</code> and <code>add_offset</code> attributes.</p> <p>If <code>maskandscale</code> is set to <code>True</code>, when data is read from a variable it is converted to a masked array if any of the values are exactly equal to the either the netCDF _FillValue or the value specified by the missing_value variable attribute. The fill_value of the masked array is set to the missing_value attribute (if it exists), otherwise the netCDF _FillValue attribute (which has a default value for each data type). When data is written to a variable, the masked array is converted back to a regular numpy array by replacing all the masked values by the fill_value of the masked array.</p> <p>If <code>maskandscale</code> is set to <code>True</code>, and the variable has a <code>scale_factor</code> or an <code>add_offset</code> attribute, then data read from that variable is unpacked using:</p> <pre class="literalblock"> data = self.scale_factor*data + self.add_offset </pre> <p>When data is written to a variable it is packed using:</p> <pre class="literalblock"> data = (data - self.add_offset)/self.scale_factor </pre> <p>If either scale_factor is present, but add_offset is missing, add_offset is assumed zero. If add_offset is present, but scale_factor is missing, scale_factor is assumed to be one. For more information on how <code>scale_factor</code> and <code>add_offset</code> can be used to provide simple compression, see <a href="http://www.cdc.noaa.gov/cdc/conventions/cdc_netcdf_standard.shtml" target="_top">http://www.cdc.noaa.gov/cdc/conventions/cdc_netcdf_standard.shtml</a>.</p> <p>The default value of <code>maskandscale</code> is <code>True</code> (automatic conversions are performed).</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="set_var_chunk_cache"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">set_var_chunk_cache</span>(<span class="sig-arg">self</span>, <span class="sig-arg">size</span>=<span class="sig-default">None</span>, <span class="sig-arg">nelems</span>=<span class="sig-default">None</span>, <span class="sig-arg">preemption</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>change variable chunk cache settings. See netcdf C library documentation for <code>nc_set_var_chunk_cache</code> for details.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="setncattr"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">setncattr</span>(<span class="sig-arg">self</span>, <span class="sig-arg">name</span>, <span class="sig-arg">value</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>set a netCDF variable attribute using name,value pair. Only use if you need to set a netCDF attribute with the same name as one of the reserved python attributes.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="setncatts"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">setncatts</span>(<span class="sig-arg">self</span>, <span class="sig-arg">attdict</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>set a bunch of netCDF variable attributes at once using a python dictionary. This may be faster when setting a lot of attributes for a NETCDF3 formatted file, since nc_redef/nc_enddef is not called in between setting each attribute</p> <dl class="fields"> </dl> </td></tr></table> </div> <br /> <!-- ==================== INSTANCE VARIABLE DETAILS ==================== --> <a name="section-InstanceVariableDetails"></a> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Instance Variable Details</span></td> </tr> </table> <a name="least_significant_digit"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <h3 class="epydoc">least_significant_digit</h3> Describes the power of ten of the smallest decimal place in the data the contains a reliable value. Data is truncated to this decimal place when it is assigned to the <a href="netCDF4.Variable-class.html" class="link">Variable</a> instance. If <code>None</code>, the data is not truncated. <dl class="fields"> </dl> </td></tr></table> </div> <br /> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="netCDF4-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <th class="navbar" width="100%"></th> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <tr> <td align="left" class="footer"> Generated by Epydoc 3.0.1 on Wed Oct 3 10:05:05 2012 </td> <td align="right" class="footer"> <a target="mainFrame" href="http://epydoc.sourceforge.net" >http://epydoc.sourceforge.net</a> </td> </tr> </table> <script type="text/javascript"> <!-- // Private objects are initially displayed (because if // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. checkCookie(); // --> </script> </body> </html>