Repository: climate
Updated Branches:
  refs/heads/master e9dda95d3 -> fea37a9be


Added get_temporal_overlap in dataset_processor


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

Branch: refs/heads/master
Commit: c032467cc499d2cad8b1fca482d8653df59d8a19
Parents: 83d83ba
Author: huikyole <[email protected]>
Authored: Tue Jul 28 14:18:03 2015 -0700
Committer: huikyole <[email protected]>
Committed: Tue Jul 28 14:18:03 2015 -0700

----------------------------------------------------------------------
 ocw/dataset_processor.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/c032467c/ocw/dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py
index 984e142..3e35003 100755
--- a/ocw/dataset_processor.py
+++ b/ocw/dataset_processor.py
@@ -114,6 +114,20 @@ def temporal_rebin(target_dataset, temporal_resolution):
     
     return new_dataset
 
+def get_temporal_overlap(dataset_array):
+    ''' Find the maximum temporal overlap across the observation and model 
datasets
+
+    :param dataset_array: an array of OCW datasets
+    '''
+    start_time =[]
+    end_time =[]
+    for dataset in dataset_array:
+        start_time.append(dataset.time_range()[0])
+        end_time.append(dataset.time_range()[1])
+
+    return np.max(start_time), np.min(end_time)
+
+
 def spatial_regrid(target_dataset, new_latitudes, new_longitudes):
     """ Regrid a Dataset using the new latitudes and longitudes
 

Reply via email to