CLIMATE-486 - Normalize DSP 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/1398a868 Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/1398a868 Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/1398a868 Branch: refs/heads/CLIMATE-825 Commit: 1398a868b89222d834b5b28cc4856be85241e647 Parents: 36452d3 Author: Ibrahim Jarif <jarifibra...@gmail.com> Authored: Tue Jul 26 13:22:19 2016 +0530 Committer: Ibrahim Jarif <jarifibra...@gmail.com> Committed: Thu Jul 28 19:42:56 2016 +0530 ---------------------------------------------------------------------- ocw/dataset_processor.py | 12 ++++++------ ocw/tests/test_dataset_processor.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/1398a868/ocw/dataset_processor.py ---------------------------------------------------------------------- diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py index 74536f0..2b5dc9b 100755 --- a/ocw/dataset_processor.py +++ b/ocw/dataset_processor.py @@ -385,7 +385,7 @@ def subset(target_dataset, subregion, subregion_name=None): subregion.end = target_dataset.times[-1] # Ensure that the subregion information is well formed - _are_bounds_contained_by_dataset(subregion, target_dataset) + _are_bounds_contained_by_dataset(target_dataset, subregion) if not subregion_name: subregion_name = target_dataset.name @@ -409,8 +409,8 @@ def subset(target_dataset, subregion, subregion_name=None): elif target_dataset.lats.ndim == 1 and target_dataset.lons.ndim == 1: # Get subregion indices into subregion data - dataset_slices = _get_subregion_slice_indices(subregion, - target_dataset) + dataset_slices = _get_subregion_slice_indices(target_dataset, + subregion) # Slice the values array with our calculated slice indices if target_dataset.values.ndim == 2: subset_values = ma.zeros([len(target_dataset.values[ @@ -526,7 +526,7 @@ def safe_subset(target_dataset, subregion, subregion_name=None): if subregion.end > end: subregion.end = end - return subset(subregion, target_dataset, subregion_name) + return subset(target_dataset, subregion, subregion_name) def normalize_dataset_datetimes(dataset, timestep): @@ -1359,7 +1359,7 @@ def _congrid_neighbor(values, new_dims, minus_one, offset): return new_values -def _are_bounds_contained_by_dataset(bounds, dataset): +def _are_bounds_contained_by_dataset(dataset, bounds): '''Check if a Dataset fully contains a bounds. :param bounds: The Bounds object to check. @@ -1418,7 +1418,7 @@ def _are_bounds_contained_by_dataset(bounds, dataset): raise ValueError(error_message) -def _get_subregion_slice_indices(subregion, target_dataset): +def _get_subregion_slice_indices(target_dataset, subregion): '''Get the indices for slicing Dataset values to generate the subregion. :param subregion: The Bounds that specify the subset of the Dataset http://git-wip-us.apache.org/repos/asf/climate/blob/1398a868/ocw/tests/test_dataset_processor.py ---------------------------------------------------------------------- diff --git a/ocw/tests/test_dataset_processor.py b/ocw/tests/test_dataset_processor.py index fcc967e..627955a 100644 --- a/ocw/tests/test_dataset_processor.py +++ b/ocw/tests/test_dataset_processor.py @@ -469,7 +469,7 @@ class TestSubset(unittest.TestCase): def test_subset_using_non_exact_spatial_bounds(self): index_slices = dp._get_subregion_slice_indices( - self.non_exact_spatial_subregion, self.target_dataset) + self.target_dataset, self.non_exact_spatial_subregion) control_index_slices = {"lat_start": 5, "lat_end": 84, "lon_start": 10, @@ -480,7 +480,7 @@ class TestSubset(unittest.TestCase): def test_subset_using_non_exact_temporal_bounds(self): index_slices = dp._get_subregion_slice_indices( - self.non_exact_temporal_subregion, self.target_dataset) + self.target_dataset, self.non_exact_temporal_subregion) control_index_slices = {"lat_start": 5, "lat_end": 84, "lon_start": 10,