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 2014/06/29 06:44:33 UTC

[1/6] git commit: Update dataset_processor function parameter documentation

Repository: climate
Updated Branches:
  refs/heads/master 4796c01d3 -> 146f2df2a


Update dataset_processor function parameter documentation

- Update the dataset_processor function documentation so the references to
  ocw.dataset.Dataset objects are in a consistent form. In the future,
  these should be updated to properly reference the Dataset object's
  documentation (if possible).


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

Branch: refs/heads/master
Commit: c7e49f8f4a9b0bd1ebb98abd17c95ac20b98b110
Parents: ab179cb
Author: Michael Joyce <jo...@apache.org>
Authored: Sun Jun 22 16:06:46 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Sun Jun 22 16:14:38 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/climate/blob/c7e49f8f/ocw/dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py
index 0d08699..2f68c9e 100644
--- a/ocw/dataset_processor.py
+++ b/ocw/dataset_processor.py
@@ -32,13 +32,13 @@ logger = logging.getLogger(__name__)
 def temporal_rebin(target_dataset, temporal_resolution):
     """ Rebin a Dataset to a new temporal resolution
     
-    :param target_dataset: Dataset object that needs temporal regridding
-    :type target_dataset: Open Climate Workbench Dataset Object
+    :param target_dataset: Dataset object that needs temporal rebinned
+    :type target_dataset: ocw.dataset.Dataset object
     :param temporal_resolution: The new temporal bin size
-    :type temporal_resolution: Python datetime.timedelta object
+    :type temporal_resolution: datetime.timedelta object
     
     :returns: A new temporally rebinned Dataset
-    :rtype: Open Climate Workbench Dataset Object
+    :rtype: ocw.dataset.Dataset object
     """
     # Decode the temporal resolution into a string format that 
     # _rcmes_calc_average_on_new_time_unit_K() can understand
@@ -68,15 +68,15 @@ def temporal_rebin(target_dataset, temporal_resolution):
 def spatial_regrid(target_dataset, new_latitudes, new_longitudes):
     """ Regrid a Dataset using the new latitudes and longitudes
 
-    :param target_dataset: Dataset object that needs temporal regridding applied
-    :type target_dataset: Open Climate Workbench Dataset Object
+    :param target_dataset: Dataset object that needs spatially regridded
+    :type target_dataset: ocw.dataset.Dataset object
     :param new_latitudes: Array of latitudes
     :type new_latitudes: 1d Numpy Array
     :param new_longitudes: Array of longitudes
     :type new_longitudes: 1d Numpy Array
 
     :returns: A new spatially regridded Dataset
-    :rtype: Open Climate Workbench Dataset Object
+    :rtype: ocw.dataset.Dataset object
     """
     # Make masked array of shape (times, new_latitudes,new_longitudes)
     new_values = ma.zeros([len(target_dataset.times), 
@@ -126,7 +126,7 @@ def ensemble(datasets):
     :type datasets: List of OCW Dataset Objects
     
     :returns: New Dataset with a name of 'Dataset Ensemble'
-    :rtype: OCW Dataset Object
+    :rtype: ocw.dataset.Dataset object
     """
     _check_dataset_shapes(datasets)
     dataset_values = [dataset.values for dataset in datasets]
@@ -147,10 +147,10 @@ def subset(subregion, target_dataset):
     :param subregion: The Bounds with which to subset the target Dataset. 
     :type subregion: Bounds
     :param target_dataset: The Dataset object to subset.
-    :type target_dataset: Dataset
+    :type target_dataset: ocw.dataset.Dataset object
 
     :returns: The subset-ed Dataset object
-    :rtype: Dataset
+    :rtype: ocw.dataset.Dataset object
 
     :raises: ValueError
     '''
@@ -200,7 +200,7 @@ def safe_subset(subregion, target_dataset):
     :type target_dataset: ocw.dataset.Dataset
 
     :returns: The subset-ed Dataset object
-    :rtype: Dataset
+    :rtype: ocw.dataset.Dataset object
     '''
 
     lat_min, lat_max, lon_min, lon_max = target_dataset.spatial_boundaries()
@@ -232,13 +232,14 @@ def normalize_dataset_datetimes(dataset, timestep):
     Force daily to an hour time value of 00:00:00.
     Force monthly data to the first of the month at midnight.
 
-    :param dataset: The Dataset which will have its' time value normalized.
-    :type dataset: Dataset
+    :param dataset: The Dataset which will have its time value normalized.
+    :type dataset: ocw.dataset.Dataset object
     :param timestep: The timestep of the Dataset's values. Either 'daily' or
         'monthly'.
     :type timestep: String
 
-    :returns: A new Dataset with normalized datetimes.
+    :returns: A new Dataset with normalized datetime values.
+    :rtype: ocw.dataset.Dataset object
     '''
     new_times = _rcmes_normalize_datetimes(dataset.times, timestep)
     return ds.Dataset(


[4/6] git commit: Update metrics function parameter documentation

Posted by jo...@apache.org.
Update metrics function parameter documentation

- Update the metrics function documentation so the references to
  ocw.dataset.Dataset objects are in a consistent form. In the future,
  these should be updated to properly reference the Dataset object's
  documentation (if possible).
- Minor documentation changes for clarity.


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

Branch: refs/heads/master
Commit: 9fb56bc198a9030580cd278eae498266b22fa9b0
Parents: c26e8c5
Author: Michael Joyce <jo...@apache.org>
Authored: Sun Jun 22 16:44:05 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Sun Jun 22 17:07:03 2014 -0700

----------------------------------------------------------------------
 ocw/metrics.py | 47 +++++++++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/9fb56bc1/ocw/metrics.py
----------------------------------------------------------------------
diff --git a/ocw/metrics.py b/ocw/metrics.py
index b31cd66..d040c11 100644
--- a/ocw/metrics.py
+++ b/ocw/metrics.py
@@ -40,6 +40,7 @@ class UnaryMetric(Metric):
 
         :param target_dataset: The dataset on which the current metric will
             be run.
+        :type target_dataset: ocw.dataset.Dataset object
 
         :returns: The result of evaluating the metric on the target_dataset.
         '''
@@ -55,9 +56,10 @@ class BinaryMetric(Metric):
 
         :param ref_dataset: The Dataset to use as the reference dataset when
             running the evaluation.
-        :type ref_dataset: Dataset
+        :type ref_dataset: ocw.dataset.Dataset object
         :param target_dataset: The Dataset to use as the target dataset when
             running the evaluation.
+        :type target_dataset: ocw.dataset.Dataset object
 
         :returns: The result of evaluation the metric on the reference and 
             target dataset.
@@ -74,10 +76,10 @@ class Bias(BinaryMetric):
            Overrides BinaryMetric.run()
 
         :param ref_dataset: The reference dataset to use in this metric run.
-        :type ref_dataset: Dataset.
+        :type ref_dataset: ocw.dataset.Dataset object
         :param target_dataset: The target dataset to evaluate against the
             reference dataset in this metric run.
-        :type target_dataset: Dataset.
+        :type target_dataset: ocw.dataset.Dataset object
 
         :returns: The difference between the reference and target datasets.
         :rtype: Numpy Array
@@ -96,7 +98,7 @@ class TemporalStdDev(UnaryMetric):
 
         :param target_dataset: The target_dataset on which to calculate the 
             temporal standard deviation.
-        :type target_dataset: Dataset
+        :type target_dataset: ocw.dataset.Dataset object
 
         :returns: The temporal standard deviation of the target dataset
         :rtype: Numpy Array
@@ -116,10 +118,10 @@ class SpatialStdDevRatio(BinaryMetric):
            Overrides BinaryMetric.run()
 
         :param ref_dataset: The reference dataset to use in this metric run.
-        :type ref_dataset: Dataset.
+        :type ref_dataset: ocw.dataset.Dataset object
         :param target_dataset: The target dataset to evaluate against the
             reference dataset in this metric run.
-        :type target_dataset: Dataset.
+        :type target_dataset: ocw.dataset.Dataset object
 
         :returns: The ratio of standard deviation of the reference and target
             dataset.
@@ -149,10 +151,10 @@ class PatternCorrelation(BinaryMetric):
            Overrides BinaryMetric.run()
 
         :param ref_dataset: The reference dataset to use in this metric run.
-        :type ref_dataset: Dataset.
+        :type ref_dataset: ocw.dataset.Dataset object
         :param target_dataset: The target dataset to evaluate against the
             reference dataset in this metric run.
-        :type target_dataset: Dataset.
+        :type target_dataset: ocw.dataset.Dataset object
 
         :returns: The spatial correlation between a reference and target dataset.
         '''
@@ -170,21 +172,21 @@ class PatternCorrelation(BinaryMetric):
         return pattern_correlation, p_value
 
 class MeanBias(BinaryMetric):
-    '''Calculate the mean bias'''
+    '''Calculate the bias averaged over time.'''
 
     def run(self, ref_dataset, target_dataset, absolute=False):
-        '''Calculate the mean bias between a reference and target dataset over all time.
+        '''Calculate the bias averaged over time.
 
         .. note::
            Overrides BinaryMetric.run()
 
         :param ref_dataset: The reference dataset to use in this metric run.
-        :type ref_dataset: Dataset.
+        :type ref_dataset: ocw.dataset.Dataset object
         :param target_dataset: The target dataset to evaluate against the
             reference dataset in this metric run.
-        :type target_dataset: Dataset.
+        :type target_dataset: ocw.dataset.Dataset object
 
-        :returns: The the mean bias between a reference and target dataset over all time.
+        :returns: The mean bias between a reference and target dataset over time.
         '''
 
         diff = ref_dataset.values - target_dataset.values
@@ -195,25 +197,23 @@ class MeanBias(BinaryMetric):
         return mean_bias
 
 class SeasonalSpatialStdDevRatio(BinaryMetric):
-    '''Calculate the ratio of spatial standard deviation (model standard
-          deviation)/(observed standard deviation)'''
+    '''Calculate the seasonal spatial standard deviation ratio.'''
 
     def __init__(self, month_start=1, month_end=12):
         self.month_start = month_start
         self.month_end = month_end
 
     def run(self, ref_dataset, target_dataset):
-        '''Calculate the ratio of spatial std. dev. between a reference and
-            target dataset.
+        '''Calculate the seasonal spatial standard deviation ratio.
 
         .. note::
            Overrides BinaryMetric.run()
 
         :param ref_dataset: The reference dataset to use in this metric run.
-        :type ref_dataset: Dataset.
+        :type ref_dataset: ocw.dataset.Dataset object
         :param target_dataset: The target dataset to evaluate against the
             reference dataset in this metric run.
-        :type target_dataset: Dataset.
+        :type target_dataset: ocw.dataset.Dataset object
 
         :returns: The ratio of standard deviation of the reference and target
             dataset.
@@ -226,24 +226,23 @@ class SeasonalSpatialStdDevRatio(BinaryMetric):
 
 
 class SeasonalPatternCorrelation(BinaryMetric):
-    '''Calculate the spatial correlation'''
+    '''Calculate the seasonal pattern correlation.'''
 
     def __init__(self, month_start=1, month_end=12):
         self.month_start = month_start
         self.month_end = month_end
 
     def run(self, ref_dataset, target_dataset):
-        '''Calculate the spatial correlation between a reference and target dataset.
-            Using: scipy.stats.pearsonr
+        '''Calculate the seasonal pattern correlation.
 
         .. note::
            Overrides BinaryMetric.run()
 
         :param ref_dataset: The reference dataset to use in this metric run.
-        :type ref_dataset: Dataset.
+        :type ref_dataset: ocw.dataset.Dataset object
         :param target_dataset: The target dataset to evaluate against the
             reference dataset in this metric run.
-        :type target_dataset: Dataset.
+        :type target_dataset: ocw.dataset.Dataset object
 
         :returns: The spatial correlation between a reference and target dataset.
         '''


[6/6] git commit: Resolve CLIMATE-479. Merge PR #81.

Posted by jo...@apache.org.
Resolve CLIMATE-479. Merge PR #81.


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

Branch: refs/heads/master
Commit: 146f2df2acd82da16fe1b37f816df410d978d2ae
Parents: 4796c01 77347e7
Author: Michael Joyce <jo...@apache.org>
Authored: Sat Jun 28 21:44:09 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Sat Jun 28 21:44:09 2014 -0700

----------------------------------------------------------------------
 ocw/data_source/local.py |  4 ++--
 ocw/data_source/rcmed.py |  6 +++---
 ocw/dataset_processor.py | 29 +++++++++++++-------------
 ocw/metrics.py           | 47 +++++++++++++++++++++----------------------
 ocw/utils.py             | 35 ++++++++++++++++++++------------
 5 files changed, 65 insertions(+), 56 deletions(-)
----------------------------------------------------------------------



[3/6] git commit: Update data_source.rcmed function parameter documentation

Posted by jo...@apache.org.
Update data_source.rcmed function parameter documentation

- Update the data_source.rcmed function documentation so the references to
  ocw.dataset.Dataset objects are in a consistent form. In the future,
  these should be updated to properly reference the Dataset object's
  documentation (if possible).


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

Branch: refs/heads/master
Commit: c26e8c518fcad5cd63ce0cb8805245b800913180
Parents: fc6dde3
Author: Michael Joyce <jo...@apache.org>
Authored: Sun Jun 22 16:32:47 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Sun Jun 22 16:32:47 2014 -0700

----------------------------------------------------------------------
 ocw/data_source/rcmed.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/c26e8c51/ocw/data_source/rcmed.py
----------------------------------------------------------------------
diff --git a/ocw/data_source/rcmed.py b/ocw/data_source/rcmed.py
index 3b86c9b..410bf48 100644
--- a/ocw/data_source/rcmed.py
+++ b/ocw/data_source/rcmed.py
@@ -332,8 +332,8 @@ def parameter_dataset(dataset_id, parameter_id, min_lat, max_lat, min_lon, max_l
     :param end_time: End time 
     :type end_time: Datetime
 
-    :returns: Dataset object
-    :rtype: Object
+    :returns: An OCW Dataset object contained the requested data from RCMED.
+    :rtype: ocw.dataset.Dataset object
     '''
     
     parameters_metadata = get_parameters_metadata()
@@ -346,4 +346,4 @@ def parameter_dataset(dataset_id, parameter_id, min_lat, max_lat, min_lon, max_l
     values = _reshape_values(values, unique_lats_lons_times)
     values = _make_mask_array(values, parameter_id, parameters_metadata)
     
-    return Dataset(unique_lats_lons_times[0], unique_lats_lons_times[1], unique_times, values, parameter_name)
\ No newline at end of file
+    return Dataset(unique_lats_lons_times[0], unique_lats_lons_times[1], unique_times, values, parameter_name)


[5/6] git commit: Update utils function parameter documentation

Posted by jo...@apache.org.
Update utils function parameter documentation

- Update the utils function documentation so the references to
  ocw.dataset.Dataset objects are in a consistent form. In the future,
  these should be updated to properly reference the Dataset object's
  documentation (if possible).
- Minor documentation changes and rewordings for clarity.


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

Branch: refs/heads/master
Commit: 77347e75d449fb9ae57bd49697999b2be8d5fe7f
Parents: 9fb56bc
Author: Michael Joyce <jo...@apache.org>
Authored: Sun Jun 22 17:02:58 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Sun Jun 22 17:07:03 2014 -0700

----------------------------------------------------------------------
 ocw/utils.py | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/77347e75/ocw/utils.py
----------------------------------------------------------------------
diff --git a/ocw/utils.py b/ocw/utils.py
index a1edeac..8c109b7 100644
--- a/ocw/utils.py
+++ b/ocw/utils.py
@@ -217,17 +217,24 @@ def normalize_lat_lon_values(lats, lons, values):
 
 
 def reshape_monthly_to_annually(dataset):
-    ''' Reshaping monthly dataset to annually
+    ''' Reshape monthly binned dataset to annual bins.
 
-    Reshaping 3D array dataset's values with shape (num_month, num_lat, num_lon)
-    to 4D array with shape (num_year, 12, num_lat, num_lon).
-    Number 12 is constant which represents 12 months in one year
-    e.g. (24, 90, 180) to (2, 12, 90, 180)
+    Reshape a monthly binned dataset's 3D value array with shape
+    (num_months, num_lats, num_lons) to a 4D array with shape
+    (num_years, 12, num_lats, num_lons). This causes the data to be binned
+    annually while retaining its original shape.
+
+    It is assumed that the number of months in the dataset is evenly
+    divisible by 12. If it is not you will receive error due to
+    an invalid shape.
+
+    Example change of a dataset's shape:
+    (24, 90, 180) -> (2, 12, 90, 180)
 
     :param dataset: Dataset object with full-year format
-    :type dataset: Open Climate Workbench Dataset Object
+    :type dataset: ocw.dataset.Dataset object
 
-    :returns: Dataset values with shape (num_year, num_month, num_lat, num_lon)
+    :returns: Dataset values array with shape (num_year, 12, num_lat, num_lon)
     :rtype: Numpy array
     '''
 
@@ -248,14 +255,16 @@ def reshape_monthly_to_annually(dataset):
 def calc_climatology_year(dataset):
     ''' Calculate climatology of dataset's values for each year
 
-    :param dataset: Dataset object with full-year format
-    :type dataset: Open Climate Workbench Dataset Object
+    :param dataset: Monthly binned Dataset object with an evenly divisible
+        number of months.
+    :type dataset: ocw.dataset.Dataset object
 
-    :returns: Mean values for each year (annually_mean)
-            and mean values for all years (total_mean)
+    :returns: Mean values for each year (annual_mean) and mean values for all
+        years (total_mean)
     :rtype: A tuple of two numpy arrays
 
-    :raise ValueError: If the time shape of values in not divisble by 12 (not full-year)
+    :raise ValueError: If the number of monthly bins is not evenly divisible
+        by 12.
     '''
 
     values_shape = dataset.values.shape
@@ -280,7 +289,7 @@ def calc_climatology_season(month_start, month_end, dataset):
     :param month_end: An integer for ending month (Jan=1)
     :type month_end: Integer
     :param dataset: Dataset object with full-year format
-    :type dataset: Open Climate Workbench Dataset Object
+    :type dataset: ocw.dataset.Dataset object
 
     :returns:  
         t_series - monthly average over the given season


[2/6] git commit: Update data_source.local function parameter documentation

Posted by jo...@apache.org.
Update data_source.local function parameter documentation

- Update the data_source.local function documentation so the references to
  ocw.dataset.Dataset objects are in a consistent form. In the future,
  these should be updated to properly reference the Dataset object's
  documentation (if possible).


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

Branch: refs/heads/master
Commit: fc6dde333416976f906d8a448534565bd60cc052
Parents: c7e49f8
Author: Michael Joyce <jo...@apache.org>
Authored: Sun Jun 22 16:29:46 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Sun Jun 22 16:29:46 2014 -0700

----------------------------------------------------------------------
 ocw/data_source/local.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/fc6dde33/ocw/data_source/local.py
----------------------------------------------------------------------
diff --git a/ocw/data_source/local.py b/ocw/data_source/local.py
index 84a56a0..79e3ba8 100644
--- a/ocw/data_source/local.py
+++ b/ocw/data_source/local.py
@@ -201,8 +201,8 @@ def load_file(file_path, variable_name):
     :param variable_name: The given (by user) value variable name
     :type variable_name: String
 
-    :returns: A dataset object from dataset.py
-    :rtype: Object
+    :returns: An OCW Dataset object containing the requested parameter data.
+    :rtype: ocw.dataset.Dataset object
 
     :raises: ValueError
     '''