hdfgd issue when reading MODIS mcd12c1 coordinates (or the way to get the coordinates of hdf-eos data)

7 次查看(过去 30 天)
I used the code below to try to get the grid information of MODIS MCD12C1 data. The data format is hdf-eos. But grid_id always equals to -1. Does anyone know why or share another way with me to read the coordinates of hdf-eos data. Thank you!!!
FILE_NAME='MCD12C1.A2001001.051.2014274170618.hdf'
GRID_NAME='GeoGrid'
file_id = hdfgd('open', FILE_NAME, 'rdonly')
grid_id = hdfgd('attach', file_id, GRID_NAME)

回答(1 个)

Rong Yu
Rong Yu 2015-6-11
Figured it out.
GRID_NAME should be the exact one from the metadata, which can be achieved by hdfinfo.
For example,
fileinfo = hdfinfo('MCD12C1.A2009001.051.2013164180520.hdf');
In fileinfo>attributes>'StructMetadata.0', there is GridName.

类别

Help CenterFile Exchange 中查找有关 Oceanography and Hydrology 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by