首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何用Python读取MODIS HDF文件的位置坐标?

如何用Python读取MODIS HDF文件的位置坐标?
EN

Stack Overflow用户
提问于 2022-11-07 03:06:40
回答 1查看 47关注 0票数 0

我正在尝试用Python读取MODIS HDF文件。我使用过GDAL和pyhdf库。但是,我不知道为什么GDAL无法读取位置坐标,而pyhdf却可以轻松读取位置坐标。下面是简单的python代码。

代码语言:javascript
复制
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的输出如下:

代码语言:javascript
复制
{'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的输出如下:

代码语言:javascript
复制
[676x451] Solar_Zenith mod04 (16-bit integer)
[676x451] Solar_Azimuth mod04 (16-bit integer)

我想知道为什么GDAL无法在这里读取位置坐标。我遗漏了什么吗?如何使用GDAL库提取位置信息?我最终的主要目标是在地图上绘制HDF文件中的一个特定变量。

EN

回答 1

Stack Overflow用户

发布于 2022-11-12 06:08:12

1952年至1954年的检查线

https://github.com/OSGeo/gdal/blob/master/frmts/hdf4/hdf4imagedataset.cpp

pyhdf不查找lat/lon数据集。它是HDF4库的简单包装器。

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

https://stackoverflow.com/questions/74341571

复制
相关文章

相似问题

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