Note
Click here to download the full example code
View Watershed Characterisitics Using StreamStats¶
Import Packages¶
To get started, download the necessary Python packages. The GeoPandas
package is an open source project that assists in working with geospatial data
in Python. Learn more about
GeoPandas.
import streamstats
import geopandas as gpd
Indentify watershed¶
To identify a HUC, use a latitude and longitude value to select a specific watershed.
Assign cordinates to variables lat and lon. Using StreamStat’s data,
assign location to a variable that will represent the
delineated watershed using the USGS StreamStats API.
lat, lon = 39.966256, -105.482227
ws = streamstats.Watershed(lat=lat, lon=lon)
Find the Hydrologic Unit Code (HUC) of the watershed¶
The USGS delineates watershed using a series of numbers based a hierarchal
region system. Every watershed is assigned a series of numbers called the
hydrological unit code (HUC). StreamStats uses HUC to identify and delineate
watersheds. Learn more about
Hydrologic Units . The ws.huc function will return the HUC of the
identified watershed.
ws.huc
Out:
'10190005'
Find Characteristics of the watershed¶
The function ws.characteristics() will return the available basin
characteristics for the identified watershed.In order to return information
on a specific characteristic, use function
ws.get_characteristic('StatLabel'). Learn more
about StreamStats Basin Characteristic Definitions.
# Available characteristics
ws.characteristics
# Specific characteristics
ws.get_characteristic('DRNAREA')
Out:
{'ID': 0, 'name': 'Drainage Area', 'description': 'Area that drains to a point on a stream', 'code': 'DRNAREA', 'unit': 'square miles', 'value': 38.6}
Total running time of the script: ( 1 minutes 1.674 seconds)