interpolate_2d
interpolate_2d(
x1,
x2,
y,
x1out,
x2out,
x1_transform='none',
x2_transform='none',
y_transform='none',
sort_order='ascending',
)Interpolate a 2D grid (bilinear interpolation).
Mirrors the C# Bilinear interpolater of the Numerics library.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| x1 | array_like | Grid coordinates. | required |
| x2 | array_like | Grid coordinates. | required |
| y | array_like | 2D array, len(x1) rows by len(x2) columns; y[i, j] is the value at (x1[i], x2[j]). |
required |
| x1out | array_like | Equal-length positions to interpolate at. | required |
| x2out | array_like | Equal-length positions to interpolate at. | required |
| x1_transform | ('none', 'logarithmic', 'log', 'normal_z') | "logarithmic" and "log" are equivalent (see the module note on :func:interpolate); "logarithmic" is the spelling used in this package’s own examples. |
"none" |
| x2_transform | ('none', 'logarithmic', 'log', 'normal_z') | "logarithmic" and "log" are equivalent (see the module note on :func:interpolate); "logarithmic" is the spelling used in this package’s own examples. |
"none" |
| y_transform | ('none', 'logarithmic', 'log', 'normal_z') | "logarithmic" and "log" are equivalent (see the module note on :func:interpolate); "logarithmic" is the spelling used in this package’s own examples. |
"none" |
| sort_order | ('ascending', 'descending') | Describes x1 and x2. |
"ascending" |
Returns
| Name | Type | Description |
|---|---|---|
| numpy.ndarray | Same length as x1out/x2out. |
Examples
>>> from corehydropy import interpolate_2d
>>> import numpy as np
>>> interpolate_2d([1, 2, 3], [1, 2, 3], np.eye(3), [1.5], [1.5])
array([0.5])