pyinterp.grid.Grid2D#

class pyinterp.grid.Grid2D(*args, increasing_axes: Optional[str] = None)[source]#

Bases: object

2D Cartesian Grid.

Parameters
  • x (pyinterp.Axis) – X-Axis.

  • y (pyinterp.Axis) – Y-Axis.

  • array (numpy.ndarray) – Discrete representation of a continuous function on a uniform 2-dimensional grid.

  • increasing_axes – Optional string indicating how to ensure that the grid axes are increasing. If axes are decreasing, the axes and grid provided will be flipped in place or copied before being flipped. By default, the decreasing axes are not modified.

Examples

>>> import numpy as np
>>> import pyinterp
>>> x_axis = pyinterp.Axis(np.arange(-180.0, 180.0, 1.0),
...                        is_circle=True)
>>> y_axis = pyinterp.Axis(np.arange(-80.0, 80.0, 1.0),
...                        is_circle=False)
>>> array = np.zeros((len(x_axis), len(y_axis)))
>>> grid = pyinterp.Grid2D(x_axis, y_axis, array)
>>> grid
<pyinterp.grid.Grid2D>
array([[0., 0., 0., ..., 0., 0., 0.],
        [0., 0., 0., ..., 0., 0., 0.],
        [0., 0., 0., ..., 0., 0., 0.],
        ...,
        [0., 0., 0., ..., 0., 0., 0.],
        [0., 0., 0., ..., 0., 0., 0.],
        [0., 0., 0., ..., 0., 0., 0.]])
Axis:
    * x: <pyinterp.axis.Axis>
        min_value: -180.0
        max_value: 179.0
        step: 1.0
        is_circle: True
    * y: <pyinterp.axis.Axis>
        min_value: -80.0
        max_value: 79.0
        step: 1.0
        is_circle: False

Attributes

array

Gets the values handled by this instance.

x

Gets the X-Axis handled by this instance.

y

Gets the Y-Axis handled by this instance.

Protected Methods

_DIMENSIONS

The number of grid dimensions handled by this object.

Special Methods

__repr__()

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