AnsweredAssumed Answered

Calculate list of raster from two different subfolder using ArcPy

Question asked by india123 on Aug 17, 2016
Latest reply on Aug 29, 2016 by xander_bakker

I have two different folder (workspace1 and workspace2) with Rasters data with the two different parameters. Whatever raster in workspace1 (input raster name e.g 001_mean, 002_mean, 003_mean, 004_mean ….012_mean ), I would like to execute below equation

((Raster – Min Rater value) * (0.95 – 0.01)) / (Max raster value – Min Raster Value )

and save it into outputfolder 1 name of output (e.g. 001_FPAR, 002_FPAR, 003_FPAR, 004_FPAR ….012_FPAR)

After calculating workspace1, I want to take different raster file from workspace 2 (raster name , 001_SR, 002_SR, 003_SR, 004_SR……012_SR) and multiply it with each raster file with calculated raster from workspace 1 and save it into outputfolder 2 as name of 001_APAR, 002_APAR, 003_APAR, 004_APAR ……012_APAR.

I have attached below the list of input raster. 

I have written the code below but its giving error

import arcpy 
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *

workspace1 = glob.glob(r"D:\MODIS-NDVI-2012\MASKED-NDVI-2012A")
workspace2 = glob.glob(r"D:\MODIS-NDVI-2012\MASKED")
outFolder1 = r"D:\MODIS-NDVI-2012\FPAR"
outFolder2 = r"D:\MODIS-NDVI-2012\APAR"
list = arcpy.ListRasters()
for inRaster in list:
localRaster = Raster(inRaster)
for r in workspace1
NDVIMINResult = arcpy.GetRasterProperties_management(inRaster1, "MINIMUM")
NDVIMAXResult = arcpy.GetRasterProperties_management(inRaster1, "MAXIMUM")

NDVIMin = float(NDVIMINResult.getOutput(0))
NDVIMax = float(NDVIMAXResult.getOutput(0))
outminus = Minus(inRaster1, NDVIMin)
outminus1 = Minus(0.95-0.01)
outmultiply = Multiply(outminus,outminus1)
outminus2 = Minus(NDVIMax, NDVIMin)
outdevide = Devide(outmultiply,outminus2)
outdevide.save = (outdevide)
for r in workspace2
outmultiply1 = Multiply (outdevide,Raster)
outmultiply1.save (outmultiply1)

Attachments

Outcomes