【发布时间】:2020-09-14 17:06:56
【问题描述】:
import numpy as np
from scipy import interpolate
wind_direction = np.array([230,265,300,330,355,10,45,12,350,14,35,70,90])
x = np.linspace(1,10,13)
xnew = np.linspace(1,10,26)
f = interpolate.interp1d(x, wind_direction ,kind="slinear")
wind_direction_new = f(xnew)
print(wind_direction_new)
问题是当插值在 355 和 10、或 12 和 350 或 350 和 14 之间时,插值不正确。
【问题讨论】:
-
也许你应该使用
-5(355-360) 而不是355。但是当你有-170(190) 和170时就会出现问题 - 所以它可能需要不同的函数来插入它。 -
使用谷歌“interpolate wind speed python”我找到了模块
MetPy和Wind and Sea Level Pressure Interpolation,也许这就是解决你问题的方法
标签: python interpolation