pyinterp.grid.Grid3D#
- class pyinterp.grid.Grid3D(x: Axis, y: Axis, z: Axis | TemporalAxis, array: NDArray3D, increasing_axes: str | None = None)[source]#
Bases:
object3D Cartesian Grid.
- Parameters:
x – X-Axis.
y – Y-Axis.
z – Z-Axis.
array – Discrete representation of a continuous function on a uniform 3-dimensional grid.
increasing_axes – Ensure that the axes of the grid are increasing. If this is not the case, the axes and grid provided will be flipped. Default to False.
Notes
If the Z axis is a
temporal axis, the grid will handle this axis during interpolations as a time axis.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, >>> ) >>> z_axis = pyinterp.TemporalAxis( >>> np.array( >>> ['2000-01-01'], >>> dtype="datetime64[s]", >>> )) >>> array = np.zeros((len(x_axis), len(y_axis), len(z_axis))) >>> grid = pyinterp.Grid3D(x_axis, y_axis, z_axis, array) <pyinterp.grid.Grid3D> 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, 1)) 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 * z: <pyinterp.core.TemporalAxis> values : ['2000-01-01T00:00:00']
Attributes
Gets the values handled by this instance.
Gets the X-Axis handled by this instance.
Gets the Y-Axis handled by this instance.
Gets the Z-Axis handled by this instance.
Protected Methods
Special Methods
__repr__()Get the string representation of this instance.