From b2816442e93dfede723fe35425036d01a3ebcc34 Mon Sep 17 00:00:00 2001 From: Andrew Nolan Date: Fri, 13 Sep 2024 14:41:46 -0600 Subject: [PATCH] Switch to list concatenation for variables specification. Add the list of requested variables to the `args` list by concating. Previously I was manually creating the space seperated list (i.e string) when a list of variables was passed to the girdded inerpolator function. This space seperated string was not correctly parsed by the `mpas_tool.logging.check_call` function resulting in the variables not being inerpolated. --- compass/landice/mesh.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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)