Skip to content

Commit

Permalink
added the test for the modified nowccast interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Loickemajou authored Aug 12, 2024
1 parent 3f5d31a commit b37ce1d
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions pysteps/tests/test_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,3 +360,43 @@ def test_tracking_interface():

invalid_names = ["lucas-kanade", "dating"]
_generic_interface_test(method_getter, valid_names_func_pair, invalid_names)


def test_nowcasts_interface():
"""Test the discover_nowcasts and nowcasts_info function."""
from pysteps.nowcasts.interface import discover_nowcasts
from pysteps.nowcasts.interface import nowcasts_info

# Clear the existing methods to test the discovery process
global _nowcast_methods
# Call the function to get nowcasts info
available_nowcasts, nowcasts_in_interface = nowcasts_info()

# Call the function to discover nowcasts
discover_nowcasts()

# Check if the expected methods are added
expected_methods = [
"anvil",
"eulerian",
"extrapolation",
"lagrangian",
"lagrangian_probability",
"linda",
"probability",
"sprog",
"sseps",
"steps",
"dgmr",
]

for method in expected_methods:
if method == "dgmr":
assert (
method in nowcasts_in_interface
), f"Method {method} not found in discovered nowcasts. Please intall dgmr_plugin through 'pip install dgmr_plugin'"
assert (
method in nowcasts_in_interface
), f"Method {method} not found in discovered nowcasts."

print("All expected nowcast methods discovered successfully.")

0 comments on commit b37ce1d

Please sign in to comment.