pyinterp.Binning2D

class pyinterp.Binning2D(x: Axis, y: Axis, wgs: Spheroid | None = None, dtype: dtype | None = None)[source]

Bases: object

Group continuous values into bins located on a grid.

Create a 2D binning structure that groups a number of more or less continuous values into a smaller number of “bins” located on a grid for statistical calculations.

Parameters:
  • x – Definition of the bin centers for the X axis of the grid.

  • y – Definition of the bin centers for the Y axis of the grid.

  • wgs – 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 – 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.

Attributes

wgs

Get the geodetic system handled by the grid.

x

Get the bin centers for the X Axis of the grid.

y

Get the bin centers for the Y Axis of the grid.

Public Methods

clear()

Clear the data inside each bin.

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

Push new samples into the defined bins.

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

Push new samples into the defined bins from dask array.

variable([statistics])

Get the regular grid containing the calculated statistics.

Special Methods

__add__(other)

Override the default behavior of the + operator.

__repr__()

Compute the string representation of this instance.