deltametrics.plan.compute_channel_depth(channelmask, depth, section=None, depth_type='thalweg', return_depths=False)

Compute channel depth from a mask and section.

Compute the depth of channels identified in a ChannelMask along a section. This function identifies the individual channels that are crossed by the section and computes depth of each. The depths are then treated as samples for aggregating statistics in the return.

By default, only the mean and standard deviation are returned, but the list of depths can be returned with return_depths=True.


If a numpy array is passed for section, then the distance between points along the section is assumed to be ==1.

  • channelmask (ChannelMask or ndarray) – The channel mask (i.e., should be binary) to compute channel depths from.

  • depth (xarray or ndarray) – The depth field corresponding to the channelmask array.

  • section (BaseSection subclass, or ndarray) – The section along which to compute channel depths. If a Section type is passed, the .idx_trace attribute will be used to query the ChannelMask and determine depths. Otherwise, an Nx2 array can be passed, which specified the dim1-dim2 coordinate pairs to use as the trace.

  • depth_type (str) – Flag indicating how to compute the depth of each channel (i.e., before aggregating). Valid flags are ‘thalweg’`(default) and `’mean’.

  • return_depths (bool, optional) – Whether to return (as third argument) a list of channel depths. Default is false (do not return list).


  • mean (float) – Mean of measured depths.

  • stddev (float) – Standard deviation of measured depths.

  • depths (list) – List of depth measurements. Returned only if return_depths=True.