我有一个 hdf 文件,想从中提取数据。由于某种原因,我无法提取纬度和经度值:
我尝试的代码是:
from pyhdf import SD
hdf = SD.SD('MOD10C2.A2001033.006.2016092173057.hdf')
data = hdf.select('Eight_Day_CMG_Snow_Cover')
lat = (hdf.select('Latitude'))[:]
它给了我一个错误:
HDF4Error: select: non-existent dataset
我试过:
lat = (hdf.select('Lat'))[:]
仍然没有帮助!
数据可以在这个链接中找到
任何帮助将不胜感激!
数据格式如下:
我得到的错误是:
---------------------------------------------------------------------------
HDF4Error Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/pyhdf/SD.py in select(self, name_or_index)
1635 try:
-> 1636 idx = self.nametoindex(name_or_index)
1637 except HDF4Error:
~/anaconda3/lib/python3.6/site-packages/pyhdf/SD.py in nametoindex(self, sds_name)
1528 sds_idx = _C.SDnametoindex(self._id, sds_name)
-> 1529 _checkErr('nametoindex', sds_idx, 'non existent SDS')
1530 return sds_idx
~/anaconda3/lib/python3.6/site-packages/pyhdf/error.py in _checkErr(procName, val, msg)
22 err = "%s : %s" % (procName, msg)
---> 23 raise HDF4Error(err)
HDF4Error: nametoindex : non existent SDS
During handling of the above exception, another exception occurred:
HDF4Error Traceback (most recent call last)
<ipython-input-11-21e6a4fdf8eb> in <module>()
----> 1 hdf.select('Lat')
~/anaconda3/lib/python3.6/site-packages/pyhdf/SD.py in select(self, name_or_index)
1636 idx = self.nametoindex(name_or_index)
1637 except HDF4Error:
-> 1638 raise HDF4Error("select: non-existent dataset")
1639 id = _C.SDselect(self._id, idx)
1640 _checkErr('select', id, "cannot execute")
HDF4Error: select: non-existent dataset