From 90ca8afdc1d4a0f67bd6e86fda365a35d924494d Mon Sep 17 00:00:00 2001 From: Ana Ordonez Date: Thu, 11 Mar 2021 10:46:07 -0800 Subject: [PATCH 1/2] add cmec flag support --- .../monsoon_wang/monsoon_wang_driver.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pcmdi_metrics/monsoon_wang/monsoon_wang_driver.py b/pcmdi_metrics/monsoon_wang/monsoon_wang_driver.py index 4ddf0968b..85e0d335b 100644 --- a/pcmdi_metrics/monsoon_wang/monsoon_wang_driver.py +++ b/pcmdi_metrics/monsoon_wang/monsoon_wang_driver.py @@ -47,7 +47,17 @@ def create_monsoon_wang_parser(): default=2.5 / 86400., type=float, help="Threshold for a hit when computing skill score") - + P.add_argument("--cmec", + dest="cmec", + default=False, + action="store_true", + help="Use to save CMEC format metrics JSON") + P.add_argument("--no_cmec", + dest="cmec", + default=False, + action="store_false", + help="Do not save CMEC format metrics JSON") + P.set_defaults(cmec=False) return P @@ -71,6 +81,9 @@ def monsoon_wang_runner(args): thr = args.threshold sig_digits = '.3f' + # Get flag for CMEC output + cmec = args.cmec + ######################################### # PMP monthly default PR obs cdms2.axis.longitude_aliases.append("longitude_prclim_mpd") @@ -226,3 +239,6 @@ def monsoon_wang_runner(args): separators=( ',', ': ')) + if cmec: + print("Writing cmec file") + OUT.write_cmec(indent=4, separators=(',', ': ')) From 2b1a12714927e5425d1bef1ad17bf4ace9a0ef49 Mon Sep 17 00:00:00 2001 From: Ana Ordonez Date: Fri, 12 Mar 2021 11:13:27 -0800 Subject: [PATCH 2/2] fix indentation --- .../monsoon_wang/monsoon_wang_driver.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pcmdi_metrics/monsoon_wang/monsoon_wang_driver.py b/pcmdi_metrics/monsoon_wang/monsoon_wang_driver.py index 85e0d335b..4956d215f 100644 --- a/pcmdi_metrics/monsoon_wang/monsoon_wang_driver.py +++ b/pcmdi_metrics/monsoon_wang/monsoon_wang_driver.py @@ -48,15 +48,15 @@ def create_monsoon_wang_parser(): type=float, help="Threshold for a hit when computing skill score") P.add_argument("--cmec", - dest="cmec", - default=False, - action="store_true", - help="Use to save CMEC format metrics JSON") + dest="cmec", + default=False, + action="store_true", + help="Use to save CMEC format metrics JSON") P.add_argument("--no_cmec", - dest="cmec", - default=False, - action="store_false", - help="Do not save CMEC format metrics JSON") + dest="cmec", + default=False, + action="store_false", + help="Do not save CMEC format metrics JSON") P.set_defaults(cmec=False) return P