# -*- coding: utf-8 -*-
"""
Created on Mon Jan 15 13:08:45 2018
@author: Baikal
"""
import arcpy, os
from os.path import join
files01_path = r"G:\MASIE\2016.06\r01/"
files08_path = r"G:\MASIE\2016.06\r08/"
files09_path = r"G:\MASIE\2016.06\r09/"
output_path = r"G:\MASIE\2016.06\Mosaic/"
list_file01 = os.listdir(files01_path)
list_file08 = os.listdir(files08_path)
list_file09 = os.listdir(files09_path)
file_count = 0
for filename in list_file01:
if filename.endswith('.tif'): file_count = file_count + 1
print '共有',file_count,'组影像待镶嵌'
for filename01 in list_file01:
if filename01.endswith('.tif'):
file01 = files01_path + filename01
SR = arcpy.Describe(file01).spatialReference
#print SR.Name
cellsizex = arcpy.GetRasterProperties_management(file01, "CELLSIZEX")
cellsize = cellsizex.getOutput(0) # assumes cells are equal in x and y size
filename08 = filename01[:12] + '8' + filename01[13:]
file08 = files08_path + filename08
filename09 = filename01[:12] + '9' + filename01[13:]
file09 = files09_path + filename09
input_file = file01 + ';' + file08 + ';' + file09
output_name = 'masie_' + filename01[18:25] + '.tif'
arcpy.CreateRasterDataset_management(output_path ,output_name ,cellsize ,"8_BIT_UNSIGNED", SR, "1")
output_file = os.path.join(output_path, output_name)
arcpy.Mosaic_management(input_file, output_file, "MINIMUM", "FIRST", "6.0", "6.0")
"""
Created on Mon Jan 15 13:08:45 2018
@author: Baikal
"""
import arcpy, os
from os.path import join
files01_path = r"G:\MASIE\2016.06\r01/"
files08_path = r"G:\MASIE\2016.06\r08/"
files09_path = r"G:\MASIE\2016.06\r09/"
output_path = r"G:\MASIE\2016.06\Mosaic/"
list_file01 = os.listdir(files01_path)
list_file08 = os.listdir(files08_path)
list_file09 = os.listdir(files09_path)
file_count = 0
for filename in list_file01:
if filename.endswith('.tif'): file_count = file_count + 1
print '共有',file_count,'组影像待镶嵌'
for filename01 in list_file01:
if filename01.endswith('.tif'):
file01 = files01_path + filename01
SR = arcpy.Describe(file01).spatialReference
#print SR.Name
cellsizex = arcpy.GetRasterProperties_management(file01, "CELLSIZEX")
cellsize = cellsizex.getOutput(0) # assumes cells are equal in x and y size
filename08 = filename01[:12] + '8' + filename01[13:]
file08 = files08_path + filename08
filename09 = filename01[:12] + '9' + filename01[13:]
file09 = files09_path + filename09
input_file = file01 + ';' + file08 + ';' + file09
output_name = 'masie_' + filename01[18:25] + '.tif'
arcpy.CreateRasterDataset_management(output_path ,output_name ,cellsize ,"8_BIT_UNSIGNED", SR, "1")
output_file = os.path.join(output_path, output_name)
arcpy.Mosaic_management(input_file, output_file, "MINIMUM", "FIRST", "6.0", "6.0")
没有评论:
发表评论