climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From good...@apache.org
Subject [10/18] climate git commit: Normalize temporal_slice function parameter ordering
Date Fri, 29 Jul 2016 17:19:40 GMT
Normalize temporal_slice 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/7e3cd37b
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/7e3cd37b
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/7e3cd37b

Branch: refs/heads/CLIMATE-825
Commit: 7e3cd37b4532a91b652c989ecc01d571320890a5
Parents: fb5392f
Author: Ibrahim Jarif <jarifibrahim@gmail.com>
Authored: Tue Jul 26 13:14:49 2016 +0530
Committer: Ibrahim Jarif <jarifibrahim@gmail.com>
Committed: Thu Jul 28 19:41:09 2016 +0530

----------------------------------------------------------------------
 RCMES/cli_app.py                    |  3 ++-
 ocw/dataset_processor.py            |  4 ++--
 ocw/tests/test_dataset_processor.py | 12 ++++++------
 3 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/7e3cd37b/RCMES/cli_app.py
----------------------------------------------------------------------
diff --git a/RCMES/cli_app.py b/RCMES/cli_app.py
index 10ea6c4..9894a35 100644
--- a/RCMES/cli_app.py
+++ b/RCMES/cli_app.py
@@ -646,7 +646,8 @@ def run_screen(model_datasets, models_info, observations_info,
                   if each_target_dataset.lats.ndim !=2 and each_target_dataset.lons.ndim
!=2:
                       new_model_datasets[member] = dsp.subset(EVAL_BOUNDS, new_model_datasets[member])
                   else:
-                      new_model_datasets[member] = dsp.temporal_slice(EVAL_BOUNDS.start,
EVAL_BOUNDS.end, each_target_dataset)
+                      new_model_datasets[member] = dsp.temporal_slice(
+                        each_target_dataset, EVAL_BOUNDS.start, EVAL_BOUNDS.end)
              screen.addstr(5, 4, "--> Temporally regridded.")
              screen.refresh()
 

http://git-wip-us.apache.org/repos/asf/climate/blob/7e3cd37b/ocw/dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py
index 6702e54..d9480e9 100755
--- a/ocw/dataset_processor.py
+++ b/ocw/dataset_processor.py
@@ -395,7 +395,7 @@ def subset(target_dataset, subregion, subregion_name=None):
             target_dataset.times == subregion.start)[0][0]
         end_time_index = np.where(target_dataset.times == subregion.end)[0][0]
         target_dataset = temporal_slice(
-            start_time_index, end_time_index, target_dataset)
+            target_dataset, start_time_index, end_time_index)
         nt, ny, nx = target_dataset.values.shape
         y_index, x_index = np.where(
             (target_dataset.lats >= subregion.lat_max) | (
@@ -455,7 +455,7 @@ def subset(target_dataset, subregion, subregion_name=None):
         )
 
 
-def temporal_slice(start_time_index, end_time_index, target_dataset):
+def temporal_slice(target_dataset, start_time_index, end_time_index):
     '''Temporally slice given dataset(s) with subregion information. This does not
     spatially subset the target_Dataset
 

http://git-wip-us.apache.org/repos/asf/climate/blob/7e3cd37b/ocw/tests/test_dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/tests/test_dataset_processor.py b/ocw/tests/test_dataset_processor.py
index 3510463..6564d96 100644
--- a/ocw/tests/test_dataset_processor.py
+++ b/ocw/tests/test_dataset_processor.py
@@ -206,9 +206,9 @@ class TestTemporalSlice(unittest.TestCase):
         end_index = 4
         dates = np.array([datetime.datetime(2000, month, 1)
                           for month in range(start_index + 1, end_index + 2)])
-        new_dataset = dp.temporal_slice(start_index,
-                                        end_index,
-                                        self.ten_year_dataset)
+        new_dataset = dp.temporal_slice(self.ten_year_dataset,
+                                        start_index,
+                                        end_index)
         np.testing.assert_array_equal(new_dataset.times, dates)
 
     def test_returned_dataset_values(self):
@@ -217,9 +217,9 @@ class TestTemporalSlice(unittest.TestCase):
         start_index = 1
         end_index = 4
         values = self.ten_year_dataset.values[start_index:end_index + 1]
-        new_dataset = dp.temporal_slice(start_index,
-                                        end_index,
-                                        self.ten_year_dataset)
+        new_dataset = dp.temporal_slice(self.ten_year_dataset,
+                                        start_index,
+                                        end_index)
         np.testing.assert_array_equal(new_dataset.values, values)
 
 


Mime
View raw message