This tool calculates the upstream distance to the farthest stream head for each grid cell belonging to a raster stream network. The user must input a raster containing streams data (streams
), where stream grid cells are denoted by all positive non-zero values, and a D8 flow pointer (i.e. flow direction) raster (d8_pointer). The pointer image is used to traverse the stream network and must only be created using the D8 algorithm. Stream cells are designated in the streams image as all values greater than zero. Thus, all non-stream or background grid cells are commonly assigned either zeros or NoData values. Background cells will be assigned the NoData value in the output image, unless zero_background=True
, in which case non-stream cells will be assigned zero values in the output.
By default, the pointer raster is assumed to use the clockwise indexing method used by WhiteboxTools. If the pointer file contains ESRI flow direction values instead, the user should specify esri_pntr=True
.
length_of_upstream_channels, find_main_stem
d8_pointer (Raster): The D8 pointer (flow direction) raster.
streams_raster (Raster): The raster object containing the streams data.
esri_pointer (bool): Determines whether the d8_pointer raster contains pointer data in the Esri format. Default is False.
zero_background (bool): Determines whether the background value in the output raster are assigned zero (True) or NoData values (False). Default is False.
Raster: returning value
def farthest_channel_head(self, d8_pointer: Raster, streams_raster: Raster, esri_pointer: bool = False, zero_background: bool = False) -> Raster: ...