Focal Stats & Map algebra

444
0
11-20-2012 03:58 AM
CiaranRobb
New Contributor
Hi everyone,

I'm a Python novice trying to write some simple scripts to streamline operations for my research. I'm trying to perform some focal
stats to then use as variables in a map algebra expression to map topographic pits and peaks.

Here is the malfunctioning script - Can anyone tell me where I'm going wrong? The script works fine for the focal stats or map algebra in isolation but not when put together

# Name: SDVI
# Description: Calaculates neighbourhood stats
# Requirements: Spatial Analyst Extension
# Author: Ciaran Robb

# Import system modules

import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "I:\Ciaran\CAMBRIDGE PHD\Batch"

# Set local variables (inRaster = elevation)
inRaster = "fil_tif1"
neighborhood = NbrCircle(3, "CELL")

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute FocalStatistics
outFocalStatistics1 = FocalStatistics(inRaster, neighborhood, "MEAN",
                                     "")
outFocalStatistics2 = FocalStatistics(inRaster, neighborhood, "RANGE",
                                     "")

# map algebra process (mean elevation - elevation))/ elevation range)
stdv3 = (Raster("focalst_fil_1") - Raster("fil_tif1")) / Raster("focalst_fil_2")
0 Kudos
0 Replies