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 00:54:49 UTC

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

Author: joyce
Date: Wed Aug 14 22:54:49 2013
New Revision: 1514083

URL: http://svn.apache.org/r1514083
Log:
CLIMATE-237 - Add helper for getting Dataset subset indices

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=1514083&r1=1514082&r2=1514083&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/dataset_processor.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/dataset_processor.py Wed Aug 14 22:54:49 2013
@@ -645,4 +645,21 @@ def _get_subregion_slice_indices(subregi
 
     :returns: The indices to slice the Datasets arrays as a Dictionary.
     '''
-    pass
+    latStart = target_dataset.lats.index(subregion.latMin)
+    latEnd = target_dataset.lats[::-1].index(subregion.latMax)
+
+    lonStart = target_dataset.lons.index(subregion.lonMin)
+    lonEnd = target_dataset.lons[::-1].index(subregion.lonMax)
+
+    timeStart = target_dataset.times.index(subregion.timeMin)
+    timeEnd = target_dataset.times[::-1].index(subregion.timeMax)
+
+    return {
+        "latStart"  : latStart,
+        "latEnd"    : latEnd,
+        "lonStart"  : lonStart,
+        "lonEnd"    : lonEnd,
+        "timeStart" : timeStart,
+        "timeEnd"   : timeEnd
+    }
+