导入的 GeoTIFF 文件仅返回 NAN 值

发布于 2025-01-11 11:53:12 字数 617 浏览 3 评论 0原文

我一直在尝试导入显示辐照度数据的 GEOTIFF 文件。我能够绘制(请参阅绘制此处)该文件,因此我确信该文件包含数据;然而;栅格数组仅包含 nan 值。有什么办法可以解决这个问题吗?我对 python 很陌生,所以也许我错过了一些明显的东西,任何帮助将不胜感激:)

这是我正在使用的代码:

from osgeo import gdal
import numpy as np
import matplotlib.pyplot as plt
import gc
gc.enable()

#import 
ds = gdal.Open('DNI_Spain.tif')
gt = ds.GetGeoTransform()
proj = ds.GetProjection()

band = ds.GetRasterBand(1)
array = band.ReadAsArray()
max_value = np.max(array)
min_value = np.min(array)
median_value = np.median(array)


plt.figure()
plt.imshow(array)

I have been trying to import a GEOTIFF file that shows irradiance data. I am able to plot (see Plot here) the file so I am sure the file has data; however; the raster array contains only nan values. Is there any way to resolve this? I am quite new to python so perhaps I've missed something obvious, any help would be appreciated :)

This is the code I'm using:

from osgeo import gdal
import numpy as np
import matplotlib.pyplot as plt
import gc
gc.enable()

#import 
ds = gdal.Open('DNI_Spain.tif')
gt = ds.GetGeoTransform()
proj = ds.GetProjection()

band = ds.GetRasterBand(1)
array = band.ReadAsArray()
max_value = np.max(array)
min_value = np.min(array)
median_value = np.median(array)


plt.figure()
plt.imshow(array)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文