Database Reference
In-Depth Information
Eachsubdatasetisonevariableofthe
MODIS
raster.Forourpurposes,weonlyneed
the first four subdatasets, as follows:
• subdataset 1: 620 - 670 nm (red)
• subdataset 2: 841 - 876 nm (near infrared or NIR)
• subdataset 3: 459 - 479 nm (blue)
• subdataset 4: 545 - 565 nm (green)
Full metadata can be found at the MODIS site for this MODIS product:
TheVRTformatallowsustoselectthesubdatasetstobeincludedintheVRTraster
aswellaschangetheorderofthesubdatasets.Wewanttorearrangethesubdata-
sets so that they are in the RGB order.
Let'scall
gdalbuildvrt
tocreateaVRTfileforourMODISraster.Donotrunthe
following!
> gdalbuildvrt -separate modis.vrt
HDF4_EOS:EOS_GRID:"MYD09A1.A2012161.h08v05.005.2012170065756.hdf":MOD_Grid_500m_Surface_Reflectance:sur_refl_b01
HDF4_EOS:EOS_GRID:"MYD09A1.A2012161.h08v05.005.2012170065756.hdf":MOD_Grid_500m_Surface_Reflectance:sur_refl_b04
HDF4_EOS:EOS_GRID:"MYD09A1.A2012161.h08v05.005.2012170065756.hdf":MOD_Grid_500m_Surface_Reflectance:sur_refl_b03
HDF4_EOS:EOS_GRID:"MYD09A1.A2012161.h08v05.005.2012170065756.hdf":MOD_Grid_500m_Surface_Reflectance:sur_refl_b02
Wereallyhopeyoudidnotruntheprecedingcode.Thecommanddoesworkbutis
toolongandcumbersome.Itwouldbebetterifwecanpassafileindicatingthesub-
datasetstoincludeandtheirorderintheVRT.Thankfully,
gdalbuildvrt
provides
such an option with the
-input_file_list
flag.
IntheMODISdirectory,the
modis.txt
filecanbepassedto
gdalbuildvrt
with
the
-input_file_list
flag.Eachlineofthe
modis.txt
fileisthenameofasub-
dataset.Theorderofthesubdatasetsinthetextfiledictatestheplacementofeach
subdataset in the VRT.
HDF4_EOS:EOS_GRID:"MYD09A1.A2012161.h08v05.005.2012170065756.hdf":MOD_Grid_500m_Surface_Reflectance:sur_refl_b01
HDF4_EOS:EOS_GRID:"MYD09A1.A2012161.h08v05.005.2012170065756.hdf":MOD_Grid_500m_Surface_Reflectance:sur_refl_b04