hist

hist(bins, y, /, axis=0)[source]

Get the histogram along axis axis.

Parameters
  • bins (array-like) – The bin location.

  • y (array-like) – The data.

  • axis (int, optional) – Axis along which histogram is computed.

  • dim (str, optional) – For `xarray.DataArray` input only. Named dimension along which the histogram is computed.

Example

>>> import climopy as climo
... import numpy as np
... import xarray as xr
... ureg = climo.ureg
... data = xr.DataArray(
...     np.random.rand(20, 1000) * ureg.m,
...     name='distance',
...     dims=('x', 'y'),
...     coords={'x': np.arange(20), 'y': np.arange(1000) * 0.1}
... )
... bins = np.linspace(0, 1, 11) * ureg.m
... hist = climo.hist(bins, data, axis=1)