You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by ja...@apache.org on 2016/07/28 14:15:00 UTC

[4/5] climate git commit: Normalize safe_subset function parameter ordering

Normalize safe_subset function parameter ordering


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/36452d3e
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/36452d3e
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/36452d3e

Branch: refs/heads/master
Commit: 36452d3ef2b9bd9dd5271a0004dbb714fc0d3f5a
Parents: 7e3cd37
Author: Ibrahim Jarif <ja...@gmail.com>
Authored: Tue Jul 26 13:19:27 2016 +0530
Committer: Ibrahim Jarif <ja...@gmail.com>
Committed: Thu Jul 28 19:42:56 2016 +0530

----------------------------------------------------------------------
 ocw-ui/backend/processing.py             | 4 ++--
 ocw/dataset_processor.py                 | 2 +-
 ocw/tests/test_dataset_processor.py      | 8 ++++----
 ocw_config_runner/evaluation_creation.py | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/36452d3e/ocw-ui/backend/processing.py
----------------------------------------------------------------------
diff --git a/ocw-ui/backend/processing.py b/ocw-ui/backend/processing.py
index e45b9c0..f925536 100644
--- a/ocw-ui/backend/processing.py
+++ b/ocw-ui/backend/processing.py
@@ -210,8 +210,8 @@ def run_evaluation():
                     start,
                     end)
 
-    ref_dataset = dsp.safe_subset(subset, ref_dataset)
-    target_datasets = [dsp.safe_subset(subset, ds)
+    ref_dataset = dsp.safe_subset(ref_dataset, subset)
+    target_datasets = [dsp.safe_subset(ds, subset)
                        for ds
                        in target_datasets]
     

http://git-wip-us.apache.org/repos/asf/climate/blob/36452d3e/ocw/dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py
index d9480e9..74536f0 100755
--- a/ocw/dataset_processor.py
+++ b/ocw/dataset_processor.py
@@ -483,7 +483,7 @@ def temporal_slice(target_dataset, start_time_index, end_time_index):
     return target_dataset
 
 
-def safe_subset(subregion, target_dataset, subregion_name=None):
+def safe_subset(target_dataset, subregion, subregion_name=None):
     '''Safely subset given dataset with subregion information
 
     A standard subset requires that the provided subregion be entirely

http://git-wip-us.apache.org/repos/asf/climate/blob/36452d3e/ocw/tests/test_dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/tests/test_dataset_processor.py b/ocw/tests/test_dataset_processor.py
index 6564d96..fcc967e 100644
--- a/ocw/tests/test_dataset_processor.py
+++ b/ocw/tests/test_dataset_processor.py
@@ -546,7 +546,7 @@ class TestSafeSubset(unittest.TestCase):
 
     def test_partial_spatial_overlap(self):
         '''Ensure that safe_subset can handle out of bounds spatial values'''
-        ds = dp.safe_subset(self.spatial_out_of_bounds, self.target_dataset)
+        ds = dp.safe_subset(self.target_dataset, self.spatial_out_of_bounds)
         spatial_bounds = ds.spatial_boundaries()
         self.assertEquals(spatial_bounds[0], -60)
         self.assertEquals(spatial_bounds[1], 60)
@@ -555,8 +555,8 @@ class TestSafeSubset(unittest.TestCase):
 
     def test_partial_temporal_overlap(self):
         '''Ensure that safe_subset can handle out of bounds temporal values'''
-        ds = dp.safe_subset(self.temporal_out_of_bounds, self.target_dataset)
-        temporal_bounds = ds.temporal_boundaries()
+        ds = dp.safe_subset(self.target_dataset, self.temporal_out_of_bounds)
+        temporal_bounds = ds.time_range()
         start = datetime.datetime(2000, 1, 1)
         end = datetime.datetime(2009, 12, 1)
 
@@ -564,7 +564,7 @@ class TestSafeSubset(unittest.TestCase):
         self.assertEquals(temporal_bounds[1], end)
 
     def test_entire_bounds_overlap(self):
-        ds = dp.safe_subset(self.everything_out_of_bounds, self.target_dataset)
+        ds = dp.safe_subset(self.target_dataset, self.everything_out_of_bounds)
         spatial_bounds = ds.spatial_boundaries()
         temporal_bounds = ds.temporal_boundaries()
         start = datetime.datetime(2000, 1, 1)

http://git-wip-us.apache.org/repos/asf/climate/blob/36452d3e/ocw_config_runner/evaluation_creation.py
----------------------------------------------------------------------
diff --git a/ocw_config_runner/evaluation_creation.py b/ocw_config_runner/evaluation_creation.py
index 88394de..5236957 100644
--- a/ocw_config_runner/evaluation_creation.py
+++ b/ocw_config_runner/evaluation_creation.py
@@ -129,10 +129,10 @@ def _prepare_datasets_for_evaluation(reference, targets, config_data):
         bounds = Bounds(subset[0], subset[1], subset[2], subset[3], start, end)
 
         if reference:
-            reference = dsp.safe_subset(bounds, reference)
+            reference = dsp.safe_subset(reference, bounds)
 
         if targets:
-            targets = [dsp.safe_subset(bounds, t) for t in targets]
+            targets = [dsp.safe_subset(t, bounds) for t in targets]
 
     if temporal_time_delta:
         resolution = timedelta(temporal_time_delta)