AnsweredAssumed Answered

spatial analysis tool: Combine with list in python

Question asked by d.mazo on Oct 10, 2017
Latest reply on Oct 10, 2017 by xander_bakker

hi all, 

I need to combine several rasters but they have to fulfill a determinate condition (year), at the moment I´ve been able to extract the info that I need in to a list,  but when I try to run the tool: Combine it seems it doesn't accept the list as a parameter, this is the code that I´m using:

 

import arcpy
from arcpy.sa import *

arcpy.env.workspace = "D:\Baseline_2\Eliana\Biomass.gdb"
rasters = arcpy.ListRasters()

 

year="_0"

for rc in rasters:
if rc.endswith(year):
   listtemp.append(arcpy.ListRasters(rc))

   Year_0 = arcpy.sa.Combine([listtemp]); year_0.save(r"D:\Baseline_2\Eliana\Eliana.gdb\Year_0")
print("end script")
print(listtemp)

 

if you could help me that will be wonderfull 

thanks!!

Outcomes