感谢杰米的答案。
#!/usr/bin/env pythonfrom osgeo import gdal, gdalconst# Sourcesrc_filename = 'MENHMAgome01_8301/mllw.gtx'src = gdal.Open(src_filename, gdalconst.GA_ReadOnly)src_proj = src.GetProjection()src_geotrans = src.GetGeoTransform()# We want a section of source that matches this:match_filename = 'F00574_MB_2m_MLLW_2of3.bag'match_ds = gdal.Open(match_filename, gdalconst.GA_ReadOnly)match_proj = match_ds.GetProjection()match_geotrans = match_ds.GetGeoTransform()wide = match_ds.RasterXSizehigh = match_ds.RasterYSize# Output / destinationdst_filename = 'F00574_MB_2m_MLLW_2of3_mllw_offset.tif'dst = gdal.GetDriverByName('GTiff').Create(dst_filename, wide, high, 1, gdalconst.GDT_Float32)dst.SetGeoTransform( match_geotrans )dst.SetProjection( match_proj)# Do the workgdal.ReprojectImage(src, dst, src_proj, match_proj, gdalconst.GRA_Bilinear)del dst # Flush


