Basin (Spatial Analyst)
Summary
Creates a raster delineating all drainage basins.
Usage
The drainage basins are delineated within the analysis window by identifying ridge lines between basins. The input flow direction raster is analyzed to find all sets of connected cells that belong to the same drainage basin. The drainage basins are created by locating the pour points at the edges of the analysis window (where water would pour out of the raster), as well as sinks, then identifying the contributing area above each pour point. This results in a raster of drainage basins.
-
The best results will be obtained if when the input Flow Direction raster was created, the Force option was used.
-
All cells in the raster will belong to a basin, even if that basin is only one cell.
Syntax
Parameter | Explanation | Data Type |
in_flow_direction_raster |
The input raster that shows the direction of flow out of each cell. The flow direction raster can be created using the Flow Direction tool. | Raster Layer |
Return Value
Name | Explanation | Data Type |
out_raster |
The output raster that delineates the drainage basins. It will be of integer type. | Raster |
Code Sample
This example determines the drainage basins of an input flow direction GRID raster.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outBasin = Basin("flowdir")
outBasin.save("C:/sapyexamples/output/outbasin01")
This example determines the drainage basins of an input flow direction GRID raster.
# Name: Basin_Ex_02.py
# Description: Creates a raster delineating all drainage basins.
# 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
inFlowDirectionRaster = "flowdir"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute FlowDirection
outBasin = Basin(inFlowDirectionRaster)
# Save the output
outBasin.save("C:/sapyexamples/output/outbasin02")