我想用 xarray 对沿红线的空气值进行插值和外推。我正在按照文档中的示例进行操作,但是我遗漏了一些东西,我认为我的代码正在对整个图像进行插值?我只想要红线:
如何将插值限制为仅红线? 这是代码:
ds = xr.tutorial.open_dataset("air_temperature")
ds_mean = ds.air.mean(dim='time')
def line(x,A):
return x, A*x
x, y = line(np.linspace(ds_mean.lon[0], ds_mean.lon[-1], 30), 0.1)
dsi = ds_mean.interp(lon=x, lat=y, kwargs={"fill_value":"extrapolate"})
fig, axes = plt.subplots(ncols=2, figsize=(10, 4))
ds_mean.plot(ax=axes[0],zorder=0, alpha=0.4)
axes[0].plot(x,y,'o',zorder=10)
axes[0].set_title("Mean Air")
dsi.plot(ax=axes[1])
axes[1].set_title("Mean air along one line")