INTERPOLATION
RegularGridInterpolator
Interpolator of specified order on a rectilinear grid in N ≥ 1 dimensions.
Example of usage
Python API reference included; executable data demonstration pending review.
Usage / limitations
+Use when: Estimate values between samples.
−Limitations: Check input requirements, mathematical assumptions and version-specific behaviour before using.
Mathematical formula
See method documentation: implementation and assumptions vary.
Sample dataShow
{
"variable": "observations",
"domain": "Environmental monitoring — regular weather monitoring grid",
"feature_names": [
"east_km",
"north_km",
"temperature_c"
],
"grid_east_km": [
0,
1,
2
],
"grid_north_km": [
0,
1,
2
],
"grid_temperature_c": [
[
18.0,
19.0,
20.0
],
[
19.0,
20.0,
21.0
],
[
20.0,
21.0,
22.0
]
]
}
Code example (Python)
observations = {'feature_names': ['east_km', 'north_km', 'temperature_c'], 'grid_east_km': [0, 1, 2], 'grid_north_km': [0, 1, 2], 'grid_temperature_c': [[18.0, 19.0, 20.0], [19.0, 20.0, 21.0], [20.0, 21.0, 22.0]]}
# DataLens.ai example — RegularGridInterpolator
# Domain: environmental temperature monitoring.
# Input observations is supplied by the Sample Data section.
import numpy as np
from scipy.interpolate import RegularGridInterpolator
# Read recorded measurements with explicit, meaningful feature names.
# Perform the specified interpolation and validate expected properties.
coordinates = (np.asarray(observations["grid_east_km"]), np.asarray(observations["grid_north_km"]))
values = np.asarray(observations["grid_temperature_c"], dtype=float)
model = RegularGridInterpolator(coordinates, values)
result = model([[1., 1.]])
assert np.allclose(result, [20.], atol=1e-9)
# Self-test completed without raising an assertion error.
print("Expected output verified")
# DataLens.ai example — RegularGridInterpolator
# Domain: environmental temperature monitoring.
# Input observations is supplied by the Sample Data section.
import numpy as np
from scipy.interpolate import RegularGridInterpolator
# Read recorded measurements with explicit, meaningful feature names.
# Perform the specified interpolation and validate expected properties.
coordinates = (np.asarray(observations["grid_east_km"]), np.asarray(observations["grid_north_km"]))
values = np.asarray(observations["grid_temperature_c"], dtype=float)
model = RegularGridInterpolator(coordinates, values)
result = model([[1., 1.]])
assert np.allclose(result, [20.], atol=1e-9)
# Self-test completed without raising an assertion error.
print("Expected output verified")