hypsometric_integral: calculate the hypsometric hypsometric_integral¶
-
hypsometric_integral(grid, outlet_id)[source]¶ Calculate the hypsometric integral for the model grid.
The hypsometric integral \(I\) is defined as
\[I = \frac{\frac{1}{N} \sum_{i=0}^{N} \left( z - \min \left( z\right) \right)} {\max \left(z\right) - \min \left( z \right)}\]Where \(z\) is the set of elevation values, and \(N\) is the number of elevation values.
- Parameters
grid (Landlab model grid) –
outlet_id (int) – Outlet id of the watershed.
- Returns
I – The hypsometric integral.
- Return type
Examples
First an example that only uses the
hypsometric_integralfunction.>>> from landlab import RasterModelGrid >>> from landlab.components import FlowAccumulator >>> from umami.calculations import hypsometric_integral >>> grid = RasterModelGrid((10, 10)) >>> z = grid.add_zeros("node", "topographic__elevation") >>> z += grid.x_of_node + grid.y_of_node >>> fa = FlowAccumulator(grid) >>> fa.run_one_step() >>> hypsometric_integral(grid, 1) 0.5
Next, the same calculations are shown as part of an umami
Metric.>>> from io import StringIO >>> from umami import Metric >>> file_like=StringIO(''' ... hi: ... _func: hypsometric_integral ... outlet_id: 1 ... ''') >>> metric = Metric(grid) >>> metric.add_from_file(file_like) >>> metric.names ['hi'] >>> metric.calculate() >>> metric.values [0.5]