Opened 10 years ago

Closed 5 years ago

#5446 closed defect (wontfix)

[PATCH] gdal_merge.py fail with HDF MODIS files (HDF4Image)

Reported by: lucadelu Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: Utilities Version: 1.11.0
Severity: normal Keywords:
Cc:

Description

I run gdal_merge.py with the following command:

gdal_merge.py -o test.hdf -of HDF4Image -separate MOD11A1.A2012340.h28v04.005.2012342062356.hdf MOD11A1.A2012340.h28v05.005.2012342062414.hdf

it return this error

Traceback (most recent call last):
  File "/usr/local/bin/gdal_merge.py", line 510, in <module>
    sys.exit(main())
  File "/usr/local/bin/gdal_merge.py", line 390, in main
    file_infos = names_to_fileinfos( names )
  File "/usr/local/bin/gdal_merge.py", line 122, in names_to_fileinfos
    if fi.init_from_name( name ) == 1:
  File "/usr/local/bin/gdal_merge.py", line 147, in init_from_name
    self.band_type = fh.GetRasterBand(1).DataType
AttributeError: 'NoneType' object has no attribute 'DataType'

It should use in the process in the subdataset; I implemented something (maybe a workaround :-) ) for pyModis library, maybe it could be useful [0].

The two functions useful could be _initLayers and _getUsedLayers, where I divided the subsets for each type in dictionary containing a list for each subset.

[0] https://github.com/lucadelu/pyModis/blob/master/pymodis/convertmodis_gdal.py#L408

Change History (3)

comment:1 by Jukka Rahkonen, 9 years ago

Summary: gdal_merge.py fail with HDF MODIS files[PATCH] gdal_merge.py fail with HDF MODIS files (HDF4Image)

comment:2 by Even Rouault, 9 years ago

Milestone: 1.11.1

comment:3 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.