[R-sig-Geo] GDALinfo to get hdf metadata
Jan Verbesselt
janverbesselt at gmail.com
Fri Feb 10 11:16:18 CET 2012
Hi Jonathan,
Maybe this helps:
> library(rgdal)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.8.1, released 2011/07/09
Path to GDAL shared files: /Library/Frameworks/GDAL.framework/Versions/1.8/Resources/gdal
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
Path to PROJ.4 shared files: (autodetected)
> GDALinfo('MOD13C1.A2000049.005.2006271195746.hdf')
rows 512
columns 512
bands 0
origin.x 0
origin.y 0
res.x 1
res.y 1
ysign -1
oblique.x 0
oblique.y 0
driver HDF4
projection NA
*****
> inf <- GDALinfo('MOD13C1.A2000049.005.2006271195746.hdf')
Warning messages:
1: In dim(x) : no bands in dataset
2: In GDALinfo("MOD13C1.A2000049.005.2006271195746.hdf") :
GeoTransform values not available
> attr(info,"subdsmdata")
Error: object 'info' not found
> attr(inf,"subdsmdata")
[1] "SUBDATASET_1_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days NDVI"
[2] "SUBDATASET_1_DESC=[3600x7200] CMG 0.05 Deg 16 days NDVI MODIS_Grid_16Day_VI_CMG (16-bit integer)"
[3] "SUBDATASET_2_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days EVI"
[4] "SUBDATASET_2_DESC=[3600x7200] CMG 0.05 Deg 16 days EVI MODIS_Grid_16Day_VI_CMG (16-bit integer)"
[5] "SUBDATASET_3_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days VI Quality"
[6] "SUBDATASET_3_DESC=[3600x7200] CMG 0.05 Deg 16 days VI Quality MODIS_Grid_16Day_VI_CMG (16-bit unsigned integer)"
[7] "SUBDATASET_4_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days red reflectance"
[8] "SUBDATASET_4_DESC=[3600x7200] CMG 0.05 Deg 16 days red reflectance MODIS_Grid_16Day_VI_CMG (16-bit integer)"
[9] "SUBDATASET_5_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days NIR reflectance"
[10] "SUBDATASET_5_DESC=[3600x7200] CMG 0.05 Deg 16 days NIR reflectance MODIS_Grid_16Day_VI_CMG (16-bit integer)"
[11] "SUBDATASET_6_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days blue reflectance"
[12] "SUBDATASET_6_DESC=[3600x7200] CMG 0.05 Deg 16 days blue reflectance MODIS_Grid_16Day_VI_CMG (16-bit integer)"
[13] "SUBDATASET_7_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days MIR reflectance"
[14] "SUBDATASET_7_DESC=[3600x7200] CMG 0.05 Deg 16 days MIR reflectance MODIS_Grid_16Day_VI_CMG (16-bit integer)"
[15] "SUBDATASET_8_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days Avg sun zen angle"
[16] "SUBDATASET_8_DESC=[3600x7200] CMG 0.05 Deg 16 days Avg sun zen angle MODIS_Grid_16Day_VI_CMG (16-bit integer)"
[17] "SUBDATASET_9_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days NDVI std dev"
[18] "SUBDATASET_9_DESC=[3600x7200] CMG 0.05 Deg 16 days NDVI std dev MODIS_Grid_16Day_VI_CMG (16-bit integer)"
[19] "SUBDATASET_10_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days EVI std dev"
[20] "SUBDATASET_10_DESC=[3600x7200] CMG 0.05 Deg 16 days EVI std dev MODIS_Grid_16Day_VI_CMG (16-bit integer)"
[21] "SUBDATASET_11_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days #1km pix used"
[22] "SUBDATASET_11_DESC=[3600x7200] CMG 0.05 Deg 16 days #1km pix used MODIS_Grid_16Day_VI_CMG (8-bit unsigned integer)"
[23] "SUBDATASET_12_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days #1km pix +-30deg VZ"
[24] "SUBDATASET_12_DESC=[3600x7200] CMG 0.05 Deg 16 days #1km pix +-30deg VZ MODIS_Grid_16Day_VI_CMG (8-bit unsigned integer)"
[25] "SUBDATASET_13_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days pixel reliability"
[26] "SUBDATASET_13_DESC=[3600x7200] CMG 0.05 Deg 16 days pixel reliability MODIS_Grid_16Day_VI_CMG (8-bit integer)"
> str(inf)
Class 'GDALobj' atomic [1:9] 512 512 0 0 0 1 1 0 0
..- attr(*, "ysign")= num -1
..- attr(*, "driver")= chr "HDF4"
..- attr(*, "projection")= chr NA
..- attr(*, "file")= chr "MOD13C1.A2000049.005.2006271195746.hdf"
..- attr(*, "mdata")= chr [1:173] "HDFEOSVersion=HDFEOS_V2.9" "LOCALGRANULEID=MOD13C1.A2000049.005.2006271195746.hdf" "PRODUCTIONDATETIME=2006-09-28T19:57:46.000Z" "DAYNIGHTFLAG=Both" ...
..- attr(*, "subdsmdata")= chr [1:26] "SUBDATASET_1_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days NDV"| __truncated__ "SUBDATASET_1_DESC=[3600x7200] CMG 0.05 Deg 16 days NDVI MODIS_Grid_16Day_VI_CMG (16-bit integer)" "SUBDATASET_2_NAME=HDF4_EOS:EOS_GRID:\"MOD13C1.A2000049.005.2006271195746.hdf\":MODIS_Grid_16Day_VI_CMG:CMG 0.05 Deg 16 days EVI"| __truncated__ "SUBDATASET_2_DESC=[3600x7200] CMG 0.05 Deg 16 days EVI MODIS_Grid_16Day_VI_CMG (16-bit integer)" ...
>
Best,
Jan
Dr. ir. Jan Verbesselt
Centre for Geo-information
Wageningen University, The Netherlands
T: + 31 317 48 52 68
http://bfast.r-forge.r-project.org/
http://www.mendeley.com/profiles/jan-verbesselt/
http://eeecon.uibk.ac.at/wopec2/repec/inn/wpaper/2011-18.pdf (in review)
On 09/02/2012, at 8:31 PM, Jonathan Greenberg wrote:
> R-sig-geo'ers:
>
> I'm trying to figure out how to "capture" metadata from the GDALinfo call
> on an HDF file -- running GDALinfo("some.hdf") displays all the metadata,
> but I can seem to figure out how to extract this data. All I can see as
> extractable variables are:
>
> [1] "rows" "columns" "bands" "ll.x" "ll.y" "res.x"
> [7] "res.y" "oblique.x" "oblique.y"
>
> --j
>
> --
> Jonathan A. Greenberg, PhD
> Assistant Professor
> Department of Geography
> University of Illinois at Urbana-Champaign
> 607 South Mathews Avenue, MC 150
> Urbana, IL 61801
> Phone: 415-763-5476
> AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007
> http://www.geog.illinois.edu/people/JonathanGreenberg.html
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list