Skip to content

Workflows#

Here are some useful workflows for geospatial operations using WhiteboxTools and PyWBT. You can copy-paste and customize these workflows into your Python script and pass them to the arg_dict argument of pywbt.whitebox_tools function.

Contributing to this list is highly appreciated. You can just click on the Edit this page link at the top right of this page.

Topographic Wetness Index#

{
    "BreachDepressions": ["-i=dem.tif", "--fill_pits", "-o=dem_corr.tif"],
    "D8FlowAccumulation": [
        "-i=dem_corr.tif",
        "--out_type='specific contributing area'",
        "-o=sca.tif",
    ],
    "Slope": ["-i=dem_corr.tif", "--units=degrees", "-o=slope.tif"],
    "WetnessIndex": ["--sca=sca.tif", "--slope=slope.tif", "-o=twi.tif"],
}

Basin Delineation#

{
    "BreachDepressions": ["-i=dem.tif", "--fill_pits", "-o=dem_corr.tif"],
    "D8Pointer": ["-i=dem_corr.tif", "-o=fdir.tif"],
    "Basins": ["--d8_pntr=fdir.tif", "-o=basins.tif"],
}

Extract Streams#

{
    "BreachDepressions": ["-i=dem.tif", "--fill_pits", "-o=dem_corr.tif"],
    "D8FlowAccumulation": ["-i=dem_corr.tif", "-o=d8accum.tif"],
    "ExtractStreams": ["--flow_accum=d8accum.tif", "--threshold=600.0", "-o=streams.tif"],
}

Find Mainstems#

{
    "BreachDepressions": ["-i=dem.tif", "--fill_pits", "-o=dem_corr.tif"],
    "D8Pointer": ["-i=dem_corr.tif", "-o=fdir.tif"],
    "D8FlowAccumulation": ["-i=fdir.tif", "--pntr", "-o=d8accum.tif"],
    "FindMainStem": ["--d8_pntr=fdir.tif", "--streams=d8accum.tif", "-o=mainstem.tif"],
}

Burn Streams and Flow Direction#

{
    "BreachDepressions": ["-i=dem.tif", "--fill_pits", "-o=dem_corr.tif"],
    "FillBurn": ["--dem=dem_corr.tif", f"--streams=stream.shp", "-o=dem_burn.tif"],
    "D8Pointer": ["-i=dem_burn.tif", "--esri_pntr", "-o=d8.tif"],
}

Watershed at Pour Points#

{
    "BreachDepressions": ["-i=dem.tif", "--fill_pits", "-o=dem_corr.tif"],
    "D8Pointer": ["-i=dem_corr.tif", "-o=fdir.tif"],
    "Watershed": ["--d8_pntr=fdir.tif", "--pour_pts=pour_pts.shp","-o=watershed.tif"],
    "RasterToVectorPolygons": ["-i=watershed.tif","-o=watershed.shp"],
}