This is a python code to generate Optimal Channel Networks (OCNs) from random initial network. The Optimization algorithm is greedy which changes the configuration as long as it reduces the objective functional. The Rolling window function is from https://gist.github.com/seberg/3866040l.
conda env create -f environment.yml
conda activate conda activate ocn_env
python main.py
Hooshyar, Milad, Shashank Anand, and Amilcare Porporato. "Variational analysis of landscape elevation and drainage networks." Proceedings of the Royal Society A 476.2239 (2020): 20190775.