climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jarifibra...@apache.org
Subject climate git commit: CLIMATE-799 - TypeError in subset function
Date Mon, 13 Jun 2016 19:10:01 GMT
Repository: climate
Updated Branches:
  refs/heads/master cd3eea5dc -> 89acf56a8


CLIMATE-799 - TypeError in subset function

- Fix TypeError in dataset processor module


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

Branch: refs/heads/master
Commit: 89acf56a82cccb27f5fedf0527391184bcad421f
Parents: cd3eea5
Author: Ibrahim <jarifibrahim@gmail.com>
Authored: Fri Jun 3 00:23:49 2016 +0530
Committer: Ibrahim <jarifibrahim@gmail.com>
Committed: Tue Jun 14 00:38:48 2016 +0530

----------------------------------------------------------------------
 ocw/dataset_processor.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/89acf56a/ocw/dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py
index c0e384f..a455fb9 100755
--- a/ocw/dataset_processor.py
+++ b/ocw/dataset_processor.py
@@ -351,7 +351,9 @@ def subset(subregion, target_dataset, subregion_name=None):
         subregion_name = target_dataset.name
 
     if target_dataset.lats.ndim ==2 and target_dataset.lons.ndim ==2:
-        target_dataset = temporal_slice(subregion.start, subregion.end, target_dataset)
+        start_time_index = np.where(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)
         nt, ny, nx = target_dataset.values.shape
         y_index, x_index = np.where((target_dataset.lats >= subregion.lat_max) | (target_dataset.lats
<= subregion.lat_min) |
                          (target_dataset.lons >= subregion.lon_max) | (target_dataset.lons
<= subregion.lon_min)) 


Mime
View raw message