From 6afc1df22754a2033760ea9dcb1c8bb4242018d7 Mon Sep 17 00:00:00 2001 From: Charles Doutriaux Date: Thu, 21 Apr 2016 17:26:09 -0700 Subject: [PATCH 1/5] added option for dry run which means no computations (just read in data) fix #320 --- .../pcmdi/scripts/pcmdi_metrics_driver.py | 100 ++++++++++-------- 1 file changed, 55 insertions(+), 45 deletions(-) diff --git a/src/python/pcmdi/scripts/pcmdi_metrics_driver.py b/src/python/pcmdi/scripts/pcmdi_metrics_driver.py index 6dc19a53b..7692297d7 100755 --- a/src/python/pcmdi/scripts/pcmdi_metrics_driver.py +++ b/src/python/pcmdi/scripts/pcmdi_metrics_driver.py @@ -76,6 +76,12 @@ def applyCustomKeys(O, custom_dict, var): default="input_parameters.py", help="input parameter file containing local settings", required=True) +P.add_argument( + "-d", + "--dry-run", + action="store_true", + default=False, + help="Do not run calculations, but check that everything should go smoothly") args = P.parse_args(sys.argv[1:]) @@ -337,7 +343,7 @@ def applyCustomKeys(O, custom_dict, var): else: do = OBS.get(var) except Exception as err: - dup('failed with 4D OBS', var, ref, err) + dup('failed reading OBS', var, ref, err) continue grd["GridResolution"] = do.shape[1:] metrics_dictionary["GridInfo"] = grd @@ -563,46 +569,47 @@ def applyCustomKeys(O, custom_dict, var): get( parameters.realization, {}) - pr_rgn = pcmdi_metrics.pcmdi.compute_metrics( - Var, - dm, - do) - # Calling compute metrics with None for model and - # obs, triggers it to send back the defs. - metrics_def_dictionary.update( - pcmdi_metrics.pcmdi.compute_metrics( - Var, - None, - None)) - ################################################### - # The follwoing allow users to plug in a set of - # custom metrics - # Function needs to take in var name, - # model clim, obs clim - ################################################### - if hasattr(parameters, "compute_custom_metrics"): - pr_rgn.update( - parameters.compute_custom_metrics( + if not args.dry_run: + pr_rgn = pcmdi_metrics.pcmdi.compute_metrics( Var, dm, - do)) - # Calling compute metrics with None - # for model and - # obs, triggers it to send back the defs. - # But we are wrapping this in an except/try in - # case user did not implement - try: + do) + # Calling compute metrics with None for model and + # obs, triggers it to send back the defs. metrics_def_dictionary.update( - parameters.compute_custom_metrics( + pcmdi_metrics.pcmdi.compute_metrics( Var, None, None)) - except: - # Better than nothing we will use the doc - # string - metrics_def_dictionary.update( - {"custom": parameters. - compute_custom_metrics.__doc__}) + ################################################### + # The follwoing allow users to plug in a set of + # custom metrics + # Function needs to take in var name, + # model clim, obs clim + ################################################### + if hasattr(parameters, "compute_custom_metrics"): + pr_rgn.update( + parameters.compute_custom_metrics( + Var, + dm, + do)) + # Calling compute metrics with None + # for model and + # obs, triggers it to send back the defs. + # But we are wrapping this in an except/try in + # case user did not implement + try: + metrics_def_dictionary.update( + parameters.compute_custom_metrics( + Var, + None, + None)) + except: + # Better than nothing we will use the doc + # string + metrics_def_dictionary.update( + {"custom": parameters. + compute_custom_metrics.__doc__}) pr[region_name] = collections.OrderedDict( (k, pr_rgn[k]) for k in sorted( @@ -613,7 +620,7 @@ def applyCustomKeys(O, custom_dict, var): # OUTPUT INTERPOLATED MODEL CLIMATOLOGIES # Only the first time thru an obs set (always the # same after) - if parameters.save_mod_clims and ref == refs[0]: + if not args.dry_run and parameters.save_mod_clims and ref == refs[0]: CLIM = pcmdi_metrics.io.base.Base( parameters. model_clims_interpolated_output + @@ -651,14 +658,17 @@ def applyCustomKeys(O, custom_dict, var): # that it is stored metrics_dictionary["METRICS"] = metrics_def_dictionary # OUTPUT RESULTS IN PYTHON DICTIONARY TO BOTH JSON AND ASCII FILES - OUT.write( - metrics_dictionary, - mode="w", - indent=4, - separators=( - ',', - ': ')) - # CREATE OUTPUT AS ASCII FILE - OUT.write(metrics_dictionary, mode="w", type="txt") + if not args.dry_run: + OUT.write( + metrics_dictionary, + mode="w", + indent=4, + separators=( + ',', + ': ')) + # CREATE OUTPUT AS ASCII FILE + OUT.write(metrics_dictionary, mode="w", type="txt") except Exception as err: dup("Error while processing variable %s:\n\t%s" % (var, err)) + +print "Done. Check log at: ",Efile.name From bc47b1bcfdd294da22c44c5a6c8992bb5867f364 Mon Sep 17 00:00:00 2001 From: Charles Doutriaux Date: Thu, 21 Apr 2016 17:27:53 -0700 Subject: [PATCH 2/5] pep8ed --- .../pcmdi/scripts/pcmdi_metrics_driver.py | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/python/pcmdi/scripts/pcmdi_metrics_driver.py b/src/python/pcmdi/scripts/pcmdi_metrics_driver.py index 7692297d7..bc5329c11 100755 --- a/src/python/pcmdi/scripts/pcmdi_metrics_driver.py +++ b/src/python/pcmdi/scripts/pcmdi_metrics_driver.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -###################################################### +# # # USER INPUT IS SET IN FILE "input_parameters.py" # Identified via --parameters key at startup # -###################################################### +# import pcmdi_metrics import sys import argparse @@ -18,8 +18,8 @@ import collections import cdat_info -## Statistical tracker -cdat_info.pingPCMDIdb("pcmdi_metrics","pcmdi_metrics_driver") +# Statistical tracker +cdat_info.pingPCMDIdb("pcmdi_metrics", "pcmdi_metrics_driver") # Before we do anything else we need to create some units # Salinity Units @@ -77,7 +77,7 @@ def applyCustomKeys(O, custom_dict, var): help="input parameter file containing local settings", required=True) P.add_argument( - "-d", + "-d", "--dry-run", action="store_true", default=False, @@ -460,9 +460,9 @@ def applyCustomKeys(O, custom_dict, var): do.shape, ' ', ref) - ################################################### + # # Basic checks - ################################################### + # if dm.shape != do.shape: raise RuntimeError( "Obs and Model -%s- have different" % model_version + @@ -483,14 +483,14 @@ def applyCustomKeys(O, custom_dict, var): "Could not convert model units (%s) " % dm.units + "to obs units: (%s)" % (do.units)) - ################################################### + # # OBS INFO FOR JSON/ASCII FILES - ################################################### + # onm = obs_dic[var][ref] - ################################################### + # # METRICS CALCULATIONS - ################################################### + # metrics_dictionary[model_version] = \ metrics_dictionary.get( model_version, @@ -581,12 +581,12 @@ def applyCustomKeys(O, custom_dict, var): Var, None, None)) - ################################################### + # # The follwoing allow users to plug in a set of # custom metrics # Function needs to take in var name, # model clim, obs clim - ################################################### + # if hasattr(parameters, "compute_custom_metrics"): pr_rgn.update( parameters.compute_custom_metrics( @@ -671,4 +671,4 @@ def applyCustomKeys(O, custom_dict, var): except Exception as err: dup("Error while processing variable %s:\n\t%s" % (var, err)) -print "Done. Check log at: ",Efile.name +print "Done. Check log at: ", Efile.name From b532f8bc8746f44f624fc37fa1c32de42d7ce357 Mon Sep 17 00:00:00 2001 From: Charles Doutriaux Date: Tue, 19 Jul 2016 15:11:58 -0700 Subject: [PATCH 3/5] printing test name --- test/test_flake8.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test_flake8.py b/test/test_flake8.py index c4216c016..b7be45387 100644 --- a/test/test_flake8.py +++ b/test/test_flake8.py @@ -13,6 +13,18 @@ def flake8(self): pth = os.path.dirname(__file__) pth = os.path.join(pth, "..") pth = os.path.abspath(pth) + pth = os.path.join(pth,"src") + print + print + print + print + print "---------------------------------------------------" + print "RUNNING: flake8 on directory %s" % pth + print "---------------------------------------------------" + print + print + print + print P = subprocess.Popen(shlex.split("flake8 --max-line-length=120 %s" % pth), stdin=subprocess.PIPE, stdout=subprocess.PIPE, From 6b5d35a8d2d2946337d97ce699c5606c4f067b90 Mon Sep 17 00:00:00 2001 From: Charles Doutriaux Date: Tue, 19 Jul 2016 15:13:03 -0700 Subject: [PATCH 4/5] io/base pep8 --- src/python/io/base.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/python/io/base.py b/src/python/io/base.py index fdf901048..80c5d777e 100644 --- a/src/python/io/base.py +++ b/src/python/io/base.py @@ -14,12 +14,16 @@ # where value is a integer between 0 and 9 included cdms2.setNetcdfDeflateLevelFlag(value) -#cdutil region object need a serializer +# cdutil region object need a serializer + + class CDMSDomainsEncoder(json.JSONEncoder): + def default(self, o): cmp = o.components()[0].kargs - args=",".join(["%s=%s" % (k,v) for k,v in cmp.iteritems()]) - return {o.id:"cdutil.region.domain(%s)"%args} + args = ",".join(["%s=%s" % (k, v) for k, v in cmp.iteritems()]) + return {o.id: "cdutil.region.domain(%s)" % args} + class Base(genutil.StringConstructor): @@ -47,11 +51,14 @@ def get(self, var, varInFile=None, region={}, *args, **kargs): f.close() # Now are we masking anything? - value = region.get("value",None) + value = region.get("value", None) if value is not None: # Indeed we are if self.mask is None: if isinstance(self.file_mask_template, basestring): - self.file_mask_template = Base(self.root,self.file_mask_template,{"domain":region.get("domain",None)}) + self.file_mask_template = Base( + self.root, self.file_mask_template, { + "domain": region.get( + "domain", None)}) try: oMask = self.file_mask_template.get("sftlf") # ok that failed falling back on autogenerate @@ -70,7 +77,7 @@ def get(self, var, varInFile=None, region={}, *args, **kargs): dum, msk = genutil.grower(out, self.mask) else: msk = self.mask - msk = MV2.not_equal(msk,value) + msk = MV2.not_equal(msk, value) out = MV2.masked_where(msk, out) if self.targetGrid is not None: out = out.regrid( @@ -87,15 +94,15 @@ def get(self, var, varInFile=None, region={}, *args, **kargs): msk = self.targetMask out = MV2.masked_where(msk, out) # Now are we looking at a region in particular? - domain = region.get("domain",None) - if domain is not None: # Ok we are subsetting - if isinstance(domain,dict): - out=out(**domain) - elif isinstance(domain,(list,tuple)): - out=out(*domain) - elif isinstance(domain,cdms2.selectors.Selector): - domain.id=region.get("id","region") - out=out(*[domain]) + domain = region.get("domain", None) + if domain is not None: # Ok we are subsetting + if isinstance(domain, dict): + out = out(**domain) + elif isinstance(domain, (list, tuple)): + out = out(*domain) + elif isinstance(domain, cdms2.selectors.Selector): + domain.id = region.get("id", "region") + out = out(*[domain]) return out def setTargetGrid(self, target, regridTool="esmf", regridMethod="linear"): @@ -132,7 +139,7 @@ def write(self, data, type="json", mode="w", *args, **kargs): data["uvcdat_version"] = cdat_info.get_version() json.dump(data, f, cls=CDMSDomainsEncoder, *args, **kargs) f.close() - print "Results saved to JSON file:",fnm + print "Results saved to JSON file:", fnm elif type.lower() in ["asc", "ascii", "txt"]: f = open(fnm, mode) for k in data.keys(): From 29726e3489508ad0487a50f75c04d7e0085c5e7a Mon Sep 17 00:00:00 2001 From: Charles Doutriaux Date: Tue, 19 Jul 2016 15:32:40 -0700 Subject: [PATCH 5/5] pep8ed and put flae8 back in suite --- src/python/graphics/portraits.py | 3 +- src/python/io/base.py | 3 - src/python/pcmdi/io.py | 2 +- .../scripts/build_obs_meta_dictionary.py | 2 +- .../pcmdi/scripts/pcmdi_metrics_driver.py | 101 +++++++++--------- src/python/pcmdi/seasonal_mean.py | 3 +- test/graphics/test_portrait.py | 11 ++ 7 files changed, 68 insertions(+), 57 deletions(-) diff --git a/src/python/graphics/portraits.py b/src/python/graphics/portraits.py index f59c02bdc..5bccfcf42 100644 --- a/src/python/graphics/portraits.py +++ b/src/python/graphics/portraits.py @@ -1025,8 +1025,7 @@ def plot(self, data=None, mesh=None, template=None, None, self.PLOT_SETTINGS.parameterorientation.name) value = getattr(self, p) - if (isinstance(value, (list, tuple)) - and len(value) == 1): + if (isinstance(value, (list, tuple)) and len(value) == 1): txt.string = p + ':' + \ str(self.makestring(p, value[0])) display = 1 diff --git a/src/python/io/base.py b/src/python/io/base.py index 80c5d777e..162a6d582 100644 --- a/src/python/io/base.py +++ b/src/python/io/base.py @@ -63,9 +63,6 @@ def get(self, var, varInFile=None, region={}, *args, **kargs): oMask = self.file_mask_template.get("sftlf") # ok that failed falling back on autogenerate except: - #dup.tb = args.traceback - #dup("Could not find obs mask, generating") - #dup.tb = False oMask = cdutil.generateLandSeaMask( out, regridTool=self.regridTool).filled(1.) * 100. diff --git a/src/python/pcmdi/io.py b/src/python/pcmdi/io.py index 62634c94a..950001140 100644 --- a/src/python/pcmdi/io.py +++ b/src/python/pcmdi/io.py @@ -7,7 +7,7 @@ def __init__(self, root, var, obs_dic, reference="default", file_mask_template=N template = "%(realm)/%(frequency)/%(variable)/" +\ "%(reference)/%(ac)/%(filename)" - pcmdi_metrics.io.base.Base.__init__(self, root, template,file_mask_template) + pcmdi_metrics.io.base.Base.__init__(self, root, template, file_mask_template) obs_name = obs_dic[var][reference] # usually send "default", "alternate", etc # but some case (sftlf) we send the actual name diff --git a/src/python/pcmdi/scripts/build_obs_meta_dictionary.py b/src/python/pcmdi/scripts/build_obs_meta_dictionary.py index 6fbcecb8c..aee8c6ab3 100644 --- a/src/python/pcmdi/scripts/build_obs_meta_dictionary.py +++ b/src/python/pcmdi/scripts/build_obs_meta_dictionary.py @@ -23,7 +23,7 @@ # FOR MONTHLY MEAN OBS obs_dic_in = {'rlut': {'default': 'CERES'}, 'rst': {'default': 'CERES'}, - 'rsut':{'default':'CERES'}, + 'rsut': {'default': 'CERES'}, 'rsds': {'default': 'CERES', }, 'rlds': {'default': 'CERES', }, 'rsdt': {'default': 'CERES', }, diff --git a/src/python/pcmdi/scripts/pcmdi_metrics_driver.py b/src/python/pcmdi/scripts/pcmdi_metrics_driver.py index a76b65f4c..c174d54e6 100755 --- a/src/python/pcmdi/scripts/pcmdi_metrics_driver.py +++ b/src/python/pcmdi/scripts/pcmdi_metrics_driver.py @@ -17,13 +17,13 @@ import cdutil import collections import cdat_info +import unidata # Statistical tracker cdat_info.pingPCMDIdb("pcmdi_metrics", "pcmdi_metrics_driver") # Before we do anything else we need to create some units # Salinity Units -import unidata unidata.udunits_wrap.init() # Create a dimensionless units named dimless @@ -34,7 +34,10 @@ unidata.addScaledUnit("PSS-78", .001, "dimless") unidata.addScaledUnit("Practical Salinity Scale 78", .001, "dimless") -execfile(sys.prefix+"/share/pcmdi/default_regions.py") +# Following are actually created in excfile bit, this is to make flae8 happy +regions_specs = {} +default_regions = [] +execfile(sys.prefix + "/share/pcmdi/default_regions.py") # Load the obs dictionary fjson = open( @@ -50,6 +53,7 @@ obs_dic = json.loads(fjson.read()) fjson.close() + class DUP(object): def __init__(self, outfile): @@ -67,13 +71,12 @@ def __call__(self, *args): traceback.print_tb(exc_traceback) print "<<<<<<<<<<<< END TRACEBACK >>>>>>>>>>>>>>>>>>" print>>self.outfile, "<<<<<<<<<<<< BEG TRACEBACK >>>>>>>>>>>>>>>>>>" - traceback.print_tb(exc_traceback,file=self.outfile) + traceback.print_tb(exc_traceback, file=self.outfile) print>>self.outfile, "<<<<<<<<<<<< END TRACEBACK >>>>>>>>>>>>>>>>>>" print msg print>>self.outfile, msg - def applyCustomKeys(O, custom_dict, var): for k, v in custom_dict.iteritems(): key = custom_dict[k] @@ -92,16 +95,16 @@ def applyCustomKeys(O, custom_dict, var): required=True) P.add_argument( "-d", - "--dry-run", - action="store_true", - default=False, - help="Do not run calculations, but check that everything should go smoothly") + "--dry-run", + action="store_true", + default=False, + help="Do not run calculations, but check that everything should go smoothly") P.add_argument("-t", - "--traceback", - default=False, - action="store_true", - help="Print traceback on errors (helps developers to debug)") + "--traceback", + default=False, + action="store_true", + help="Print traceback on errors (helps developers to debug)") args = P.parse_args(sys.argv[1:]) @@ -129,7 +132,7 @@ def applyCustomKeys(O, custom_dict, var): sys.path.pop(-1) # Checks a few things on the parameter file -if not hasattr(parameters,"metrics_output_path"): +if not hasattr(parameters, "metrics_output_path"): raise RuntimeError("Your parameter file does not define the output_path, please define 'metrics_output_path'") # Checking if we have custom obs to add @@ -172,19 +175,20 @@ def applyCustomKeys(O, custom_dict, var): # Loads a few default, that "should" be overwritten by parameter file # But in case they're not defined in parameter file then # The code will keep running happily -if getattr(parameters,"save_mod_clims",False): - if not hasattr(parameters,"model_clims_interpolated_output"): +if getattr(parameters, "save_mod_clims", False): + if not hasattr(parameters, "model_clims_interpolated_output"): parameters.model_clims_interpolated_output = model_clims_interpolated_output = os.path.join( - parameters.metrics_output_path, - 'interpolated_model_clims') - dup("WARNING: Your parameter file asks to save interpolated model climatologies, but did not define a path for this\n"+\ - "We set 'model_clims_interpolated_output' to %s for you" % parameters.model_clims_interpolated_output) - if not hasattr(parameters,"filename_output_template"): + parameters.metrics_output_path, + 'interpolated_model_clims') + dup("WARNING: Your parameter file asks to save interpolated model climatologies," + + " but did not define a path for this\n" + + "We set 'model_clims_interpolated_output' to %s for you" % parameters.model_clims_interpolated_output) + if not hasattr(parameters, "filename_output_template"): parameters.filename_output_template = "%(variable)%(level)_%(model_version)_%(table)_" +\ - "%(realization)_%(period).interpolated.%(regridMethod).%(targetGridName)-clim%(ext)" - dup("WARNING: Your parameter file asks to save interpolated model climatologies, but did not define a name template for this\n"+\ - "We set 'filename_output_template' to %s for you" % parameters.filename_output_template) - + "%(realization)_%(period).interpolated.%(regridMethod).%(targetGridName)-clim%(ext)" + dup("WARNING: Your parameter file asks to save interpolated model climatologies, " + + "but did not define a name template for this\n" + + "We set 'filename_output_template' to %s for you" % parameters.filename_output_template) # First of all attempt to prepare sftlf before/after for all models @@ -238,11 +242,11 @@ def applyCustomKeys(O, custom_dict, var): # need to convert from old format regions_values to newer region_specs for reg in regions_values: - dic = {"value":regions_values[reg]} - if regions_specs.has_key(reg): + dic = {"value": regions_values[reg]} + if reg in regions_specs: regions_specs[reg].update(dic) else: - regions_specs[reg]=dic + regions_specs[reg] = dic # Update/overwrite default region_specs keys with user ones regions_specs.update(getattr(parameters, "regions_specs", {})) @@ -257,9 +261,9 @@ def applyCustomKeys(O, custom_dict, var): if None in rg: rg.remove(None) for r in default_regions: - rg.insert(0,r) + rg.insert(0, r) regions_dict[vr] = rg - + saved_obs_masks = {} disclaimer = open( @@ -340,11 +344,11 @@ def applyCustomKeys(O, custom_dict, var): region_name, regions_specs.get( region_name.lower())) - region["id"]=region_name + region["id"] = region_name elif region is None: region_name = "global" else: - raise Exception,"Unknown region %s" % region + raise Exception("Unknown region %s" % region) metrics_dictionary["RegionalMasking"][region_name] = region @@ -361,10 +365,10 @@ def applyCustomKeys(O, custom_dict, var): try: try: oMask = pcmdi_metrics.pcmdi.io.OBS( - parameters.obs_data_path, - "sftlf", - obs_dic, - obs_var_ref["RefName"]) + parameters.obs_data_path, + "sftlf", + obs_dic, + obs_var_ref["RefName"]) oMasknm = oMask() except: dup("couldn't figure out obs mask name from obs json file") @@ -393,17 +397,17 @@ def applyCustomKeys(O, custom_dict, var): OBS.case_id = case_id applyCustomKeys(OBS, parameters.custom_keys, var) if region is not None: - dup("REGION: %s" % region) - region_value = region.get("value",None) - if region_value is not None: - OBS.targetMask = MV2.not_equal( - sftlf["targetGrid"], - region_value) + dup("REGION: %s" % region) + region_value = region.get("value", None) + if region_value is not None: + OBS.targetMask = MV2.not_equal( + sftlf["targetGrid"], + region_value) try: if level is not None: do = OBS.get(var, level=level, region=region) else: - do = OBS.get(var,region=region) + do = OBS.get(var, region=region) except Exception as err: dup.tb = args.traceback if level is not None: @@ -462,7 +466,7 @@ def applyCustomKeys(O, custom_dict, var): var, var) if region is not None: - region_value = region.get("value",None) + region_value = region.get("value", None) if region_value is not None: if sftlf[model_version]["raw"] is None: if not hasattr( @@ -495,8 +499,8 @@ def applyCustomKeys(O, custom_dict, var): MODEL.mask = sftlf[model_version]["raw"] MODEL.targetMask = MV2.not_equal( - sftlf["targetGrid"], - region_value) + sftlf["targetGrid"], + region_value) try: if level is None: OUT.level = "" @@ -696,10 +700,11 @@ def applyCustomKeys(O, custom_dict, var): # OUTPUT INTERPOLATED MODEL CLIMATOLOGIES # Only the first time thru an obs set (always the # same after) - if not args.dry_run and hasattr(parameters,"save_mod_clims") and parameters.save_mod_clims is True and ref == refs[0]: + if not args.dry_run and hasattr(parameters, "save_mod_clims") and \ + parameters.save_mod_clims is True and ref == refs[0]: CLIM = pcmdi_metrics.io.base.Base( os.path.join(parameters. - model_clims_interpolated_output,region_name), + model_clims_interpolated_output, region_name), parameters.filename_output_template) CLIM.level = OUT.level CLIM.model_version = model_version @@ -745,4 +750,4 @@ def applyCustomKeys(O, custom_dict, var): dup.tb = args.traceback dup("Error while processing variable %s:\n\t%s" % (var, err)) dup.tb = False -dup("Done. Check log at: %s"% Efile.name) +dup("Done. Check log at: %s" % Efile.name) diff --git a/src/python/pcmdi/seasonal_mean.py b/src/python/pcmdi/seasonal_mean.py index a336b8412..c42b9dcb0 100644 --- a/src/python/pcmdi/seasonal_mean.py +++ b/src/python/pcmdi/seasonal_mean.py @@ -21,7 +21,6 @@ def compute(d, sea): sea_no_days = mo_wts[indx[0]] + mo_wts[indx[1]] + mo_wts[indx[2]] - d_sea = (d[indx[0]] * mo_wts[indx[0]] + d[indx[1]] - * mo_wts[indx[1]] + d[indx[2]] * mo_wts[indx[2]]) / sea_no_days + d_sea = (d[indx[0]] * mo_wts[indx[0]] + d[indx[1]] * mo_wts[indx[1]] + d[indx[2]] * mo_wts[indx[2]]) / sea_no_days return d_sea diff --git a/test/graphics/test_portrait.py b/test/graphics/test_portrait.py index 50990902f..f5a1385a2 100755 --- a/test/graphics/test_portrait.py +++ b/test/graphics/test_portrait.py @@ -36,6 +36,17 @@ def test_portrait(self): import sys import glob + print + print + print + print + print "---------------------------------------------------" + print "RUNNING: Portrait test" + print "---------------------------------------------------" + print + print + print + print # CREATES VCS OBJECT AS A PORTAIT PLOT AND LOADS PLOT SETTINGS FOR # EXAMPLE x = vcs.init()