climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1523009 - in /incubator/climate/trunk/ocw: dataset.py dataset_processor.py evaluation.py
Date Fri, 13 Sep 2013 16:57:38 GMT
Author: joyce
Date: Fri Sep 13 16:57:38 2013
New Revision: 1523009

URL: http://svn.apache.org/r1523009
Log:
CLIMATE-295 - Stop using root logger in OCW

- The dataset, dataset_processor, and evaluation module now use module
  specific loggers instead of the root logger. This is more inline with
  the recommended logging pattern in Python and it gives our logger
  names a good structure that mirrors the module hierarchy in the
  package.

Modified:
    incubator/climate/trunk/ocw/dataset.py
    incubator/climate/trunk/ocw/dataset_processor.py
    incubator/climate/trunk/ocw/evaluation.py

Modified: incubator/climate/trunk/ocw/dataset.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw/dataset.py?rev=1523009&r1=1523008&r2=1523009&view=diff
==============================================================================
--- incubator/climate/trunk/ocw/dataset.py (original)
+++ incubator/climate/trunk/ocw/dataset.py Fri Sep 13 16:57:38 2013
@@ -26,6 +26,8 @@ import numpy
 import logging
 import datetime as dt
 
+logger = logging.getLogger(__name__)
+
 class Dataset:
     '''Container for a dataset's attributes and data.'''
 
@@ -130,7 +132,7 @@ class Dataset:
                 "an unexpected value: " + str(num_days)
             )
 
-            logging.error(error)
+            logger.error(error)
             raise ValueError(error)
 
         return time_resolution

Modified: incubator/climate/trunk/ocw/dataset_processor.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw/dataset_processor.py?rev=1523009&r1=1523008&r2=1523009&view=diff
==============================================================================
--- incubator/climate/trunk/ocw/dataset_processor.py (original)
+++ incubator/climate/trunk/ocw/dataset_processor.py Fri Sep 13 16:57:38 2013
@@ -26,6 +26,8 @@ from scipy.ndimage import map_coordinate
 
 import logging
 
+logger = logging.getLogger(__name__)
+
 def temporal_rebin(target_dataset, temporal_resolution):
     """ Rebin a Dataset to a new temporal resolution
     
@@ -154,7 +156,7 @@ def subset(subregion, target_dataset):
             "dataset_processor.subset received a subregion that is not "
             "completely within the bounds of the target dataset."
         )
-        logging.error(error)
+        logger.error(error)
         raise ValueError(error)
 
     # Get subregion indices into subregion data

Modified: incubator/climate/trunk/ocw/evaluation.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw/evaluation.py?rev=1523009&r1=1523008&r2=1523009&view=diff
==============================================================================
--- incubator/climate/trunk/ocw/evaluation.py (original)
+++ incubator/climate/trunk/ocw/evaluation.py Fri Sep 13 16:57:38 2013
@@ -25,6 +25,8 @@ from metrics import Metric, UnaryMetric,
 from dataset import Dataset, Bounds
 import ocw.dataset_processor as DSP
 
+logger = logging.getLogger(__name__)
+
 class Evaluation(object):
     '''Container for running an evaluation
 
@@ -145,7 +147,7 @@ class Evaluation(object):
                 "Cannot add a dataset that isn't an instance of Dataset. "
                 "Please consult the documentation for additional help."
             )
-            logging.error(error)
+            logger.error(error)
             raise TypeError(error)
 
         self.target_datasets.append(target_dataset)
@@ -178,7 +180,7 @@ class Evaluation(object):
                 "Cannot add a metric that doesn't inherit from Metric. "
                 "Please consult the documentation for additional help."
             )
-            logging.error(error)
+            logger.error(error)
             raise TypeError(error)
 
         if isinstance(metric, UnaryMetric):
@@ -219,7 +221,7 @@ class Evaluation(object):
         '''
         if not self._evaluation_is_valid():
             error = "The evaluation is invalid. Check the docs for help."
-            logging.warning(error)
+            logger.warning(error)
             return
 
         if self._should_run_regular_metrics():



Mime
View raw message