pyinterp.Binning2D

class pyinterp.Binning2D(x: pyinterp.core.Axis, y: pyinterp.core.Axis, wgs: Optional[pyinterp.geodetic.System] = None, dtype: Optional[numpy.dtype] = dtype('float64'))[source]

Bases: object

Group a number of more or less continuous values into a smaller number of “bins” located on a grid.

__init__(x: pyinterp.core.Axis, y: pyinterp.core.Axis, wgs: Optional[pyinterp.geodetic.System] = None, dtype: Optional[numpy.dtype] = dtype('float64'))[source]

Initializes the grid used to calculate the statistics.

Parameters
  • x (pyinterp.Axis) – Definition of the bin centers for the X axis of the grid.

  • y (pyinterp.Axis) – Definition of the bin centers for the Y axis of the grid.

  • wgs (pyinterp.geodetic.System, optional) – WGS of the coordinate system used to manipulate geographic coordinates. If this parameter is not set, the handled coordinates will be considered as Cartesian coordinates. Otherwise, x and y are considered to represents the longitudes and latitudes.

  • dtype (numpy.dtype, optional) – Data type of the instance to create.

Note

The axes define the centers of the different cells where the statistics will be calculated, as shown in the figure below.

../_images/coordinates.svg

In this example, to calculate the statistics in the different cells defined, the coordinates of the axes must be shifted by half a grid step, 0.5 in this example.

Methods

Binning2D.clear()

Clears the data inside each bin.

Binning2D.push(x, y, z[, simple])

Push new samples into the defined bins.

Binning2D.push_delayed(x, y, z[, simple])

Push new samples into the defined bins from dask array.

Binning2D.variable([statistics])

Gets the regular grid containing the calculated statistics.

Binning2D.__add__(other)

Binning2D.__repr__()

Called by the repr() built-in function to compute the string representation of this instance

Attributes

Binning2D.wgs

Gets the geodetic system handled of the grid

Binning2D.x

Gets the bin centers for the X Axis of the grid

Binning2D.y

Gets the bin centers for the Y Axis of the grid