import numpy as np
import scipy.interpolate
import matplotlib.pyplot as plt
# 创建经纬度二维数组,分辨率为0.25°
lon_grid = np.linspace(70, 140, 281)
lat_grid = np.linspace(60, 0, 241)
lon_gridmesh, lat_gridmesh = np.meshgrid(lon_grid, lat_grid)
# 插值 rain为数据内提取出的降水一维数组
cartcoord = list(zip(lon, lat))
interp = scipy.interpolate.LinearNDInterpolator(cartcoord, rain, fill_value=np.nan)
Z0 = interp(lon_gridmesh, lat_gridmesh)
# plt绘图
plt.figure(figsize=(10,5))
plt.pcolormesh(lon_gridmesh, lat_gridmesh, Z0)
plt.colorbar() # Color Bar
plt.show()
python 三角剖分降水插值
最新推荐文章于 2024-07-12 19:06:42 发布