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

Make the exception that the Dataset class throws more descriptive

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.2-incubating
    • 0.3-incubating
    • data sources, general
    • None
    • OS X

    Description

      When a new Dataset Object is initialized the parameters that are required (4 total) are all checked individually as well as together, and if any of these tests fail a ValueError is raised with the following message to the user:
      "Dataset given improperly shaped array during initialization."

      I would like to try and make that error message more specific about which one of the checks raised the error.

      Example Messages:
      --------------------------------

      • Longitude Array is not 1 dimension
      • Latitude Array is not 1 dimension
      • Times Array is not 1 dimension
      • Times Array doesn't contain datetime objects
      • Values Arrays is not 3 dimensional
      • Values Array is out of order. Expected (times, lat, lon) but got ([what ever we discovered] lon, times, lat)

      To some people this amount of check and rigor might seem overkill, but I think this is necessary since the rest of the OCW code depends on have a properly formed OCW Dataset object to work with.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Time Spent - 1.5h Remaining Estimate - 0.5h
                0.5h
                Logged:
                Time Spent - 1.5h Remaining Estimate - 0.5h
                1.5h