一直一直一直开心 2023-04-27 18:23 采纳率: 80%
浏览 28
已结题

关于#python#的问题:因为栅格计算器原因只能计算出九年数据,如何把1991-1999、2000-2008这两个栅格数据进行合并

栅格计算器计算土地利用转移

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)

结果如下

img

这是属性表

img

因为栅格计算器原因只能计算出九年数据,但是我需要1991-2008年的数据,如何把1991-1999、2000-2008这两个栅格数据进行合并。

  • 写回答

1条回答 默认 最新

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 5月4日
  • 已采纳回答 5月4日
  • 修改了问题 5月2日
  • 创建了问题 4月27日