代码
from osgeo import gdal
def resample_img(input_path, output_path, multiple = 10):
"""Resamples a raster dataset to 100 meters using GDAL.
Args:
input_path: Path to the input raster dataset.
output_path: Path to the output raster dataset.
"""
input_ds = gdal.Open(input_path)
output_format = "GTiff"
resampling_method = gdal.GRA_Bilinear
geo = input_ds.GetGeoTransform()
output_resolution =[geo[1] * multiple,geo[-1] * multiple]
gdal.Warp(output_path, input_ds, dstSRS = input_ds.GetProjection(),format=output_format, xRes=output_resolution[0], yRes=output_resolution[1],
resampleAlg=resampling_method)
input_ds = None
if __name__ == '__main__':
input_path = r'D:\temp\out\Dom.tif'
output_path = r'D:\temp\out\10times.tif'
resample_img(input_path, output_path)