def test_nowcasts_interface():
    """Test the nowcasts module interface."""

    from pysteps.nowcasts import (
        anvil,
        extrapolation,
        lagrangian_probability,
        linda,
        sprog,
        steps,
        sseps,
    )

    method_getter = pysteps.nowcasts.interface.get_method

    valid_names_func_pair = [
        ("anvil", anvil.forecast),
        ("extrapolation", extrapolation.forecast),
        ("lagrangian", extrapolation.forecast),
        ("linda", linda.forecast),
        ("probability", lagrangian_probability.forecast),
        ("lagrangian_probability", lagrangian_probability.forecast),
        ("sprog", sprog.forecast),
        ("sseps", sseps.forecast),
        ("steps", steps.forecast),
    ]

    invalid_names = ["extrap", "step", "s-prog", "pysteps"]
    _generic_interface_test(method_getter, valid_names_func_pair, invalid_names)

    # Test eulerian persistence method
    precip = numpy.random.rand(100, 100)
    velocity = numpy.random.rand(100, 100)
    num_timesteps = 10
    for name in ["eulerian", "EULERIAN"]:
        forecast = method_getter(name)(precip, velocity, num_timesteps)
        for i in range(num_timesteps):
            assert numpy.all(forecast[i] == precip)
Test the nowcasts module interface.
pysteps/tests/test_interfaces.py