Predicting Ecosystem Net Primary Productivity by Percolation Theory and Optimality Principle