.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/hydrology/plot_13_horton_laws_of_stream_numbers.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_hydrology_plot_13_horton_laws_of_stream_numbers.py: Horton's laws of stream numbers (1945) ====================================== Robert Horton ordered the streams of a basin, from unbranched headwaters up to the main river, and found that the number of streams of each order falls in a geometric series while their mean length grows in another. Two ratios, the bifurcation ratio and the length ratio, summarize the whole network. The example fits both to a synthetic fifth-order basin (with Strahler's 1952 ordering) and compares the counts with Horton's law. .. GENERATED FROM PYTHON SOURCE LINES 12-36 .. image-sg:: /api/gallery/hydrology/images/sphx_glr_plot_13_horton_laws_of_stream_numbers_001.png :alt: Horton: geometric laws of a drainage network :srcset: /api/gallery/hydrology/images/sphx_glr_plot_13_horton_laws_of_stream_numbers_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from earthsciencekit.hydrology import stream_length, stream_number order = np.arange(1, 6) counts = np.array([243, 58, 15, 4, 1]) lengths = np.array([0.35, 0.82, 1.9, 4.6, 10.8]) * 1e3 # m bifurcation = 10 ** -np.polyfit(order, np.log10(counts), 1)[0] length_ratio = 10 ** np.polyfit(order, np.log10(lengths), 1)[0] predicted = stream_number(order, 5, bifurcation) assert 3.5 < bifurcation < 4.5 and 2 < length_ratio < 2.6 assert np.all(np.abs(np.log(predicted / counts)) < 0.25) fig, ax = plt.subplots() ax.semilogy(order, counts, "o", label="stream count") ax.semilogy(order, predicted, "-", label=f"R_b = {bifurcation:.2f}") ax.semilogy(order, lengths, "s", label="mean length [m]") ax.semilogy(order, stream_length(order, stream_length(1, lengths[0], 1), length_ratio), "--", label=f"R_L = {length_ratio:.2f}") ax.set(xlabel="stream order", xticks=order, title="Horton: geometric laws of a drainage network") ax.legend() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.143 seconds) .. _sphx_glr_download_api_gallery_hydrology_plot_13_horton_laws_of_stream_numbers.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../lite/lab/index.html?path=api/gallery/hydrology/plot_13_horton_laws_of_stream_numbers.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_13_horton_laws_of_stream_numbers.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_13_horton_laws_of_stream_numbers.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_13_horton_laws_of_stream_numbers.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_