cf.Filearray

class cf.FileArray(array)

Bases: object

A indexable N-dimensional array supporting masked values.

The array is stored on disk in a temporary file until it is accessed. The directory containing the temporary file may be found and set in the cf.CONSTANTS dictionary.

Indexing

The array is indexable in a similar way to numpy array indexing but for two important differences:

  • Size 1 dimensions are never removed.

    An integer index i takes the i-th element but does not reduce the rank of the output array by one.

  • When advanced indexing is used on more than one dimension, the advanced indices work independently.

    When more than one dimension’s slice is a 1-d boolean array or 1-d sequence of integers, then these indices work independently along each dimension (similar to the way vector subscripts work in Fortran), rather than by their elements.

Examples

>>> f.shape
(12, 19, 73, 96)
>>> d[0, :, [0,1], [0,1,2]].shape
(1, 19, 2, 3)

Initialization

Parameters :
array : numpy array

The array to be stored on disk in a temporary file.

Examples

>>> f = FileArray(numpy.array([1, 2, 3, 4, 5]))
>>> f = FileArray(numpy.ma.array([1, 2, 3, 4, 5]))

FileArray attributes

dtype
ndim
shape
size

FileArray methods

copy Return a deep copy.
copy()

Return a deep copy.

Equivalent to copy.deepcopy(f).

Returns :
out :

A deep copy.

Examples

>>> f.copy()
dtype

Numpy data type of the array.

Examples

>>> f.dtype
dtype('float64')
ndim

Number of dimensions in the array.

Examples

>>> f.shape
(73, 96)
>>> f.ndim
2
shape

Tuple of the array’s dimension sizes.

Examples

>>> f.shape
(73, 96)
size

Number of elements in the array.

Examples

>>> f.shape
(73, 96)
>>> f.size
7008

Previous topic

cf.PartitionArray

Next topic

cf.CfDict

This Page