<?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.MFTime</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 MFTime </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> </table> </td> </tr> </table> <!-- ==================== CLASS DESCRIPTION ==================== --> <h1 class="epydoc">Class MFTime</h1><p class="nomargin-top"></p> <pre class="base-tree"> object --+ | _Variable --+ | <strong class="uidshort">MFTime</strong> </pre> <hr /> <p>MFTime(self, time, units=None)</p> <p>Class providing an interface to a MFDataset time Variable by imposing a unique common time unit to all files.</p> <p>Example usage:</p> <pre class="py-doctest"> <span class="py-prompt">>>> </span><span class="py-keyword">import</span> numpy <span class="py-prompt">>>> </span>f1 = Dataset(<span class="py-string">'mftest_1.nc'</span>,<span class="py-string">'w'</span>, format=<span class="py-string">'NETCDF4_CLASSIC'</span>) <span class="py-prompt">>>> </span>f2 = Dataset(<span class="py-string">'mftest_2.nc'</span>,<span class="py-string">'w'</span>, format=<span class="py-string">'NETCDF4_CLASSIC'</span>) <span class="py-prompt">>>> </span>f1.createDimension(<span class="py-string">'time'</span>,None) <span class="py-prompt">>>> </span>f2.createDimension(<span class="py-string">'time'</span>,None) <span class="py-prompt">>>> </span>t1 = f1.createVariable(<span class="py-string">'time'</span>,<span class="py-string">'i'</span>,(<span class="py-string">'time'</span>,)) <span class="py-prompt">>>> </span>t2 = f2.createVariable(<span class="py-string">'time'</span>,<span class="py-string">'i'</span>,(<span class="py-string">'time'</span>,)) <span class="py-prompt">>>> </span>t1.units = <span class="py-string">'days since 2000-01-01'</span> <span class="py-prompt">>>> </span>t2.units = <span class="py-string">'days since 2000-02-01'</span> <span class="py-prompt">>>> </span>t1.calendar = <span class="py-string">'standard'</span> <span class="py-prompt">>>> </span>t2.calendar = <span class="py-string">'standard'</span> <span class="py-prompt">>>> </span>t1[:] = numpy.arange(31) <span class="py-prompt">>>> </span>t2[:] = numpy.arange(30) <span class="py-prompt">>>> </span>f1.close() <span class="py-prompt">>>> </span>f2.close() <span class="py-prompt">>>> </span><span class="py-comment"># Read the two files in at once, in one Dataset.</span> <span class="py-prompt">>>> </span>f = MFDataset(<span class="py-string">'mftest*nc'</span>) <span class="py-prompt">>>> </span>t = f.variables[<span class="py-string">'time'</span>] <span class="py-prompt">>>> </span><span class="py-keyword">print</span> t.units <span class="py-output">days since 2000-01-01</span> <span class="py-output"></span><span class="py-prompt">>>> </span><span class="py-keyword">print</span> t[32] <span class="py-comment"># The value written in the file, inconsistent with the MF time units.</span> <span class="py-output">1</span> <span class="py-output"></span><span class="py-prompt">>>> </span>T = MFTime(t) <span class="py-prompt">>>> </span><span class="py-keyword">print</span> T[32] <span class="py-output">32</span></pre> <!-- ==================== 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.MFTime-class.html#__getitem__" class="summary-sig-name">__getitem__</a>(<span class="summary-sig-arg">...</span>)</span><br /> Get records from a concatenated set of variables.</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.MFTime-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">time</span>, <span class="summary-sig-arg">units</span>=<span class="summary-sig-default">None</span>)</span><br /> Create a time Variable with units consistent across a multifile dataset.</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>_Variable</code></b>: <code>__getattr__</code>, <code>__len__</code>, <code>__str__</code>, <code>ncattrs</code>, <code>set_auto_maskandscale</code>, <code>typecode</code> </p> <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: <code>__delattr__</code>, <code>__format__</code>, <code>__getattribute__</code>, <code>__hash__</code>, <code>__new__</code>, <code>__reduce__</code>, <code>__reduce_ex__</code>, <code>__repr__</code>, <code>__setattr__</code>, <code>__sizeof__</code>, <code>__subclasshook__</code> </p> </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 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="__getitem__"></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">__getitem__</span>(<span class="sig-arg">...</span>)</span> <br /><em class="fname">(Indexing operator)</em> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>Get records from a concatenated set of variables.</p> <dl class="fields"> <dt>Overrides: _Variable.__getitem__ <dd><em class="note">(inherited documentation)</em></dd> </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">time</span>, <span class="sig-arg">units</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>Create a time Variable with units consistent across a multifile dataset.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>time</code></strong> - Time variable from a MFDataset.</li> <li><strong class="pname"><code>units</code></strong> - Time units, for example, 'days since 1979-01-01'. If None, use the units from the master variable.</li> </ul></dd> <dt>Overrides: object.__init__ </dt> </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>