[GRASS-user] import 3-dimension band from Hdf file (MODIS)

Markus Metz markus.metz.giswork at gmail.com
Wed Jun 19 12:56:14 PDT 2019


Hi Lara,

On Wed, Jun 19, 2019 at 7:06 PM Lara DC <dellaceca.lara at gmail.com> wrote:
>
> Hello!
>
> I am just starting to use GRASS.
> I am trying to import a new Modis product about atmospheric aerosols.
> I need to import hdf files, which have 13 bands (I am interested in band
1).

this hdf has 13 subdatasets, not 13 bands:
gdalinfo  MCD19A2.A2018302.h19v05.006.2018311184807.hdf
...
Subdatasets:

SUBDATASET_1_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid1km:Optical_Depth_047
  SUBDATASET_1_DESC=[4x1200x1200] Optical_Depth_047 grid1km (16-bit integer)

SUBDATASET_2_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid1km:Optical_Depth_055
  SUBDATASET_2_DESC=[4x1200x1200] Optical_Depth_055 grid1km (16-bit integer)

SUBDATASET_3_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid1km:AOD_Uncertainty
  SUBDATASET_3_DESC=[4x1200x1200] AOD_Uncertainty grid1km (16-bit integer)

SUBDATASET_4_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid1km:FineModeFraction
  SUBDATASET_4_DESC=[4x1200x1200] FineModeFraction grid1km (16-bit integer)

SUBDATASET_5_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid1km:Column_WV
  SUBDATASET_5_DESC=[4x1200x1200] Column_WV grid1km (16-bit integer)

SUBDATASET_6_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid1km:AOD_QA
  SUBDATASET_6_DESC=[4x1200x1200] AOD_QA grid1km (16-bit unsigned integer)

SUBDATASET_7_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid1km:AOD_MODEL
  SUBDATASET_7_DESC=[4x1200x1200] AOD_MODEL grid1km (8-bit unsigned integer)

SUBDATASET_8_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid1km:Injection_Height
  SUBDATASET_8_DESC=[4x1200x1200] Injection_Height grid1km (32-bit
floating-point)

SUBDATASET_9_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid5km:cosSZA
  SUBDATASET_9_DESC=[4x240x240] cosSZA grid5km (16-bit integer)

SUBDATASET_10_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid5km:cosVZA
  SUBDATASET_10_DESC=[4x240x240] cosVZA grid5km (16-bit integer)

SUBDATASET_11_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid5km:RelAZ
  SUBDATASET_11_DESC=[4x240x240] RelAZ grid5km (16-bit integer)

SUBDATASET_12_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid5km:Scattering_Angle
  SUBDATASET_12_DESC=[4x240x240] Scattering_Angle grid5km (16-bit integer)

SUBDATASET_13_NAME=HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid5km:Glint_Angle
  SUBDATASET_13_DESC=[4x240x240] Glint_Angle grid5km (16-bit integer)

> My problem is that each band has 3 dimensions (x-y-z : 1200x1200x4)
> The z dimension corresponds to the orbit (Aqua or Terra, 2 daily overpass
each). I would like to work with them separately.

each subdataset has 4 bands (Aqua or Terra, 2 daily overpass each), e.g.
for the first subdataset
gdalinfo
HDF4_EOS:EOS_GRID:"MCD19A2.A2018302.h19v05.006.2018311184807.hdf":grid1km:Optical_Depth_047
...
Band 1 Block=1200x833 Type=Int16, ColorInterp=Gray
  Description = AOD at 0.47 micron
  NoData Value=-28672
  Offset: 0,   Scale:0.001
Band 2 Block=1200x833 Type=Int16, ColorInterp=Gray
  Description = AOD at 0.47 micron
  NoData Value=-28672
  Offset: 0,   Scale:0.001
Band 3 Block=1200x833 Type=Int16, ColorInterp=Gray
  Description = AOD at 0.47 micron
  NoData Value=-28672
  Offset: 0,   Scale:0.001
Band 4 Block=1200x833 Type=Int16, ColorInterp=Gray
  Description = AOD at 0.47 micron
  NoData Value=-28672
  Offset: 0,   Scale:0.001

> When I try to open the file using r.in.gdal I get an error 'The band does
not exist' (I guess the problem is the 3rd dimension...)

for r.in.gdal, you need to use the subdataset as input

HTH,

Markus M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20190619/50d06a78/attachment.html>


More information about the grass-user mailing list