Summary
Determines the catchment area above a set of cells in a raster.
Usage
· The values for each watershed are taken from the source values in the input raster or from the feature pour point data. If the pour point is a raster dataset, the cell value is used. If the pour point is a point feature dataset, the value is obtained from the specified field.
· If you pre-use the Snap pour Point tool to position the pour point to a cell with a large accumulated flow, you will get better results.
· When you specify an input pour point location as the feature data, the default field will be the first available valid field. If no valid field exists, the ObjectID field (such as OID or FID) will be the default field.
Grammar
Watershed (In_flow_direction_raster, In_pour_point_data, {Pour_point_field})
Code instance
Watershed Example 1 (Python window)
This example determines the catchment area for the selected pour point position in the flow to grid grid.
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 catchment area for the selected pour point position in the flow to 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")
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
ArcGIS Tutorial: Watershed