Package netCDF4 :: Module _netCDF4 :: Class MFTime
[hide private]
[frames] | no frames]

Class MFTime

object --+    
         |    
 _Variable --+
             |
            MFTime


Class providing an interface to a MFDataset time Variable by imposing a unique common
time unit to all files. 

Example usage (See `netCDF4.MFTime.__init__` for more details):

    :::python
    >>> import numpy
    >>> f1 = Dataset("mftest_1.nc","w", format="NETCDF4_CLASSIC")
    >>> f2 = Dataset("mftest_2.nc","w", format="NETCDF4_CLASSIC")
    >>> f1.createDimension("time",None)
    >>> f2.createDimension("time",None)
    >>> t1 = f1.createVariable("time","i",("time",))
    >>> t2 = f2.createVariable("time","i",("time",))
    >>> t1.units = "days since 2000-01-01"
    >>> t2.units = "days since 2000-02-01"
    >>> t1.calendar = "standard"
    >>> t2.calendar = "standard"
    >>> t1[:] = numpy.arange(31)
    >>> t2[:] = numpy.arange(30)
    >>> f1.close()
    >>> f2.close()
    >>> # Read the two files in at once, in one Dataset.
    >>> f = MFDataset("mftest*nc")
    >>> t = f.variables["time"]
    >>> print t.units
    days since 2000-01-01
    >>> print t[32] # The value written in the file, inconsistent with the MF time units.
    1
    >>> T = MFTime(t)
    >>> print T[32]
    32
    

Instance Methods [hide private]
 
__getitem__(...)
Get records from a concatenated set of variables.
 
__init__(...)
**`__init__(self, time, units=None)`**

Inherited from _Variable: __getattr__, __len__, __repr__, ncattrs, set_auto_maskandscale, typecode

Inherited from _Variable (private): _shape

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __qualname__ = 'MFTime'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__getitem__(...)
(Indexing operator)

 

Get records from a concatenated set of variables.

Overrides: _Variable.__getitem__
(inherited documentation)

__init__(...)
(Constructor)

 

**`__init__(self, time, units=None)`**

Create a time Variable with units consistent across a multifile dataset.

**`time`**: Time variable from a `netCDF4.MFDataset`.

**`units`**: Time units, for example, `days since 1979-01-01`. If None, use the units from the master variable.

Overrides: object.__init__