Skip To Content

Focal Flow

Available with Spatial Analyst license.

Summary

Determines the flow of the values in the input raster within each cell's immediate neighborhood.

Learn more about how Focal Flow works

Illustration

Focal Flow illustration
OutRas = FocalFlow(InRas1)

Usage

  • Focal Flow evaluates the eight immediate neighbors of a cell to determine the flow.

  • The resulting values from the tool measure flow into, not out of, a cell.

  • The output values are derived from the binary representation of the results of the analysis.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Syntax

FocalFlow (in_surface_raster, {threshold_value})
ParameterExplanationData Type
in_surface_raster

The input surface raster for which to calculate the focal flow.

The eight immediate neighbors of each cell are evaluated to determine the flow.

The input raster can be integer or floating point.

Raster Layer
threshold_value
(Optional)

Defines a value that constitutes the threshold, which must be equaled or exceeded before flow can occur.

The threshold value can be either an integer or floating-point value.

If the difference between the value at a neighboring cell location and the value of the processing cell is less than or equal to the threshold value, the output will be 0 (or no flow).

Double

Return Value

NameExplanationData Type
out_raster

The output focal flow raster.

The output raster is always of integer type.

Raster

Code sample

FocalFlow example 1 (Python window)

This example determines the binary representation of flow for the input raster with a threshold value of 10.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
focalFlowOut = FocalFlow("elevation", 10)
focalFlowOut.save("C:/sapyexamples/output/flowout")
FocalFlow example 2 (stand-alone script)

This example determines the binary representation of flow for the input raster with a threshold value of 5.

# Name: FocalFlow_Ex_02.py
# Description: Determines the flow of the values in the 
#    input raster within each cell's immediate neighborhood.
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inRaster = "elevation"
threshold = 5 

# Execute FocalFlow
outFocalFlow = FocalFlow(inRaster, threshold)

# Save the output 
outFocalFlow.save("C:/sapyexamples/output/focalflow")

Licensing information

  • ArcGIS Desktop Basic: Requires Spatial Analyst
  • ArcGIS Desktop Standard: Requires Spatial Analyst
  • ArcGIS Desktop Advanced: Requires Spatial Analyst

Related topics