def calculate_statistic(self, variable, statistic):
        # Apply statistic
        for stat in self.statistics:
            if statistic in stat[1]:
                func = getattr(stat[0], stat[1][statistic])
                break
        else:
            # Default
            func = getattr(numpy.ma, 'mean')
        return func(variable)

    # ---------------------------------------------------------
Calculates given statistic for a NumPy array based on look-up
dataset/ETHPy150Open Esri/solutions-geoprocessing-toolbox/suitability/toolboxes/scripts/MultidimensionSupplementalTools/MultidimensionSupplementalTools/Scripts/mds/tools/multidimensional_zonal_statistics.py/MultidimensionalZonalStatistics.calculate_statistic