You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by hu...@apache.org on 2015/08/01 00:37:32 UTC

[1/5] climate git commit: Added get_temporal_overlap in dataset_processor

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 <hu...@argo.jpl.nasa.gov>
Authored: Tue Jul 28 14:18:03 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
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
 


[5/5] climate git commit: Merge branch 'CLIMATE-647'

Posted by hu...@apache.org.
Merge branch 'CLIMATE-647'


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

Branch: refs/heads/master
Commit: fea37a9be2fe85c0eb12139babe2165865de760e
Parents: e9dda95 68b8549
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Fri Jul 31 15:37:24 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Fri Jul 31 15:37:24 2015 -0700

----------------------------------------------------------------------
 ocw/dataset_processor.py | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/fea37a9b/ocw/dataset_processor.py
----------------------------------------------------------------------


[2/5] climate git commit: CLIMATE-647 Updated dataset_processor.temporal_subset

Posted by hu...@apache.org.
CLIMATE-647 Updated dataset_processor.temporal_subset


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

Branch: refs/heads/master
Commit: d41cb79589b22fc1b8f78d6238d40491dc716877
Parents: c032467
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Tue Jul 28 17:09:14 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Tue Jul 28 17:09:14 2015 -0700

----------------------------------------------------------------------
 ocw/dataset_processor.py | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/d41cb795/ocw/dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py
index 3e35003..a0169a7 100755
--- a/ocw/dataset_processor.py
+++ b/ocw/dataset_processor.py
@@ -29,7 +29,7 @@ import logging
 
 logger = logging.getLogger(__name__)
 
-def temporal_subset(month_start, month_end, target_dataset):
+def temporal_subset(month_start, month_end, target_dataset, average_each_year = False):
     """ Temporally subset data given month_index.
 
     :param month_start: An integer for beginning month (Jan=1)
@@ -41,6 +41,9 @@ def temporal_subset(month_start, month_end, target_dataset):
     :param target_dataset: Dataset object that needs temporal subsetting
     :type target_dataset: Open Climate Workbench Dataset Object
 
+    :param average_each_year: If True, output dataset is averaged for each year
+    :type average_each_year: :class:'boolean'
+
     :returns: A temporal subset OCW Dataset
     :rtype: Open Climate Workbench Dataset Object
     """
@@ -71,8 +74,32 @@ def temporal_subset(month_start, month_end, target_dataset):
                              target_dataset.lons,
                              target_dataset.times[time_index],
                              target_dataset.values[time_index,:],
-                             target_dataset.variable,
-                             target_dataset.name)
+                             variable=target_dataset.variable,
+                             units=target_dataset.units,
+                             name=target_dataset.name)
+
+    if average_each_year:
+        nmonth = len(month_index)
+        ntime  = new_dataset.times.size
+        nyear = ntime/nmonth
+        averaged_time = []              
+        ny, nx = target_dataset.values.shape[1:]
+        averaged_values =ma.zeros([nyear, ny, nx])
+        for iyear in np.arange(nyear):
+            # centered time index of the season between month_start and month_end in each year
+            center_index = int(nmonth/2)+iyear*nmonth   
+            if nmonth == 1:
+                center_index = iyear
+            averaged_time.append(new_dataset.times[center_index]) 
+            averaged_values[iyear,:] = ma.average(new_dataset.values[nmonth*iyear:nmonth*iyear+nmonth,:], axis=0)
+        new_dataset = ds.Dataset(target_dataset.lats,
+                                 target_dataset.lons,
+                                 np.array(averaged_time),
+                                 averaged_values,
+                                 variable=target_dataset.variable,
+                                 units=target_dataset.units,
+                                 name=target_dataset.name)
+    
     return new_dataset
 
 def temporal_rebin(target_dataset, temporal_resolution):     


[4/5] climate git commit: Removed space in keyword

Posted by hu...@apache.org.
Removed space in keyword


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

Branch: refs/heads/master
Commit: 68b8549471c4fef942a20a9ed221a74b8864e14c
Parents: 28fc671
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Tue Jul 28 17:17:24 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Tue Jul 28 17:17:24 2015 -0700

----------------------------------------------------------------------
 ocw/dataset_processor.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/68b85494/ocw/dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py
index bf0c08d..15ff7f0 100755
--- a/ocw/dataset_processor.py
+++ b/ocw/dataset_processor.py
@@ -29,7 +29,7 @@ import logging
 
 logger = logging.getLogger(__name__)
 
-def temporal_subset(month_start, month_end, target_dataset, average_each_year = False):
+def temporal_subset(month_start, month_end, target_dataset, average_each_year=False):
     """ Temporally subset data given month_index.
 
     :param month_start: An integer for beginning month (Jan=1)


[3/5] climate git commit: get_temporal_overlap related to CLIMATE-646 has been removed

Posted by hu...@apache.org.
get_temporal_overlap related to CLIMATE-646 has been removed


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

Branch: refs/heads/master
Commit: 28fc6713dd461e1db5bff52aeacc884f913e76cf
Parents: d41cb79
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Tue Jul 28 17:12:26 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Tue Jul 28 17:12:26 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/climate/blob/28fc6713/ocw/dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py
index a0169a7..bf0c08d 100755
--- a/ocw/dataset_processor.py
+++ b/ocw/dataset_processor.py
@@ -141,20 +141,6 @@ 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