A systematic approach for detecting abrupt shifts in ecological timeseries