climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From huiky...@apache.org
Subject [07/12] climate git commit: Mike's comments
Date Wed, 15 Jul 2015 05:08:20 GMT
Mike's comments


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

Branch: refs/heads/master
Commit: 036103ec0f4e389a843b88b5a03cde82a620db02
Parents: cefd9d6
Author: Huikyo Lee <huikyole@argo.jpl.nasa.gov>
Authored: Fri Mar 20 01:02:25 2015 -0700
Committer: Huikyo Lee <huikyole@argo.jpl.nasa.gov>
Committed: Fri Mar 20 01:02:25 2015 -0700

----------------------------------------------------------------------
 ocw/dataset_processor.py | 14 ++++++--------
 ocw/utils.py             |  9 ++-------
 2 files changed, 8 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/036103ec/ocw/dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py
index a03cac5..e3ffc92 100755
--- a/ocw/dataset_processor.py
+++ b/ocw/dataset_processor.py
@@ -31,8 +31,9 @@ logger = logging.getLogger(__name__)
 
 def temporal_subset(target_dataset, month_index):
     """ Temporally subset data between month_begin and month_end in each year.
-       For example, to extract DJF time series, monthBegin = 12, monthEnd =2
-       This can handle monthBegin=monthEnd i.e. for time series of a specific month
+
+    For example, to extract DJF time series, monthBegin = 12, monthEnd =2
+    This can handle monthBegin=monthEnd i.e. for time series of a specific month
 
     :param target_dataset: Dataset object that needs temporal subsetting 
     :type target_dataset: Open Climate Workbench Dataset Object
@@ -44,10 +45,7 @@ def temporal_subset(target_dataset, month_index):
     """
 
     dates = target_dataset.times
-    months = []
-    for date in dates:
-        months.append(date.month) 
-    months = np.array(months)
+    months = np.array([d.month for d in dates])
     time_index = []
     for m_value in month_index:
         time_index = np.append(time_index, np.where(months == m_value)[0]) 
@@ -117,11 +115,11 @@ def spatial_aggregation(target_dataset, lon_min, lon_max, lat_min, lat_max):
     :param lon_min: minimum longitude (western boundary)
     :type lon_min: float
     :param lon_max: maximum longitude (eastern boundary)
-    :type lon_min: float
+    :type lon_max: float
     :param lat_min: minimum latitude (southern boundary) 
     :type lat_min: float
     :param lat_min: maximum latitude (northern boundary) 
-    :type lat_min: float
+    :type lat_max: float
 
     :returns: A new spatially subset Dataset
     :rtype: Open Climate Workbench Dataset Object

http://git-wip-us.apache.org/repos/asf/climate/blob/036103ec/ocw/utils.py
----------------------------------------------------------------------
diff --git a/ocw/utils.py b/ocw/utils.py
index e778d40..ff6dddd 100755
--- a/ocw/utils.py
+++ b/ocw/utils.py
@@ -53,17 +53,12 @@ def decode_time_values(dataset, time_var_name):
         for time_val in time_data:
             times.append(time_base + relativedelta(months=int(time_val)))
     else:
-    #    for time_val in time_data:
-    #        arg[time_units] = time_val
-    #        times.append(time_base + dt.timedelta(**arg))
-    
-        times_calendar = 'standard'
         try:
             times_calendar = time_data.calendar
         except:
-            pass
+            times_calendar = 'standard'
 
-        times = num2date(time_data, units = time_format, calendar = times_calendar)
+        times = num2date(time_data[:], units=time_format, calendar=times_calendar)
     return times
 
 def parse_time_units(time_format):


Mime
View raw message