gpt4 book ai didi

hdf5 - 如何使用 gdal_translate 或 gdalwarp 将 HDF5 转换为 geotiff?

转载 作者:行者123 更新时间:2023-12-04 22:46:34 24 4
gpt4 key购买 nike

我有一个 10° x 10° 未地理引用的 HDF5,我想将其转换为 geotiff。
我尝试了两种方法 (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

知道出了什么问题或我应该如何转换这些数据吗?

最佳答案

使用 R 和 gdal_translate:

library(gdalUtils)

band <- 1

file_path <- "/myfolder/myfile.hdf"

system(paste0('gdal_translate ', get_subdatasets(file_path)[band],' myfile_', band','.tif'))

关于hdf5 - 如何使用 gdal_translate 或 gdalwarp 将 HDF5 转换为 geotiff?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22933598/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com