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 2013/08/15 20:16:30 UTC

svn commit: r1514420 - /incubator/climate/branches/RefactorInput/ocw/dataset_processor.py

Author: joyce
Date: Thu Aug 15 18:16:29 2013
New Revision: 1514420

URL: http://svn.apache.org/r1514420
Log:
CLIMATE-237 - Fixing Dataset array slicing for subset generation.

Modified:
    incubator/climate/branches/RefactorInput/ocw/dataset_processor.py

Modified: incubator/climate/branches/RefactorInput/ocw/dataset_processor.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/dataset_processor.py?rev=1514420&r1=1514419&r2=1514420&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/dataset_processor.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/dataset_processor.py Thu Aug 15 18:16:29 2013
@@ -156,12 +156,20 @@ def subset(subregion, target_dataset):
     dataset_slices = _get_subregion_slice_indices(subregion, target_dataset)
     # Build new dataset with subset information
     return ds.Dataset(
-        target_dataset.lats[latStart, latEnd + 1],
-        target_dataset.lons[lonStart, lonEnd + 1],
-        target_dataset.times[timeStart, timeEnd + 1],
-        target_dataset.values[timeStart:timeEnd + 1,
-                            latStart:latEnd + 1,
-                            lonStart:lonEnd + 1],
+        # Slice the lats array with our calculated slice indices
+        target_dataset.lats[dataset_slices["latStart"]: 
+                            dataset_slices["latEnd"] + 1],
+        # Slice the lons array with our calculated slice indices
+        target_dataset.lons[dataset_slices["lonStart"]: 
+                            dataset_slices["lonEnd"]+ 1],
+        # Slice the times array with our calculated slice indices
+        target_dataset.times[dataset_slices["timeStart"]: 
+                            dataset_slices["timeEnd"]+ 1],
+        # Slice the values array with our calculated slice indices
+        target_dataset.values[
+            dataset_slices["timeStart"]:dataset_slices["timeEnd"] + 1,
+            dataset_slices["latStart"]:dataset_slices["latEnd"] + 1,
+            dataset_slices["lonStart"]:dataset_slices["lonEnd"] + 1],
         target_dataset.variable,
         target_dataset.name
     )