pyinterp.grid.Grid2D#
- class pyinterp.grid.Grid2D(x: Axis, y: Axis, array: NDArray2D, increasing_axes: str | None = None)[source]#
Bases:
object2D Cartesian Grid.
- Parameters:
x – X-Axis.
y – Y-Axis.
array – 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) <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.]], shape=(360, 160)) Axis: * x: <pyinterp.core.Axis> min_value: -180 max_value: 179 step : 1 is_circle: true * y: <pyinterp.core.Axis> min_value: -80 max_value: 79 step : 1 is_circle: false
Attributes
Gets the values handled by this instance.
Gets the X-Axis handled by this instance.
Gets the Y-Axis handled by this instance.
Protected Methods
The number of grid dimensions handled by this object.
Special Methods
__repr__()Get the string representation of this instance.