Computations with Arrays

NB. When using biggus, all computations are deferred until the results are explicitly requested.

Statistical operations

biggus.mean(a, axis=None, mdtol=1)

Request the mean of an Array over any number of axes.

Note

Currently limited to operating on a single axis.

Parameters:
  • axis (None, or int, or iterable of ints.) – Axis or axes along which the operation is performed. The default (axis=None) is to perform the operation over all the dimensions of the input array. The axis may be negative, in which case it counts from the last to the first axis. If axis is a tuple of ints, the operation is performed over multiple axes.
  • mdtol (float) – Tolerance of missing data. The value in each element of the resulting array will be masked if the fraction of masked data contributing to that element exceeds mdtol. mdtol=0 means no missing data is tolerated while mdtol=1 will mean the resulting element will be masked if and only if all the contributing elements of the source array are masked. Defaults to 1.
Returns:

The Array representing the requested mean.

Return type:

Array

biggus.std(a, axis=None, ddof=0)

Request the standard deviation of an Array over any number of axes.

Note

Currently limited to operating on a single axis.

Parameters:
  • axis (None, or int, or iterable of ints.) – Axis or axes along which the operation is performed. The default (axis=None) is to perform the operation over all the dimensions of the input array. The axis may be negative, in which case it counts from the last to the first axis. If axis is a tuple of ints, the operation is performed over multiple axes.
  • ddof (int) – Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns:

The Array representing the requested standard deviation.

Return type:

Array

biggus.var(a, axis=None, ddof=0)

Request the variance of an Array over any number of axes.

Note

Currently limited to operating on a single axis.

Parameters:
  • axis (None, or int, or iterable of ints.) – Axis or axes along which the operation is performed. The default (axis=None) is to perform the operation over all the dimensions of the input array. The axis may be negative, in which case it counts from the last to the first axis. If axis is a tuple of ints, the operation is performed over multiple axes.
  • ddof (int) – Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns:

The Array representing the requested variance.

Return type:

Array

Elementwise operations

biggus.add(a, b)

Return the elementwise evaluation of np.add(a, b) as another Array.

biggus.sub(a, b)

Return the elementwise evaluation of np.subtract(a, b) as another Array.

Evaluation

It is always possible to use the masked_array() and/or ndarray() methods which are present on every biggus Array.

Array.masked_array()

Returns the NumPy MaskedArray instance that corresponds to this virtual array.

Array.ndarray()

Returns the NumPy ndarray instance that corresponds to this virtual array.

But for multiple expressions with shared sub-expressions it is more efficient to request the evaluations in a single call.

biggus.ndarrays(arrays)

Return a list of NumPy ndarray objects corresponding to the given biggus Array objects.

This can be more efficient (and hence faster) than converting the individual arrays one by one.

For expressions whose results are too large to return as a numpy ndarray it is possible to request they be sent piece-by-piece to an alternative output, e.g. an HDF variable.

biggus.save(sources, targets, masked=False)

Save the numeric results of each source into its corresponding target.

Parameters:
  • sources (list) – The list of source arrays for saving from; limited to length 1.
  • targets (list) – The list of target arrays for saving to; limited to length 1.
  • masked (boolean) – Uses a masked array from sources if True.