Beispiel #1
0
 def test_basic(self):
     """Test that the __repr__ returns the expected string."""
     result = str(OrographicAlphas())
     msg = ('<OrographicAlphas: min_alpha: {}; max_alpha: {}; '
            'coefficient: {}; power: {}; '
            'invert_alphas: {}>'.format(0.0, 1.0, 1, 1, True))
     self.assertEqual(result, msg)
Beispiel #2
0
 def setUp(self):
     """Set up cube & plugin"""
     self.plugin = OrographicAlphas(min_alpha=0.3, max_alpha=0.5)
     self.cube = set_up_cube()
     self.gradient_x, self.gradient_y = \
         DifferenceBetweenAdjacentGridSquares(gradient=True).process(
             self.cube)
def process(orography: cli.inputcube,
            *,
            min_alpha: float = 0.0,
            max_alpha: float = 1.0,
            coefficient: float = 1.0,
            power: float = 1.0,
            invert_alphas=True):
    """Generate alpha smoothing parameters for recursive filtering based on
    orography gradients.

    Args:
        orography (iris.cube.Cube):
            A 2D field of orography for the grid to generate alphas for.
        min_alpha (float):
            The minimum value of alpha.
        max_alpha (float):
            The maximum value of alpha.
        coefficient (float):
            The coefficient for the alpha calculation.
        power (float):
            The power for the alpha equation.
        invert_alphas (bool):
            If True then the max and min alpha values will be swapped.

    Returns:
        iris.cube.CubeList:
            Processed CubeList containing alpha_x and alpha_y cubes.
    """
    from improver.utilities.ancillary_creation import OrographicAlphas
    return OrographicAlphas(min_alpha, max_alpha, coefficient, power,
                            invert_alphas).process(orography)
Beispiel #4
0
 def test_basic(self):
     """Test default attribute initialisation"""
     result = OrographicAlphas()
     self.assertTrue(result.invert_alphas)
     self.assertEqual(result.min_alpha, 0.)
     self.assertEqual(result.max_alpha, 1.)
     self.assertEqual(result.coefficient, 1.)
     self.assertEqual(result.power, 1.)
Beispiel #5
0
 def setUp(self):
     """Set up cube & plugin"""
     self.plugin = OrographicAlphas()
     cube = set_up_cube()
     self.cubelist = [cube, cube]
Beispiel #6
0
 def setUp(self):
     """Set up cube & plugin"""
     self.plugin = OrographicAlphas(coefficient=0.5, power=2.)
     self.cube = set_up_cube()