首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >根据shapefile掩码获取栅格图像的值

根据shapefile掩码获取栅格图像的值
EN

Stack Overflow用户
提问于 2021-10-12 14:45:51
回答 1查看 30关注 0票数 0

我有一个光栅文件,它由三个独立的2D-numpy数组(数据、经度、经度)和一个shapefile (.shp)组成,它们是从一个NetCDF文件导入的。我想使用shapefile作为掩码来计算掩码中所有数据点的平均值、中位数和标准差。在Python中做这件事最好的地方是什么?

This is how it looks like on the map

代码语言:javascript
复制
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()
EN

回答 1

Stack Overflow用户

发布于 2021-10-13 11:38:24

查看rasterio库。Geopandas (Vectordata)处理栅格数据的对应物。处理掩码以及对数据的计算。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69542594

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档