def test_weights_sum_to_1(self):
        """Test that if a weights cube is provided which is properly
        normalised, i.e. the weights sum to one over the blending
        dimension, no exception is raised."""

        coord = "forecast_reference_time"
        plugin = WeightedBlendAcrossWholeDimension(coord)
        plugin.check_weights(self.weights3d.data, 0)
 def test_weights_do_not_sum_to_1_error(self):
     """Test that if a weights cube is provided which is not properly
     normalised, i.e. the weights do not sum to one over the blending
     dimension, an error is raised."""
     plugin = WeightedBlendAcrossWholeDimension(self.coord)
     weights = self.weights3d.data
     weights[0, 0, 1] = 1.0
     msg = "Weights do not sum to 1 over the blending coordinate."
     with self.assertRaisesRegex(ValueError, msg):
         plugin.check_weights(weights, 0)
 def test_weights_sum_to_1_but_with_a_zero_weight(self):
     """Test that if a weights cube is provided which is zero or properly
     normalised,  i.e. the weights sum to one over the blending
     dimension, no exception is raised."""
     weights = np.array([[[0, 0.3], [0.2, 0.4]], [[0, 0.3], [0.2, 0.4]],
                         [[0, 0.4], [0.6, 0.2]]])
     plugin = WeightedBlendAcrossWholeDimension(self.coord)
     try:
         plugin.check_weights(weights, 0)
     except ValueError:
         self.fail("Error testing check_weights")