From 78c19b281ac681d0437b83410f94546326e2ed46 Mon Sep 17 00:00:00 2001 From: arbennett Date: Mon, 18 May 2020 11:49:49 -0700 Subject: [PATCH 1/6] Fix #219 --- metsim/cli/ms.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/metsim/cli/ms.py b/metsim/cli/ms.py index 65df719..899ce6a 100755 --- a/metsim/cli/ms.py +++ b/metsim/cli/ms.py @@ -83,6 +83,12 @@ def to_list(s): else: forcing_files = conf['forcing'] + if 'utc_offset' in conf.keys() and conf['utc_offset'].strip() == 'True': + conf['utc_offset'] = True + else: + conf['utc_offset'] = False + + # Update the full configuration conf.update({"calendar": conf.get('calendar', 'standard'), "scheduler": opts.scheduler, From 265b0610fa300fec4ac53384f8ce88e067e736b1 Mon Sep 17 00:00:00 2001 From: arbennett Date: Mon, 18 May 2020 11:59:45 -0700 Subject: [PATCH 2/6] Add whats new --- docs/whats-new.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/whats-new.rst b/docs/whats-new.rst index ec8cf6c..65a8ad2 100644 --- a/docs/whats-new.rst +++ b/docs/whats-new.rst @@ -5,6 +5,13 @@ What's New .. _whats-new.2.2.0: +v2.2.2 +------- +Bug fixes +~~~~~~~~~ +- Fixed bug where `utc_offset` doesn't get converted to the + correct boolean when reading the configuration. + v2.2.l ------ Bug fixes From 3e40a9af9a6405367537f22d2c17570a205ffb5e Mon Sep 17 00:00:00 2001 From: arbennett Date: Mon, 18 May 2020 12:00:55 -0700 Subject: [PATCH 3/6] Remove line --- metsim/cli/ms.py | 1 - 1 file changed, 1 deletion(-) diff --git a/metsim/cli/ms.py b/metsim/cli/ms.py index 899ce6a..6fad1ad 100755 --- a/metsim/cli/ms.py +++ b/metsim/cli/ms.py @@ -88,7 +88,6 @@ def to_list(s): else: conf['utc_offset'] = False - # Update the full configuration conf.update({"calendar": conf.get('calendar', 'standard'), "scheduler": opts.scheduler, From e0716a01c4940039c38418d1ef677735f3a00821 Mon Sep 17 00:00:00 2001 From: arbennett Date: Mon, 18 May 2020 12:06:36 -0700 Subject: [PATCH 4/6] Address review --- metsim/cli/ms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metsim/cli/ms.py b/metsim/cli/ms.py index 6fad1ad..3bbdc0a 100755 --- a/metsim/cli/ms.py +++ b/metsim/cli/ms.py @@ -83,7 +83,8 @@ def to_list(s): else: forcing_files = conf['forcing'] - if 'utc_offset' in conf.keys() and conf['utc_offset'].strip() == 'True': + if ('utc_offset' in conf.keys() + and conf['utc_offset'].strip().lower() == 'true'): conf['utc_offset'] = True else: conf['utc_offset'] = False From 6fa46b4b277811955c5414a57abe7639b4d4247c Mon Sep 17 00:00:00 2001 From: Andrew Bennett Date: Mon, 18 May 2020 12:16:26 -0700 Subject: [PATCH 5/6] Fix #219 (#220) * Fix #219 * Add whats new * Remove line * Address review --- docs/whats-new.rst | 7 +++++++ metsim/cli/ms.py | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/docs/whats-new.rst b/docs/whats-new.rst index ec8cf6c..65a8ad2 100644 --- a/docs/whats-new.rst +++ b/docs/whats-new.rst @@ -5,6 +5,13 @@ What's New .. _whats-new.2.2.0: +v2.2.2 +------- +Bug fixes +~~~~~~~~~ +- Fixed bug where `utc_offset` doesn't get converted to the + correct boolean when reading the configuration. + v2.2.l ------ Bug fixes diff --git a/metsim/cli/ms.py b/metsim/cli/ms.py index 65df719..3bbdc0a 100755 --- a/metsim/cli/ms.py +++ b/metsim/cli/ms.py @@ -83,6 +83,12 @@ def to_list(s): else: forcing_files = conf['forcing'] + if ('utc_offset' in conf.keys() + and conf['utc_offset'].strip().lower() == 'true'): + conf['utc_offset'] = True + else: + conf['utc_offset'] = False + # Update the full configuration conf.update({"calendar": conf.get('calendar', 'standard'), "scheduler": opts.scheduler, From 4d18b472385ecedac970047dc144d173be2cdd2c Mon Sep 17 00:00:00 2001 From: arbennett Date: Mon, 18 May 2020 12:59:31 -0700 Subject: [PATCH 6/6] Make fix general for all boolean valued params --- metsim/cli/ms.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/metsim/cli/ms.py b/metsim/cli/ms.py index 3bbdc0a..c50b5e2 100755 --- a/metsim/cli/ms.py +++ b/metsim/cli/ms.py @@ -83,11 +83,13 @@ def to_list(s): else: forcing_files = conf['forcing'] - if ('utc_offset' in conf.keys() - and conf['utc_offset'].strip().lower() == 'true'): - conf['utc_offset'] = True - else: - conf['utc_offset'] = False + # Ensure that parameters with boolean values are correctly recorded + for bool_param in ['utc_offset', 'period_ending']: + if (bool_param in conf.keys() + and conf[bool_param].strip().lower() == 'true'): + conf[bool_param] = True + else: + conf[bool_param] = False # Update the full configuration conf.update({"calendar": conf.get('calendar', 'standard'),