[Gdal-dev] accessing MODIS L1B geolocation data with gdal

Huw Lynch huw_lynch at yahoo.com
Tue Dec 19 19:24:17 EST 2006


Sorry if this question has been asked before; I've searched but can't find a full explaination.

I am trying to access geolocation information in MODIS L1B data files. I was hoping that the Latitude and Longitude data sets would be visible via gdalinfo however when I run this those 2 datasets appear to be skipped over.

Here's a gdalinfo output from an example modis data file;

$ gdalinfo MOD03.Terra20061216T021152Z20061216T021611Z.hdf 
Driver: HDF4/Hierarchical Data Format Release 4
Size is 512, 512
Coordinate System is `'
Metadata:
--cut--
  ASSOCIATEDSENSORSHORTNAME=MODIS
  ASSOCIATEDPLATFORMSHORTNAME=Terra
  ASSOCIATEDINSTRUMENTSHORTNAME=MODIS
--cut--
  PROCESSVERSION=5.0.2
--cut--
Subdatasets:
  SUBDATASET_1_NAME=HDF4_EOS:EOS_SWATH:"MOD03.Terra20061216T021152Z20061216T021611Z.hdf":MODIS_Swath_Type_GEO:Height
  SUBDATASET_1_DESC=[1620x1354] Height (16-bit integer)
  SUBDATASET_2_NAME=HDF4_EOS:EOS_SWATH:"MOD03.Terra20061216T021152Z20061216T021611Z.hdf":MODIS_Swath_Type_GEO:SensorZenith
  SUBDATASET_2_DESC=[1620x1354] SensorZenith (16-bit integer)
  SUBDATASET_3_NAME=HDF4_EOS:EOS_SWATH:"MOD03.Terra20061216T021152Z20061216T021611Z.hdf":MODIS_Swath_Type_GEO:SensorAzimuth
  SUBDATASET_3_DESC=[1620x1354] SensorAzimuth (16-bit integer)
  SUBDATASET_4_NAME=HDF4_EOS:EOS_SWATH:"MOD03.Terra20061216T021152Z20061216T021611Z.hdf":MODIS_Swath_Type_GEO:Range
  SUBDATASET_4_DESC=[1620x1354] Range (16-bit unsigned integer)
  SUBDATASET_5_NAME=HDF4_EOS:EOS_SWATH:"MOD03.Terra20061216T021152Z20061216T021611Z.hdf":MODIS_Swath_Type_GEO:SolarZenith
  SUBDATASET_5_DESC=[1620x1354] SolarZenith (16-bit integer)
  SUBDATASET_6_NAME=HDF4_EOS:EOS_SWATH:"MOD03.Terra20061216T021152Z20061216T021611Z.hdf":MODIS_Swath_Type_GEO:SolarAzimuth
  SUBDATASET_6_DESC=[1620x1354] SolarAzimuth (16-bit integer)
  SUBDATASET_7_NAME=HDF4_EOS:EOS_SWATH:"MOD03.Terra20061216T021152Z20061216T021611Z.hdf":MODIS_Swath_Type_GEO:Land/SeaMask
  SUBDATASET_7_DESC=[1620x1354] Land/SeaMask (8-bit unsigned integer)
  SUBDATASET_8_NAME=HDF4_EOS:EOS_SWATH:"MOD03.Terra20061216T021152Z20061216T021611Z.hdf":MODIS_Swath_Type_GEO:gflags
  SUBDATASET_8_DESC=[1620x1354] gflags (8-bit unsigned integer)

I'm certain that the Latitude and Longitude data is there, because I can see it with hdp;

$ hdp dumpsds -h MOD03.Terra20061216T021152Z20061216T021611Z.hdf
--cut--
Variable Name = Latitude
         Index = 0
         Type= 32-bit floating point
         Ref. = 20
         Rank = 2
         Number of attributes = 3
         Dim0: Name=nscans*10:MODIS_Swath_Type_GEO
                 Size = 1620
                 Scale Type = number-type not set
                 Number of attributes = 0
         Dim1: Name=mframes:MODIS_Swath_Type_GEO
                 Size = 1354
                 Scale Type = number-type not set
                 Number of attributes = 0
         Attr0: Name = units
                 Type = 8-bit signed char 
                 Count= 7
                 Value = degrees

Is there a way to access the Latitude and Longitude data with gdal or do I have to drop down to using the HDF4 library directly?

The frmt_hdf4.html file shipped with gdal includes an example as such;
$ gdalinfo GSUB1.A2001124.0855.003.200219309451.hdf
Driver: HDF4/Hierarchical Data Format Release 4
Size is 512, 512
Coordinate System is `'
Metadata:
  HDFEOSVersion=HDFEOS_V2.7
  Number of Scans=204
  Number of Day mode scans=204
  Number of Night mode scans=0
  Incomplete Scans=0

...a lot of metadata output skipped...

Subdatasets:
  SUBDATASET_1_NAME=HDF4_SDS:MODIS_L1B:GSUB1.A2001124.0855.003.200219309451.hdf:0
  SUBDATASET_1_DESC=[408x271] Latitude (32-bit floating-point)
  SUBDATASET_2_NAME=HDF4_SDS:MODIS_L1B:GSUB1.A2001124.0855.003.200219309451.hdf:1
  SUBDATASET_2_DESC=[408x271] Longitude (32-bit floating-point)
  SUBDATASET_3_NAME=HDF4_SDS:MODIS_L1B:GSUB1.A2001124.0855.003.200219309451.hdf:2
  SUBDATASET_3_DESC=[12x2040x1354] EV_1KM_RefSB (16-bit unsigned integer)
Even if it's not possible to get at the lat/lon data with gdal, I'm interested in understanding why it doesn't work.

Cheers & thanks

Huw Lynch


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20061219/5b801332/attachment.html


More information about the Gdal-dev mailing list