python批处理系列代码-GRD转TIF
import sys, string, os
import arcpy
dir = “D:\\test”
files = os.listdir(dir)
for f in files:
if os.path.splitext(f)[1] == ‘.GRD’:
Input_raster_file = dir + os.sep + f
Raster_Format = “TIFF”
Output_Workspace = “D:\\out”
basename = os.path.splitext(f)[0];
Output_raster = Output_Workspace + os.sep + basename + ‘.tif’;
arcpy.RasterToOtherFormat_conversion(Input_raster_file, Output_Workspace, Raster_Format)
print Output_raster
注意点:grd文件后缀的大小写要匹配,同时代码格式也会影响结果,路径文件夹需要存在
转载自:https://blog.csdn.net/liudan19940618/article/details/82260989