栅格计算器计算土地利用转移
import arcpy
arcpy.CheckOutExtension('Spatial')
from arcpy.sa import *
from arcpy import env
import math
arcpy.env.workspace = r"F:/study/text"
output_folder = r"F:/study/text/output"
expression_dict = { "1991-1999": "10**8 * \"CLCD_v01_1991_albert_henan.tif\" + 10**7 * \"CLCD_v01_1992_albert_henan.tif\" + 10**6 * \"CLCD_v01_1993_albert_henan.tif\" +\
10**5*\"CLCD_v01_1994_albert_henan.tif\" +10**4* \"CLCD_v01_1995_albert_henan.tif\"+10**3*\"CLCD_v01_1996_albert_henan.tif\"+10**2*\"CLCD_v01_1997_albert_henan.tif\"+\
10*\"CLCD_v01_1998_albert_henan.tif\"+\"CLCD_v01_1999_albert_henan.tif\"",
"2000-2008": "10**8 * \"CLCD_v01_2000_albert_henan.tif\" + 10**7 * \"CLCD_v01_2001_albert_henan.tif\" + 10**6 * \"CLCD_v01_2002_albert_henan.tif\" + 10**5*\"CLCD_v01_2003_albert_henan.tif\"\
+10**4* \"CLCD_v01_2004_albert_henan.tif\"+10**3*\"CLCD_v01_2005_albert_henan.tif\"+10**2*\"CLCD_v01_2006_albert_henan.tif\"+10*\"CLCD_v01_2007_albert_henan.tif\"+\
\"CLCD_v01_2008_albert_henan.tif\"",}
for key, expression in expression_dict.items():
output_name = key + ".tif"
output_path = output_folder + "/" + output_name
result = arcpy.gp.RasterCalculator(expression, output_path)
结果如下
这是属性表
因为栅格计算器原因只能计算出九年数据,但是我需要1991-2008年的数据,如何把1991-1999、2000-2008这两个栅格数据进行合并。