From 16db43b9d9042f4f03b0a0d1cc9c70c514db57a5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 30 Jan 2022 08:58:40 -0700 Subject: [PATCH 1/3] Introduce local variable in plon_type This avoids changing the type of an existing variable. --- python/ctsm/args_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/ctsm/args_utils.py b/python/ctsm/args_utils.py index 1d8ee8d2fc..d944227157 100644 --- a/python/ctsm/args_utils.py +++ b/python/ctsm/args_utils.py @@ -44,10 +44,10 @@ def plon_type(plon): Returns: plon_out (float): converted longitude between 0 and 360 """ - plon = float(plon) - if plon < -180 or plon > 360: + plon_float = float(plon) + if plon_float < -180 or plon_float > 360: raise argparse.ArgumentTypeError( "ERROR: Longitude should be between 0 and 360 or -180 and 180." ) - plon_out = lon_range_0_to_360(plon) + plon_out = lon_range_0_to_360(plon_float) return plon_out From 9ef390105224a964e990c1bf82163be873b101db Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 30 Jan 2022 11:56:35 -0700 Subject: [PATCH 2/3] Restore on/off options I think these are needed for consistency with standard config file parsing --- python/ctsm/config_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/ctsm/config_utils.py b/python/ctsm/config_utils.py index 41a023f375..0ece3a180a 100644 --- a/python/ctsm/config_utils.py +++ b/python/ctsm/config_utils.py @@ -156,9 +156,9 @@ def _convert_to_bool(var): Returns: var_out (bool): Boolean value corresponding to the input. """ - if var.lower() in ("yes", "true", "t", "y", "1"): + if var.lower() in ("yes", "true", "t", "y", "1", "on"): var_out = True - elif var.lower() in ("no", "false", "f", "n", "0"): + elif var.lower() in ("no", "false", "f", "n", "0", "off"): var_out = False else: raise ValueError("Boolean value expected. [true or false] or [y or n]") From d09113dfcca24cc3c539a62443f24a338168e615 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 30 Jan 2022 12:04:03 -0700 Subject: [PATCH 3/3] Fix some documentation --- python/ctsm/git_utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/ctsm/git_utils.py b/python/ctsm/git_utils.py index 74f5a8af4b..1764103c73 100644 --- a/python/ctsm/git_utils.py +++ b/python/ctsm/git_utils.py @@ -9,7 +9,7 @@ def get_ctsm_git_short_hash(): """ - Returns Git short SHA for the currect directory. + Returns Git short SHA for the CTSM repository. Args: @@ -30,7 +30,7 @@ def get_ctsm_git_short_hash(): def get_ctsm_git_long_hash(): """ - Returns Git long SHA for the currect directory. + Returns Git long SHA for the CTSM repository. Args: @@ -49,14 +49,14 @@ def get_ctsm_git_long_hash(): def get_ctsm_git_describe(): """ - Function for giving the recent tag of the git repo + Function for giving the recent tag of the CTSM repository Args: Raises: Returns: - label (str) : ouput of running 'git describe' in shell + label (str) : ouput of running 'git describe' for the CTSM repository """ label = ( subprocess.check_output(["git", "-C", path_to_ctsm_root(), "describe"])