pyinterp.grid.Grid2D

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

Bases: object

2D Cartesian Grid.

__init__(*args, increasing_axes: Optional[str] = None)[source]

Initialize a new 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 ({'inplace', 'copy'}, optional) – 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>
Axis:
  x: Axis([-180, -179, -178, ..., 178, 179], is_circle=true)
  y: Axis([-80, -79, -78, ..., 78, 79], is_circle=false)
Data:
  [[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.]]

Methods

Grid2D._DIMENSIONS

The number of grid dimensions handled by this object

Grid2D.__repr__()

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

Attributes

Grid2D.array

Gets the values handled by this instance.

Grid2D.x

Gets the X-Axis handled by this instance.

Grid2D.y

Gets the Y-Axis handled by this instance