# Projection Convertion &&& Resample images to a higher resolution
# Time: Oct.16,2017
# encoding = UTF-8
import arcpy
from arcpy import env
import os
import datetime
# Change to Target Path
arcpy.env.workspace = r"G:\2016.06.MOD\MODIS_JPG\Unzip/"
out_path = arcpy.env.workspace + '/Resample_500m_ProjectionC/'
os.mkdir(out_path)
list_file = os.listdir(arcpy.env.workspace)
# 统计文件夹下的.tif格式的文件数目
file_count = 0
for filename in list_file:
if filename.endswith('.jpg'): file_count = file_count+1
print '共有',file_count,'景.tif影像待处理'
count = 0
start_time = datetime.datetime.now()
# 查找文件夹下的.tif格式的文件
for filename in list_file:
if filename.endswith('.jpg'):
start_single_time = datetime.datetime.now()
os.chdir(arcpy.env.workspace)
file_name = filename[:-4]
os.chdir(out_path)
file_Covname = out_path + file_name + '_Resample_ProjectionC.tif'
# 3573为 'WGS_1984_North_Pole_LAEA_Canada'投影方式的EPSG代号
arcpy.ProjectRaster_management(filename, file_Covname, "3573",\
"BILINEAR", "500")
end_single_time = datetime.datetime.now()
time = (end_single_time - start_single_time).seconds
print '第',count+1,'景影像重采样完毕,耗时',time,'s'
count = count + 1
if count == file_count : print '\n全部影像重采样完毕'
end_time = datetime.datetime.now()
time = (end_time - start_time).seconds
m = int(time)/60
s = int(time)%60
print '处理总耗时',m,'m',s,'s'
# Time: Oct.16,2017
# encoding = UTF-8
import arcpy
from arcpy import env
import os
import datetime
# Change to Target Path
arcpy.env.workspace = r"G:\2016.06.MOD\MODIS_JPG\Unzip/"
out_path = arcpy.env.workspace + '/Resample_500m_ProjectionC/'
os.mkdir(out_path)
list_file = os.listdir(arcpy.env.workspace)
# 统计文件夹下的.tif格式的文件数目
file_count = 0
for filename in list_file:
if filename.endswith('.jpg'): file_count = file_count+1
print '共有',file_count,'景.tif影像待处理'
count = 0
start_time = datetime.datetime.now()
# 查找文件夹下的.tif格式的文件
for filename in list_file:
if filename.endswith('.jpg'):
start_single_time = datetime.datetime.now()
os.chdir(arcpy.env.workspace)
file_name = filename[:-4]
os.chdir(out_path)
file_Covname = out_path + file_name + '_Resample_ProjectionC.tif'
# 3573为 'WGS_1984_North_Pole_LAEA_Canada'投影方式的EPSG代号
arcpy.ProjectRaster_management(filename, file_Covname, "3573",\
"BILINEAR", "500")
end_single_time = datetime.datetime.now()
time = (end_single_time - start_single_time).seconds
print '第',count+1,'景影像重采样完毕,耗时',time,'s'
count = count + 1
if count == file_count : print '\n全部影像重采样完毕'
end_time = datetime.datetime.now()
time = (end_time - start_time).seconds
m = int(time)/60
s = int(time)%60
print '处理总耗时',m,'m',s,'s'
没有评论:
发表评论