cf.Data.argmax

Data.argmax(axis=None, unravel=False)[source]

Return the indices of the maximum values along an axis.

If no axis is specified then the returned index locates the maximum of the whole data.

Parameters:
axis: int, optional

The specified axis over which to locate the maximum values. By default the maximum over the whole data is located.

unravel: bool, optional

If True, then when locating the maximum over the whole data, return the location as a tuple of indices for each axis. By default an index to the flattened array is returned in this case. Ignored if locating the maxima over a subset of the axes.

Returns:
int or tuple or Data

The location of the maximum, or maxima.

Examples:

>>> d = cf.Data(numpy.arange(120).reshape(4, 5, 6))
>>> d.argmax()
119
>>> d.argmax(unravel=True)
(3, 4, 5)
>>> d.argmax(axis=0)
<CF Data(5, 6): [[3, ..., 3]]>
>>> d.argmax(axis=1)
<CF Data(4, 6): [[4, ..., 4]]>
>>> d.argmax(axis=2)
<CF Data(4, 5): [[5, ..., 5]]>