diff --git a/compass/landice/mesh.py b/compass/landice/mesh.py index 9b0c2c43b..07bc4833b 100644 --- a/compass/landice/mesh.py +++ b/compass/landice/mesh.py @@ -1050,11 +1050,12 @@ def __guess_scrip_name(filename): source_scrip = __guess_scrip_name(os.path.basename(source_file)) weights_filename = "gridded_to_MPAS_weights.nc" - if variables != "all": - # make sure this is a list - - # if list, then join the list making it a space seprated list for cli - variables = " ".join(variables) + # make sure variables is a list, encompasses the variables="all" case + if isinstance(variables, str): + variables = [variables] + if not isinstance(variables, list): + raise TypeError("Arugment 'variables' is of incorrect type, must" + " either the string 'all' or a list string") logger.info('creating scrip file for source dataset') # Note: writing scrip file to workdir @@ -1085,7 +1086,7 @@ def __guess_scrip_name(filename): '-d', dest_file, '-m', 'e', '-w', weights_filename, - '-v', variables] + '-v'] + variables check_call(args, logger=logger)