def test_compute_statistic(self): """Test statistic.""" datas = [self.cube1.data[0], self.cube2.data[0]] stat_mean = _compute_statistic(datas, "mean") stat_median = _compute_statistic(datas, "median") expected_mean = np.ma.ones((3, 2, 2)) expected_median = np.ma.ones((3, 2, 2)) self.assert_array_equal(stat_mean, expected_mean) self.assert_array_equal(stat_median, expected_median)
def test_compute_percentile(self): """Test statistic.""" data = [self.cube1.data[0] * 0.5, self.cube2.data[0] * 2] stat = _compute_statistic(data, "p75") expected = np.ma.ones((3, 2, 2)) * 1.625 expected[0, 0, 0] = 0.5 self.assert_array_equal(stat, expected)
def test_compute_std(self): """Test statistic.""" data = [self.cube1.data[0], self.cube2.data[0] * 2] stat = _compute_statistic(data, "std") expected = np.ma.ones((3, 2, 2)) * 0.5 expected[0, 0, 0] = 0 self.assert_array_equal(stat, expected)
def test_compute_min(self): """Test statistic.""" data = [self.cube1.data[0] * 0.5, self.cube2.data[0] * 2] stat = _compute_statistic(data, "min") expected = np.ma.ones((3, 2, 2)) * 0.5 self.assert_array_equal(stat, expected)