我有一个光栅文件,它由三个独立的2D-numpy数组(数据、经度、经度)和一个shapefile (.shp)组成,它们是从一个NetCDF文件导入的。我想使用shapefile作为掩码来计算掩码中所有数据点的平均值、中位数和标准差。在Python中做这件事最好的地方是什么?
This is how it looks like on the map
import matplotlib.pyplot as plt
import geopandas
plume = geopandas.read_file(shapefile)
fig = plt.figure()
ax = fig.add_subplot(111, projection=ccrs.PlateCarree)
f = ax.pcolormesh(lons, lats, np.ma.masked_invalid(data), shading='auto', transform=ccrs.PlateCarree())
plume.boundary.plot(ax=ax)
plt.show()发布于 2021-10-13 11:38:24
查看rasterio库。Geopandas (Vectordata)处理栅格数据的对应物。处理掩码以及对数据的计算。
https://stackoverflow.com/questions/69542594
复制相似问题