You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2014/02/23 05:45:46 UTC

svn commit: r1570979 - in /incubator/climate/trunk/ocw-ui/backend: processing.py tests/test_processing.py

Author: joyce
Date: Sun Feb 23 04:45:46 2014
New Revision: 1570979

URL: http://svn.apache.org/r1570979
Log:
CLIMATE-332 - Add Subsetting to evaluation

- Add subsetting after temporal rebinning is done. Note, this has to be
  done after temporal rebinning. That doesn't seem correct, but it is
  necessary at the moment.

Modified:
    incubator/climate/trunk/ocw-ui/backend/processing.py
    incubator/climate/trunk/ocw-ui/backend/tests/test_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=1570979&r1=1570978&r2=1570979&view=diff
==============================================================================
--- incubator/climate/trunk/ocw-ui/backend/processing.py (original)
+++ incubator/climate/trunk/ocw-ui/backend/processing.py Sun Feb 23 04:45:46 2014
@@ -131,9 +131,14 @@ def run_evaluation():
     target_datasets = [_process_dataset_object(obj, eval_bounds)
 					   for obj
 					   in data['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
+					   in target_datasets]
 
-    # TODO, Need to subset here! At the moment the start/end times aren't
-    # being used to subset.
+    # Subset the datasets
     subset = Bounds(eval_bounds['lat_min'],
                     eval_bounds['lat_max'],
                     eval_bounds['lon_min'],
@@ -141,13 +146,12 @@ def run_evaluation():
                     eval_bounds['start_time'],
                     eval_bounds['end_time'])
 
-    # 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)
+    ref_dataset = dsp.subset(subset, ref_dataset)
+    target_datasets = [dsp.subset(subset, ds)
 					   for ds
 					   in target_datasets]
 
+
     # Do spatial re=bin based off of reference dataset + lat/lon steps
     lat_step = data['spatial_rebin_lat_step']
     lon_step = data['spatial_rebin_lon_step']

Modified: incubator/climate/trunk/ocw-ui/backend/tests/test_processing.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw-ui/backend/tests/test_processing.py?rev=1570979&r1=1570978&r2=1570979&view=diff
==============================================================================
--- incubator/climate/trunk/ocw-ui/backend/tests/test_processing.py (original)
+++ incubator/climate/trunk/ocw-ui/backend/tests/test_processing.py Sun Feb 23 04:45:46 2014
@@ -291,12 +291,13 @@ class TestRunEvaluation(unittest.TestCas
             'metrics': ['Bias'],
             'start_time': '1989-01-01 00:00:00',
             'end_time': '2008-01-01 00:00:00',
-            'lat_min': -45.759998,
-            'lat_max': 42.240002,
-            'lon_min': -24.639999,
-            'lon_max': 60.279999,
+            'lat_min': -45.0,
+            'lat_max': 42.0,
+            'lon_min': -24.0,
+            'lon_max': 60.0,
             'subregion_information': None
         }
+
         test_app.post_json('/processing/run_evaluation/', data)
         result_dirs = [x for x in os.listdir(WORK_DIR)
                        if os.path.isdir(os.path.join(WORK_DIR, x))]