Bases: cf.utils.CfList
An N-dimensional partition array.
Initialization
Parameters : |
|
---|
Examples
>>> pa = PartitionArray(
[Partition(location = [(0,n) for n in shape],
shape = shape[:],
order = order[:],
direction = copy(direction),
Units = units.copy(),
part = [],
data = data)
],
order = order,
shape = shape,
size = data.size,
Units = units.copy(),
ndim = ndim,
direction = direction,
adims = [],
_FillValue = _FillValue)
dim_name_map should be a dictionary which maps each dimension names in self.order to its new dimension name. E.g. {‘dim0’:’dim1’, ‘dim1’:’dim0’}
Return a deep copy.
Do not set the _copy_attr parameter. It is for internal use only.
Equivalent to copy.deepcopy(pa).
Returns : |
|
---|
Examples
>>> pa.copy()
Return the number of occurrences of a given value.
Parameters : |
|
---|---|
Returns : |
|
Examples
>>> s
[1, 2, 3, 2, 4, 2]
>>> s.count(1)
1
>>> s.count(2)
3
Return a flat iterator over the Partition objects in the partition array.
Returns : |
|
---|
Examples
>>> type(pa.flat())
<generator object flat at 0x145a0f0>
>>> for partition in pa.flat():
... print partition.Units
Return the first index of a given value.
Parameters : | value : start : int, optional stop : int, optional |
---|---|
Returns : | out : int |
Raises : |
|
Examples
>>> s
[1, 2, 3, 2, 4, 2]
>>> s.index(1)
1
>>> s.index(2, start=2)
3
>>> s.index(2, start=2, stop=4)
3
Insert an object before the given index in place.
Parameters : | index : int object : |
---|---|
Returns : | None |
Examples
>>> s
[1, 2, 3]
>>> s.insert(1, 'A')
>>> s
[1, 'A', 2, 3]
Return a flattened partition array as a built-in list.
Returns : |
|
---|
Examples
>>> x = partitions.ravel()
>>> type(x)
list
Roll the specified aggregating dimension backwards,in place until it lies in a given position.
This does not change the master array.
Parameters : |
|
---|---|
Returns : | None |
Examples
>>> pa.rollaxis(2)
>>> pa.rollaxis(2, start=1)
Parameters : | itemsize : int, optional |
---|---|
Returns : | out : bool |
Recalculate the location attribute of each Partition object in the partition array in place.
Examples
>>> pa.set_location_map()
Store each partition’s data on disk in place.
There is no change to partitions with data that are already on disk.
Returns : | None |
---|
Examples
>>> pa.to_disk()
Store each partition’s data in memory in place if the master array is smaller than the chunk size.
There is no change to partitions with data that are already in memory.
Parameters : |
|
---|---|
Returns : | None |
Examples
>>> pa.to_memory()
>>> pa.to_memory(True)
Permute the aggregating dimensions of the partition array in-place.
This does not change the master array.
Parameters : |
|
---|---|
Returns : | None |
Examples
>>> pa.transpose((2,0,1))
Numpy data-type of the master array.
When there is more than one partition in the partition array, the normal data-type coercion rules apply. For example, if the partitions have data-types ‘int32’ and ‘float32’ then the master array’s data-type will be ‘float32’.
Examples
>>> pa.dtype
dtype('float64')
True if the master array is a 0-d scalar array.
Examples
>>> pa.ndim
0
>>> pa.is_scalar
True
>>> pa.ndim >= 1
True
>>> pa.is_scalar
False
The number of partitions in the partition array.
Logically equivalent to len(pa.ravel()).
Examples
>>> pa.npartitions
7