Available with Spatial Analyst license.
Summary
Determines the contributing area above a set of cells in a raster.
Usage
The value of each watershed will be taken from the value of the source in the input raster or feature pour point data. When the pour point is a raster dataset, the cell values will be used. When the pour point is a point feature dataset, the values will come from the specified field.
Better results will be obtained if the Snap Pour Point tool is used beforehand to help locate the pour points to cells of high accumulated flow.
When specifying the input pour point locations as feature data, the default field will be the first available valid field. If no valid fields exist, the ObjectID field (for example, OID or FID) will be the default.
See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.
Syntax
Watershed (in_flow_direction_raster, in_pour_point_data, {pour_point_field})
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 |
in_pour_point_data | The input pour point locations. For a raster, this represents cells above which the contributing area, or catchment, will be determined. All cells that are not NoData will be used as source cells. For a point feature dataset, this represents locations above which the contributing area, or catchment, will be determined. | Raster Layer; Feature Layer |
pour_point_field (Optional) | Field used to assign values to the pour point locations. If the pour point dataset is a raster, use Value. If the pour point dataset is a feature, use a numeric field. If the field contains floating-point values, they will be truncated into integers. | Field |
Return Value
Name | Explanation | Data Type |
out_raster | The output raster that shows the contributing area. This output is of integer type. | Raster |
Code sample
Watershed example 1 (Python window)
This example determines the contributing area for selected pour point locations on a flow direction Grid raster.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outWatershed = Watershed("flowdir", "pourpoint")
outWatershed.save("C:/sapyexamples/output/outwtrshd01")
Watershed example 2 (stand-alone script)
This example determines the contributing area for selected pour point locations on a flow direction Grid raster and outputs the watershed as a TIFF raster.
# Name: Watershed_Ex_02.py
# Description: Determines the contributing area above a set of cells in a
# raster.
# 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
inFlowDirection = "flowdir"
inPourPointData = "pourpoint"
inPourPointField = "VALUE"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute Watershed
outWatershed = Watershed(inFlowDirection, inPourPointData, inPourPointField)
# Save the output
outWatershed.save("C:/sapyexamples/output/outwtrshd02.tif")
Environments
Licensing information
- ArcGIS Desktop Basic: Requires Spatial Analyst
- ArcGIS Desktop Standard: Requires Spatial Analyst
- ArcGIS Desktop Advanced: Requires Spatial Analyst