赞
踩
读取遥感影像
FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if im_data == “None”:
dataset = gdal.Open(image)
im_geotrans = dataset.GetGeoTransform() # 仿射矩阵
im_proj = dataset.GetProjection() # 地图投影信息
im_data = dataset.ReadAsArray() # 将数据写成数组,对应栅格矩阵,读进来后空值会变为0
im_data =np.where(im_data == 0,np.nan,im_data) # 将0设置为空值
if im_data == "None":
print("无法打开数据")
元素比较失败
将 if im_data == "None":
替换为if im_data is None:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。