我正在尝试用Python读取MODIS HDF文件。我使用过GDAL和pyhdf库。但是,我不知道为什么GDAL无法读取位置坐标,而pyhdf却可以轻松读取位置坐标。下面是简单的python代码。
from pyhdf import SD
from osgeo import gdal
filename = 'MYD04_3K.A2016001.0310.061.2018059005952.hdf'
gdal_ds= gdal.Open(filename)
hdf_ds = SD.SD(filename)
print (hdf_ds.datasets())
for path, desc in file.GetSubDatasets():
print(desc)pyhdf的输出如下:
{'Longitude': (('Cell_Along_Swath:mod04', 'Cell_Across_Swath:mod04'), (676, 451), 5, 0), 'Latitude': (('Cell_Along_Swath:mod04', 'Cell_Across_Swath:mod04'), (676, 451), 5, 1), 'Scan_Start_Time': (('Cell_Along_Swath:mod04', 'Cell_Across_Swath:mod04'), (676, 451), 6, 2), 'Solar_Zenith': (('Cell_Along_Swath:mod04', 'Cell_Across_Swath:mod04'),GDAL的输出如下:
[676x451] Solar_Zenith mod04 (16-bit integer)
[676x451] Solar_Azimuth mod04 (16-bit integer)我想知道为什么GDAL无法在这里读取位置坐标。我遗漏了什么吗?如何使用GDAL库提取位置信息?我最终的主要目标是在地图上绘制HDF文件中的一个特定变量。
发布于 2022-11-12 06:08:12
1952年至1954年的检查线
https://github.com/OSGeo/gdal/blob/master/frmts/hdf4/hdf4imagedataset.cpp
pyhdf不查找lat/lon数据集。它是HDF4库的简单包装器。
https://stackoverflow.com/questions/74341571
复制相似问题