climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1573259 - /incubator/climate/trunk/ocw-ui/backend/processing.py
Date Sun, 02 Mar 2014 06:22:09 GMT
Author: joyce
Date: Sun Mar  2 06:22:08 2014
New Revision: 1573259

URL: http://svn.apache.org/r1573259
Log:
CLIMATE-361 - Normalize datetime values in UI evaluation

Modified:
    incubator/climate/trunk/ocw-ui/backend/processing.py

Modified: incubator/climate/trunk/ocw-ui/backend/processing.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw-ui/backend/processing.py?rev=1573259&r1=1573258&r2=1573259&view=diff
==============================================================================
--- incubator/climate/trunk/ocw-ui/backend/processing.py (original)
+++ incubator/climate/trunk/ocw-ui/backend/processing.py Sun Mar  2 06:22:08 2014
@@ -139,8 +139,17 @@ def run_evaluation():
 					   for obj
 					   in data['target_datasets']]
 
+    # Normalize the dataset time values so they break on consistent days of the
+    # month or time of the day, depending on how they will be rebinned.
+    resolution = data['temporal_resolution']
+    time_delta = timedelta(days=resolution)
+
+    time_step = 'daily' if resolution <= 31 else 'monthly'
+    ref_dataset = dsp.normalize_dataset_datetimes(ref_dataset, time_step)
+    target_datasets = [dsp.normalize_dataset_datetimes(ds, time_step)
+                       for ds in target_datasets]
+
     # Do temporal re-bin based off of passed resolution
-    time_delta = timedelta(days=data['temporal_resolution'])
     ref_dataset = dsp.temporal_rebin(ref_dataset, time_delta)
     target_datasets = [dsp.temporal_rebin(ds, time_delta)
 					   for ds



Mime
View raw message