0

I have some HDF5 files with the following structure: (I've removed all the metadata output)

> gdalinfo MOD09GA.A2020278.h29v05.006.2020280062342.hdf 
Driver: HDF4/Hierarchical Data Format Release 4
Files: MOD09GA.A2020278.h29v05.006.2020280062342.hdf
Size is 512, 512
Coordinate System is `'
Metadata:
  ...
Subdatasets:
  SUBDATASET_1_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_1km_2D:num_observations_1km
  SUBDATASET_1_DESC=[1200x1200] num_observations_1km MODIS_Grid_1km_2D (8-bit integer)
  SUBDATASET_2_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_1km_2D:state_1km_1
  SUBDATASET_2_DESC=[1200x1200] state_1km_1 MODIS_Grid_1km_2D (16-bit unsigned integer)
  SUBDATASET_3_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_1km_2D:SensorZenith_1
  SUBDATASET_3_DESC=[1200x1200] SensorZenith_1 MODIS_Grid_1km_2D (16-bit integer)
  SUBDATASET_4_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_1km_2D:SensorAzimuth_1
  SUBDATASET_4_DESC=[1200x1200] SensorAzimuth_1 MODIS_Grid_1km_2D (16-bit integer)
  SUBDATASET_5_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_1km_2D:Range_1
  SUBDATASET_5_DESC=[1200x1200] Range_1 MODIS_Grid_1km_2D (16-bit unsigned integer)
  SUBDATASET_6_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_1km_2D:SolarZenith_1
  SUBDATASET_6_DESC=[1200x1200] SolarZenith_1 MODIS_Grid_1km_2D (16-bit integer)
  SUBDATASET_7_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_1km_2D:SolarAzimuth_1
  SUBDATASET_7_DESC=[1200x1200] SolarAzimuth_1 MODIS_Grid_1km_2D (16-bit integer)
  SUBDATASET_8_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_1km_2D:gflags_1
  SUBDATASET_8_DESC=[1200x1200] gflags_1 MODIS_Grid_1km_2D (8-bit unsigned integer)
  SUBDATASET_9_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_1km_2D:orbit_pnt_1
  SUBDATASET_9_DESC=[1200x1200] orbit_pnt_1 MODIS_Grid_1km_2D (8-bit integer)
  SUBDATASET_10_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_1km_2D:granule_pnt_1
  SUBDATASET_10_DESC=[1200x1200] granule_pnt_1 MODIS_Grid_1km_2D (8-bit unsigned integer)
  SUBDATASET_11_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:num_observations_500m
  SUBDATASET_11_DESC=[2400x2400] num_observations_500m MODIS_Grid_500m_2D (8-bit integer)
  SUBDATASET_12_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:sur_refl_b01_1
  SUBDATASET_12_DESC=[2400x2400] sur_refl_b01_1 MODIS_Grid_500m_2D (16-bit integer)
  SUBDATASET_13_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:sur_refl_b02_1
  SUBDATASET_13_DESC=[2400x2400] sur_refl_b02_1 MODIS_Grid_500m_2D (16-bit integer)
  SUBDATASET_14_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:sur_refl_b03_1
  SUBDATASET_14_DESC=[2400x2400] sur_refl_b03_1 MODIS_Grid_500m_2D (16-bit integer)
  SUBDATASET_15_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:sur_refl_b04_1
  SUBDATASET_15_DESC=[2400x2400] sur_refl_b04_1 MODIS_Grid_500m_2D (16-bit integer)
  SUBDATASET_16_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:sur_refl_b05_1
  SUBDATASET_16_DESC=[2400x2400] sur_refl_b05_1 MODIS_Grid_500m_2D (16-bit integer)
  SUBDATASET_17_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:sur_refl_b06_1
  SUBDATASET_17_DESC=[2400x2400] sur_refl_b06_1 MODIS_Grid_500m_2D (16-bit integer)
  SUBDATASET_18_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:sur_refl_b07_1
  SUBDATASET_18_DESC=[2400x2400] sur_refl_b07_1 MODIS_Grid_500m_2D (16-bit integer)
  SUBDATASET_19_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:QC_500m_1
  SUBDATASET_19_DESC=[2400x2400] QC_500m_1 MODIS_Grid_500m_2D (32-bit unsigned integer)
  SUBDATASET_20_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:obscov_500m_1
  SUBDATASET_20_DESC=[2400x2400] obscov_500m_1 MODIS_Grid_500m_2D (8-bit integer)
  SUBDATASET_21_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:iobs_res_1
  SUBDATASET_21_DESC=[2400x2400] iobs_res_1 MODIS_Grid_500m_2D (8-bit unsigned integer)
  SUBDATASET_22_NAME=HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:q_scan_1
  SUBDATASET_22_DESC=[2400x2400] q_scan_1 MODIS_Grid_500m_2D (8-bit unsigned integer)
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  512.0,    0.0)
Lower Right (  512.0,  512.0)
Center      (  256.0,  256.0)

Is it possible to generate a TIFF file with multiple subdatasets in or must they be extracted into separate TIFF files?

e.g. I can use the following command to extract the MODIS_Grid_500m_2D:sur_refl_b01_1 subdataset into a tiff file test.tiff:

gdal_translate -of GTiff HDF4_EOS:EOS_GRID:"MOD09GA.A2020278.h29v05.006.2020280062342.hdf":MODIS_Grid_500m_2D:sur_refl_b01_1 test.tiff

Could I use this command or some other method to extract the subdatasets MODIS_Grid_500m_2D:sur_refl_b01_1, MODIS_Grid_500m_2D:sur_refl_b02_1, ..., MODIS_Grid_500m_2D:sur_refl_b07_1 into a single tiff file?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.