4

我有一个 10° x 10° 未地理参考的 HDF5,我想将其转换为 geotiff。我尝试了 2 种方法(1)gdalwarp(2)gdal_translate,但无法找到如何转换文件。

1)gdalwarp

gdalwarp -t_srs '+proj=longlat +datum=WGS84 +no_defs ' -te 40 30 50 40 -tr 0.0089285714 -0.0089285714 -multi HDF5:"/PathToTheHDF/FileName.HDF5"://SUBDATASET /PathToOutput/FileName_Subdataset.tif

我有以下错误:

ERROR 1: Unable to compute a transformation between pixel/line
and georeferenced coordinates for ...
There is no affine transformation and no GCPs.
256

2) gdal_translate

gdal_translate -of GTiff -a_srs '+proj=longlat +datum=WGS84 +no_defs ' -a_ullr 40 40 50 30 HDF5:"/PathToTheHDF/FileName.HDF5"://SUBDATASET /PathToOutput/FileName_Subdataset.tif

我有以下错误:

Input file size is 1120, 1120
0HDF5-DIAG: Error detected in HDF5 (1.8.11) thread 140288255100800:
  #000: ../../../src/H5Dio.c line 182 in H5Dread(): can't read data
    major: Dataset
    minor: Read failed
  #001: ../../../src/H5Dio.c line 550 in H5D__read(): can't read data
    major: Dataset
    minor: Read failed
  #002: ../../../src/H5Dchunk.c line 1837 in H5D__chunk_read(): unable to read raw data chunk
    major: Low-level I/O
    minor: Read failed
  #003: ../../../src/H5Dchunk.c line 2868 in H5D__chunk_lock(): data pipeline read failed
    major: Data filters
    minor: Filter operation failed
  #004: ../../../src/H5Z.c line 1150 in H5Z_pipeline(): required filter 'szip' is not registered
    major: Data filters
    minor: Read failed
  #005: ../../../src/H5PL.c line 293 in H5PL_load(): search in paths failed
    major: Plugin for dynamically loaded library
    minor: Can't get value
  #006: ../../../src/H5PL.c line 397 in H5PL__find(): can't open directory
    major: Plugin for dynamically loaded library
    minor: Can't open directory or file
ERROR 1: H5Dread() failed for block.
ERROR 1: HDF5:/export/GIO/gww-probav-test/modis/2014/01/21/MC10GWW_X22Y09_20140121_1KM.HDF5://HUE, band 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0

知道什么是错的或者我应该如何转换这些数据?

4

3 回答 3

10
gdal_translate your_HDF_file -sds output.tif

-sds 选项会将您的多波段 HDF5 文件拆分为多个单波段 tif 文件。

于 2015-09-16T12:37:39.110 回答
3

使用 R 和 gdal_translate:

library(gdalUtils)

band <- 1

file_path <- "/myfolder/myfile.hdf"

system(paste0('gdal_translate ', get_subdatasets(file_path)[band],' myfile_', band','.tif'))
于 2015-08-25T14:04:19.817 回答
0

尝试这个:

gdalwarp your_HDF_file_sds C:\Save\your\file\sample.tif
于 2014-07-24T07:46:45.563 回答