Water and energy balance of territories