Variational analysis of landscape elevation and drainage networks