我有一个稀疏的数据集,f44
,由度数方向和ssi(dbm)值组成:
ssi
deg
4.0 -69
59.0 -73
162.0 -73
267.0 -61
319.0 -75
我重新索引了f44
,以包含0-359中所有缺失的索引:
^{pr2}$
当我插值(使用二次曲线)并绘制图形时,很明显,结果不会在第一个/最低方位和最高方位之间插值:
f44i = f44i.interpolate(method='quadratic')
f44i.plot()
如何以0到360度的方式插值此数据?^{}文档似乎没有任何内置内容,^{}文档也没有。在
Tags:
我有另一种方法来解决这个问题,使用
scipy
在闭合曲线上插值。首先,我将数据从(deg,ssi)转换为psuedo笛卡尔坐标(x,y),假设deg
是极角,ssi
是径向距离的(负)。然后可以使用定义的方法here将闭合曲线插值到一组(x,y)点上。在现在我们得到一条曲线,看起来像下面的曲线。(从psuedo笛卡尔坐标重新转换为首选(deg,ssi)坐标)。另外,我还创建了一个新的数据帧来替换您创建的
f44i
。您可以使此代码更适合您的特定应用程序。在我不相信这是最好的办法,但它似乎有效。如果有更好的方法,请添加一些内容。在
由于我只对0-360度感兴趣,我可以从-360-0和360-720复制数据集,将原始数据集向左和向右展开,如下所示:
插值和绘制结果看起来很有希望(第三个命令以不同的颜色显示0-360):
^{pr2}$然后,我可以从插值数据中创建一个新的序列,索引范围为0-360,这看起来正好满足我的需要:
我怀疑有更好的方法可以做到这一点,所以如果你知道答案的话,可以随意添加一个答案。在
相关问题 更多 >
编程相关推荐