1.

# Import system modules

2.

import

sys, string, os

3.

4.

dir =

'F:\\test'

5.

6.

# Import arcpy module

7.

import

arcpy

8.

9.

files = os.listdir(dir)

10.

for

f

in

files:

11.

if

os.path.splitext(f)[1] ==

'.grd'

:

12.

# Script arguments...

13.

Input_raster_file = dir + os.sep + f

14.

15.

# Local variables...

16.

Output_data_type =

"FLOAT"

17.

Raster_Format =

"TIFF"

18.

Output_Workspace =

"f:\\test\\TIFF"

19.

20.

# =============== file name process ======================

21.

basename = os.path.splitext(f)[0];

22.

Output_raster = Output_Workspace + os.sep + basename +

".tif"

;

23.

24.

if

os.path.exists(Output_raster) == False:

25.

print

Input_raster_file

26.

# Process: Raster To Other Format (multiple)...

27.

arcpy.RasterToOtherFormat_conversion(Input_raster_file,

28.

Output_Workspace, Raster_Format)

29.

30.

print

Output_raster

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐