HeightAboveDrainageCalculator: Calculate height above nearest drainage#

Landlab component to calculate height above nearest drainage.

@author: D Litwin

class HeightAboveDrainageCalculator(*args, **kwds)[source]#

Bases: Component

Calculate the elevation difference between each node and its nearest drainage node in a DEM.

This component implements the method described by Nobre et al (2011). A single direction flow director (D8 or steepest descent) must be run prior to HeightAboveDrainageCalculator to supply the flow directions. This component does not fill depressions in a DEM, but rather it treats them as drainage nodes. For best results, please run one of the available pit filling components prior to HeightAboveDrainageCalculator.

Examples

>>> import numpy as np
>>> from numpy.testing import assert_equal
>>> from landlab import RasterModelGrid
>>> from landlab.components import HeightAboveDrainageCalculator, FlowAccumulator
>>> mg = RasterModelGrid((4, 5))
>>> z = mg.add_zeros("topographic__elevation", at="node")
>>> mg.set_status_at_node_on_edges(
...     right=mg.BC_NODE_IS_CLOSED,
...     bottom=mg.BC_NODE_IS_FIXED_VALUE,
...     left=mg.BC_NODE_IS_CLOSED,
...     top=mg.BC_NODE_IS_CLOSED,
... )
>>> elev = np.array(
...     [[2, 1, 0, 1, 2], [3, 2, 1, 2, 3], [4, 3, 2, 3, 4], [5, 4, 4, 4, 5]]
... )
>>> z[:] = elev.reshape(len(z))
>>> elev
array([[2, 1, 0, 1, 2],
   [3, 2, 1, 2, 3],
   [4, 3, 2, 3, 4],
   [5, 4, 4, 4, 5]])
>>> fa = FlowAccumulator(mg, flow_director="D8")
>>> fa.run_one_step()
>>> channel__mask = mg.zeros(at="node")
>>> channel__mask[[2, 7]] = 1
>>> channel__mask.reshape(elev.shape)
array([[ 0.,  0.,  1.,  0.,  0.],
   [ 0.,  0.,  1.,  0.,  0.],
   [ 0.,  0.,  0.,  0.,  0.],
   [ 0.,  0.,  0.,  0.,  0.]])
>>> hd = HeightAboveDrainageCalculator(mg, channel_mask=channel__mask)
>>> hd.run_one_step()
>>> mg.at_node["height_above_drainage__elevation"].reshape(elev.shape)
array([[ 2.,  0.,  0.,  0.,  0.],
       [ 3.,  2.,  0.,  2.,  3.],
       [ 4.,  2.,  1.,  2.,  4.],
       [ 5.,  4.,  4.,  4.,  5.]])

References

Required Software Citation(s) Specific to this Component

None Listed

Additional References

Nobre, A. D., Cuartas, L. A., Hodnett, M., Rennó, C. D., Rodrigues, G., Silveira, A., et al. (2011). Height Above the Nearest Drainage – a hydrologically relevant new terrain model. Journal of Hydrology, 404(1), 13–29. https://doi.org/10.1016/j.jhydrol.2011.03.051

Parameters:
  • grid (ModelGrid) – Landlab ModelGrid object

  • channel_mask (field name, array of uint8) – Logical map of nodes where drainage is present

__init__(grid, channel_mask='channel__mask')[source]#
Parameters:
  • grid (ModelGrid) – Landlab ModelGrid object

  • channel_mask (field name, array of uint8) – Logical map of nodes where drainage is present

property channel_mask#
run_one_step()[source]#