【发布时间】:2016-03-24 22:01:59
【问题描述】:
我正在使用以下脚本对一些 (x, y, z) 数据使用 LinearNDInterpolator。但是,我无法弄清楚如何从插值数据到以热图形式绘制/显示插值?我是否错过了基于 x 和 y 的最小值和最大值设置网格网格之类的东西?任何帮助或示例都会很棒!
import numpy as np
import scipy.interpolate
x = np.array([-4386795.73911443, -1239996.25110694, -3974316.43669208,
1560260.49911342, 4977361.53694849, -1996458.01768192,
5888021.46423068, 2969439.36068243, 562498.56468588,
4940040.00457585])
y = np.array([ -572081.11495993, -5663387.07621326, 3841976.34982795,
3761230.61316845, -942281.80271223, 5414546.28275767,
1320445.40098735, -4234503.89305636, 4621185.12249923,
1172328.8107458 ])
z = np.array([ 4579159.6898615 , 2649940.2481702 , 3171358.81564312,
4892740.54647532, 3862475.79651847, 2707177.605241 ,
2059175.83411223, 3720138.47529587, 4345385.04025412,
3847493.83999694])
# Create coordinate pairs
cartcoord = zip(x, y)
# Interpolate
interp = scipy.interpolate.LinearNDInterpolator(cartcoord, z)
编辑: 基于@Spinor 的解决方案并使用 Python 2.7,以下代码为我提供了我正在寻找的内容(方法 1)。有没有办法增加插值点的密度?
不用说,我没想到结果是圆形的,因为 (lat,lon) 坐标取自 equirectrangular 投影图。在进一步调查中,我认为这只是映射到different projection。
【问题讨论】:
标签: python scipy interpolation imaging