Early detection of ecosystem regime shifts