1515import click
1616
1717from engine .tolerance import tolerance
18- from util .click_util import cli_help
18+ from util .click_util import CommaSeparatedStrings , cli_help
1919from util .dataframe_ops import check_file_with_tolerances
2020from util .log_handler import logger
21- from util .utils import FileInfo
21+ from util .utils import FileInfo , validate_single_stats_file
2222
2323
2424def find_members_and_factor_validating_for_all_stats_files (
@@ -198,16 +198,22 @@ def check_selection_by_ids(
198198 help = cli_help ["enable_check_only" ],
199199)
200200@click .option (
201- "--stats-file-name" ,
202- help = cli_help ["stats_file_name" ],
201+ "--ensemble-files" ,
202+ type = CommaSeparatedStrings (),
203+ default = [],
204+ help = cli_help ["ensemble_files" ]
205+ + "\n Note: this option accepts exactly one stats file." ,
203206)
204207@click .option (
205208 "--selected-members-file-name" ,
206209 help = cli_help ["selected_members_file_name" ],
207210)
208211@click .option (
209- "--tolerance-file-name" ,
210- help = cli_help ["tolerance_file_name" ],
212+ "--tolerance-files" ,
213+ type = CommaSeparatedStrings (),
214+ default = [],
215+ help = cli_help ["tolerance_files_output" ]
216+ + "\n Note: this option accepts exactly one stats file." ,
211217)
212218@click .option (
213219 "--member-type" ,
@@ -248,9 +254,9 @@ def check_selection_by_ids(
248254def select_members (
249255 experiment_name ,
250256 enable_check_only ,
251- stats_file_name ,
257+ ensemble_files ,
252258 selected_members_file_name ,
253- tolerance_file_name ,
259+ tolerance_files ,
254260 member_type ,
255261 max_member_count ,
256262 total_member_count ,
@@ -261,9 +267,24 @@ def select_members(
261267 """
262268 Selects members and writes them to a file together with the tolerance factor
263269 """
270+
271+ # check for valid input parameters
272+ errors = []
273+
274+ stats_file_name = validate_single_stats_file (ensemble_files , "ensemble" , errors )
275+ tolerance_file_name = validate_single_stats_file (
276+ tolerance_files , "tolerance" , errors
277+ )
278+
264279 if max_member_count >= total_member_count :
265- logger .error ("ERROR: max_member_count must be smaller than total_member_count" )
280+ errors .append ("max_member_count must be smaller than total_member_count" )
281+
282+ if errors :
283+ for msg in errors :
284+ logger .error ("ERROR: %s" , msg )
266285 sys .exit (1 )
286+
287+ # start with selecting members
267288 if enable_check_only :
268289 check_selection_by_ids (
269290 stats_file_name = stats_file_name ,
0 commit comments