Uploaded image for project: 'Apache Open Climate Workbench (Retired)'
  1. Apache Open Climate Workbench (Retired)
  2. CLIMATE-168

Refactored Functions in metrics.py return a different number of variables

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 0.1-incubating
    • 0.1-incubating
    • analysis, metrics
    • None
    • OS X 10.7.4

    Description

      While testing the command line version of OCW i encountered the following error message:

      Traceback (most recent call last):
      File "rcmet.py", line 263, in <module>
      ui.rcmetUI()
      File "/Users/cgoodale/Desktop/climate-0.1-incubating-rc3/rcmet/src/main/python/rcmes/cli/rcmet_ui.py", line 100, in rcmetUI
      toolkit.metrics.metrics_plots(modelVarName, numOBS, numMDL, nT, ngrdY, ngrdX, Times, lons, lats, obsData, mdlData, obsList, mdlName, workDir, subRegions, fileOutputOption)
      File "/Users/cgoodale/Desktop/climate-0.1-incubating-rc3/rcmet/src/main/python/rcmes/toolkit/metrics.py", line 734, in metrics_plots
      mTser, mClim = calcAnnualCycleMeans(mdlData[mdlSelect, :, :, :])
      ValueError: too many values to unpack

      The core problem is that calcAnnualCycleMeans no longer returns a tuple of 2 values, instead it returns a single value. Python doesn't know how to handle this situation so the program crashes.

      Complete List of all Functions in this file that need attention:

      calcAnnualCycleMeans - returns 1 value (used to return 2)
      734 mTser, mClim = calcAnnualCycleMeans(mdlData[mdlSelect, :, :, :])
      735 oTser, oClim = calcAnnualCycleMeans(obsData[mdlSelect, :, :, :])
      These lines should also return a more meaningful/descriptive variable name and get updated throughout the rest of the code. My comments on variable names will be posted in the Comments section so we can discuss it.

      calcBiasAveragedOverTime - returns 1 value (used to return 2)
      754 metricDat, sigLev = calcBiasAveragedOverTime(mTser, oTser, 'abs')

      calcPatternCorrelationEachTime - Returns 2 values, but line 920 only expects 1
      Line 920: tempCOR = calcPatternCorrelationEachTime(mdlAnnCyc, obsAnnCyc)
      This one might be an easy fix by just adding back in the significanceLevel to this line.

      Attachments

        Activity

          People

            huikyole Huikyo Lee
            cgoodale Cameron Goodale
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: