PyOCN Documentation
This is a package to generate optimal channel networks (OCNs), based on the algorithm described in Carraro et al. (2020). Generation and application of river network analogues for use in ecology and evolution. Ecology and Evolution. doi:10.1002/ece3.6479 and mirrors some of the functionality of the OCNet R package (https://lucarraro.github.io/OCNet/).
Installation
Install from PyPI:
pip install pyocn
Or with optional raster and xarray support:
pip install pyocn[raster]
Quick Start
import PyOCN as po
# Create an OCN from a predefined initial network type
ocn = po.OCN.from_net_type("I", dims=(32, 32), gamma=0.5, random_state=42)
# Optimize with simulated annealing
ocn.fit(n_iterations=10000)
# Visualize
po.plot_ocn_raster(ocn)
plt.show()
API Reference: