cfdm.Data.maximum

Data.maximum(axes=None)[source]

Return the maximum of an array or the maximum along axes.

Missing data array elements are omitted from the calculation.

New in version (cfdm): 1.8.0

See also

minimum

Parameters
axes: (sequence of) int, optional

The axes over which to take the maximum. By default the maximum over all axes is returned.

Each axis is identified by its integer position in the data. Negative integers counting from the last position are allowed.

Parameter example:

axes=0

Parameter example:

axes=-1

Parameter example:

axes=[1, -2]

Returns
Data

Maximum of the data along the specified axes.

Examples

>>> d = cfdm.Data(numpy.arange(24).reshape(1, 2, 3, 4))
>>> d
<Data(1, 2, 3, 4): [[[[0, ..., 23]]]]>
>>> print(d.array)
[[[[ 0  1  2  3]
   [ 4  5  6  7]
   [ 8  9 10 11]]
  [[12 13 14 15]
   [16 17 18 19]
   [20 21 22 23]]]]
>>> e = d.max()
>>> e
<Data(1, 1, 1, 1): [[[[23]]]]>
>>> print(e.array)
[[[[23]]]]
>>> e = d.max(2)
>>> e
<Data(1, 2, 1, 4): [[[[8, ..., 23]]]]>
>>> print(e.array)
[[[[ 8  9 10 11]]
  [[20 21 22 23]]]]
>>> e = d.max([-2, -1])
>>> e
<Data(1, 2, 1, 1): [[[[11, 23]]]]>
>>> print(e.array)
[[[[11]]
  [[23]]]]