我使用 Sentinel2 图像,我正在尝试重新采样它们。
我尝试了以下代码:
import os, fnmatch
INPUT_FOLDER = "/d/afavro/Bureau/test_resampling/original"
OUTPUT_FOLDER = "/d/afavro/Bureau/test_resampling/resampling_10m"
def findRasters (path, filter):
for root, dirs, files in os.walk(path):
for file in fnmatch.filter(files, filter):
yield file
for raster in findRasters(INPUT_FOLDER,'*.tif'):
print(raster)
inRaster = INPUT_FOLDER + '/' + raster
print(inRaster)
outRaster = OUTPUT_FOLDER + '/resample' + raster
print (outRaster)
cmd = "gdalwarp -tr 10 10 -r cubic " % (inRaster,outRaster)
os.system(cmd)
但我仍然收到相同的错误消息:
def findRasters (path, filter): ^
IndentationError: unexpected indent
我已经尝试过使用相同类型的代码来制作一个子集并且它有效。我不明白我的错误来自哪里。