Skip to content

Commit acb0be2

Browse files
authored
modified evaluation api, callable as python function (ecmwf#713)
1 parent 05a7f29 commit acb0be2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/evaluate/src/weathergen/evaluate/run_evaluation.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import argparse
1212
import logging
13+
import sys
1314
from collections import defaultdict
1415
from pathlib import Path
1516

@@ -27,6 +28,11 @@
2728

2829

2930
def evaluate() -> None:
31+
# By default, arguments from the command line are read.
32+
evaluate_from_args(sys.argv[1:])
33+
34+
35+
def evaluate_from_args(argl: list[str]) -> None:
3036
parser = argparse.ArgumentParser(
3137
description="Fast evaluation of WeatherGenerator runs."
3238
)
@@ -36,7 +42,7 @@ def evaluate() -> None:
3642
help="Path to the configuration yaml file for plotting. e.g. config/plottig_config.yaml",
3743
)
3844

39-
args = parser.parse_args()
45+
args = parser.parse_args(argl)
4046

4147
# configure logging
4248
logging.basicConfig(level=logging.INFO)

0 commit comments

Comments
 (0)