python - Meshgrid 等值线图的不一致数据集

标签 python mesh contourf

我将不一致的数据集更改为一致的数据集。现在我遇到了这个问题:我不明白如何从三个一维数据框列创建轮廓。

我如何将它们网格化以绘制等高线图? 这三列是:

data_month['Timestamp'], data_month['Altitude_[m]'], data_month['Horizontal_Wind_Speed_[m/s]']

尺寸为:

Name:  Timestamp, Length: 10692, dtype: datetime64[ns]
--------
Name: Altitude_[m], Length: 10692, dtype: int64
---------
Name: Horizontal_Wind_Speed_[m/s], Length: 10692, dtype: float64

那么我如何才能网格化, reshape 它们呢? data_month['Altitude_[m]'] 每 33 步重复一次。

非常感谢。

最佳答案

所以我找到了解决方案。 对我来说这有效。

yi = np.linspace(minimum_range_m, maximum_range_m, number_of_gates)
xi = list(set(pd.to_datetime(data_month['Timestamp'].values.tolist())))
xi.sort()

zi = data_month['Horizontal_Wind_Speed_[m/s]'].values.tolist()
Zi = np.reshape(zi, (len(xi),len(yi))).T

fig, ax = plt.subplots()
cp = plt.contourf(xi, yi, Zi)
fig.colorbar(cp)
plt.show()

关于python - Meshgrid 等值线图的不一致数据集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55953339/

相关文章:

python - 安装多处理python3

python - 重新加载已导入到另一个模块的模块

python - 如何在 django 中使用 HTMLParser 的另一个模块位置

mesh - 如何在 MeshLab 中测量点云的邻居之间的平均距离

matlab - grid2grid 存在吗?

python - fastapi - 使用 JWT 的 Firebase 身份验证?

python - 从网格数据中提取坐标

matlab - 颜色图三种颜色

python - matplotlib:将颜色分配给半径

python pyplot : colorbar on contourf and scatter in same plot