Skip to content

Commit e86a3be

Browse files
committed
Add multi-dimensional extrapolation example
1 parent 7f9d469 commit e86a3be

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

doc/interpolation.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,14 @@ Additional keyword arguments can be passed to scipy's functions.
150150
151151
# fill 0 for the outside of the original coordinates.
152152
da.interp(x=np.linspace(-0.5, 1.5, 10), kwargs={'fill_value': 0.0})
153-
# extrapolation
153+
# 1-dimensional extrapolation
154154
da.interp(x=np.linspace(-0.5, 1.5, 10), kwargs={'fill_value': 'extrapolate'})
155+
# multi-dimensional extrapolation
156+
da = xr.DataArray(np.sin(0.3 * np.arange(12).reshape(4, 3)),
157+
[('time', np.arange(4)),
158+
('space', [0.1, 0.2, 0.3])])
159+
160+
da.interp(time=4, space=np.linspace(-0.1, 0.5, 10), kwargs={'fill_value': None})
155161
156162
157163
Advanced Interpolation

0 commit comments

Comments
 (0)