Implements the pollutantmean function