Ecohydrological optimization of pattern and processes in water-limited ecosystems