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/10/06 20:58:04 UTC

[1/3] climate git commit: CLIMATE-686 - Update the evaluation metrics

Repository: climate
Updated Branches:
  refs/heads/master 9b3b61c2f -> 260e6b71d


CLIMATE-686 - Update the evaluation metrics

- evaluation.convert_evaluation_result and evaluation.convert_unary_evaluation_result have been updated.
- The updated modules properly handle when the metrics calculation result is a single number.


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

Branch: refs/heads/master
Commit: 8ff11aa36cbe961dbdfb5d661f249b0655989cbb
Parents: b6baf0f
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Mon Oct 5 17:37:39 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Mon Oct 5 17:37:39 2015 -0700

----------------------------------------------------------------------
 ocw/evaluation.py | 60 +++++++++++++++++++++++++++++++++-----------------
 1 file changed, 40 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/8ff11aa3/ocw/evaluation.py
----------------------------------------------------------------------
diff --git a/ocw/evaluation.py b/ocw/evaluation.py
index ff9ad33..fef5a0f 100644
--- a/ocw/evaluation.py
+++ b/ocw/evaluation.py
@@ -357,11 +357,16 @@ def convert_evaluation_result(evaluation_result, subregion = False):
         nmetric = len(evaluation_result[0])
         results = [] 
         for imetric in range(nmetric):
-            result_shape = list(evaluation_result[0][imetric].shape)
-            result_shape.insert(0, nmodel)
-            result = ma.zeros(result_shape)
-            for imodel in range(nmodel):
-                result[imodel,:] = evaluation_result[imodel][imetric]
+            if evaluation_result[0][imetric].ndim >=2:
+                result_shape = list(evaluation_result[0][imetric].shape)
+                result_shape.insert(0, nmodel)
+                result = ma.zeros(result_shape)
+                for imodel in range(nmodel):
+                    result[imodel,:] = evaluation_result[imodel][imetric]
+            else:
+                result = ma.zeros(nmodel)
+                for imodel in range(nmodel):
+                    result[imodel] = evaluation_result[imodel][imetric]
             results.append(result)
         return results
     else:
@@ -373,11 +378,16 @@ def convert_evaluation_result(evaluation_result, subregion = False):
         for isubregion in range(nsubregion):
             subregion_results = []
             for imetric in range(nmetric):
-                result_shape = list(evaluation_result[0][imetric][isubregion].shape)
-                result_shape.insert(0, nmodel)
-                result = ma.zeros(result_shape)
-                for imodel in range(nmodel):
-                    result[imodel,:] = evaluation_result[imodel][imetric][isubregion]
+                if evaluation_result[0][imetric][isubregion].ndim >=2:
+                    result_shape = list(evaluation_result[0][imetric][isubregion].shape)
+                    result_shape.insert(0, nmodel)
+                    result = ma.zeros(result_shape)
+                    for imodel in range(nmodel):
+                        result[imodel,:] = evaluation_result[imodel][imetric][isubregion]
+                else:
+                    result = ma.zeros(nmodel)
+                    for imodel in range(nmodel):
+                        result[imodel] = evaluation_result[imodel][imetric][isubregion]
                 subregion_results.append(result)
             results.append(subregion_results)
         return results
@@ -388,11 +398,16 @@ def convert_unary_evaluation_result(evaluation_result, subregion = False):
         nmodel = len(evaluation_result[0])
         results = []
         for imetric in range(nmetric):
-            result_shape = list(evaluation_result[imetric][0].shape)
-            result_shape.insert(0, nmodel)
-            result = ma.zeros(result_shape)
-            for imodel in range(nmodel):
-                result[imodel,:] = evaluation_result[imetric][imodel]
+            if evaluation_result[imetric][0].ndim >=2:
+                result_shape = list(evaluation_result[imetric][0].shape)
+                result_shape.insert(0, nmodel)
+                result = ma.zeros(result_shape)
+                for imodel in range(nmodel):
+                    result[imodel,:] = evaluation_result[imetric][imodel]
+            else:
+                result = ma.zeros(nmodel)
+                for imodel in range(nmodel):
+                    result[imodel] = evaluation_result[imetric][imodel]
             results.append(result)
         return results
     else:
@@ -404,11 +419,16 @@ def convert_unary_evaluation_result(evaluation_result, subregion = False):
         for isubregion in range(nsubregion):
             subregion_results = []
             for imetric in range(nmetric):
-                result_shape = list(evaluation_result[imetric][isubregion][0].shape)
-                result_shape.insert(0, nmodel)
-                result = ma.zeros(result_shape)
-                for imodel in range(nmodel):
-                    result[imodel,:] = evaluation_result[imetric][isubregion][imodel]
+                if evaluation_result[imetric][isubregion][0].ndim >=2:
+                    result_shape = list(evaluation_result[imetric][isubregion][0].shape)
+                    result_shape.insert(0, nmodel)
+                    result = ma.zeros(result_shape)
+                    for imodel in range(nmodel):
+                        result[imodel,:] = evaluation_result[imetric][isubregion][imodel]
+                else:
+                    result = ma.zeros(nmodel) 
+                    for imodel in range(nmodel):
+                        result[imodel] = evaluation_result[imetric][isubregion][imodel]
                 subregion_results.append(result)
             results.append(subregion_results)
         return results


[3/3] climate git commit: Climate-686 - Update the converting functions in ocw.evaluation

Posted by hu...@apache.org.
Climate-686 - Update the converting functions in ocw.evaluation

- evaluation.convert_evaluation_result and evaluation.convert_unary_evaluation_result have been updated.
- The updated modules properly handle when the metrics calculation result is a single number.


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

Branch: refs/heads/master
Commit: 260e6b71dce4536b1a129219effe42733b77f64a
Parents: 9b3b61c 4ca7e33
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Tue Oct 6 11:57:19 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Tue Oct 6 11:57:19 2015 -0700

----------------------------------------------------------------------
 ocw/evaluation.py | 60 +++++++++++++++++++++++++++++++++-----------------
 1 file changed, 40 insertions(+), 20 deletions(-)
----------------------------------------------------------------------



[2/3] climate git commit: trivial bug fix

Posted by hu...@apache.org.
trivial bug fix


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

Branch: refs/heads/master
Commit: 4ca7e339e270840307acacd1b0ad3654f795b0f4
Parents: 8ff11aa
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Mon Oct 5 17:42:59 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Mon Oct 5 17:42:59 2015 -0700

----------------------------------------------------------------------
 ocw/evaluation.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/4ca7e339/ocw/evaluation.py
----------------------------------------------------------------------
diff --git a/ocw/evaluation.py b/ocw/evaluation.py
index fef5a0f..8f01a68 100644
--- a/ocw/evaluation.py
+++ b/ocw/evaluation.py
@@ -357,7 +357,7 @@ def convert_evaluation_result(evaluation_result, subregion = False):
         nmetric = len(evaluation_result[0])
         results = [] 
         for imetric in range(nmetric):
-            if evaluation_result[0][imetric].ndim >=2:
+            if evaluation_result[0][imetric].ndim !=0:
                 result_shape = list(evaluation_result[0][imetric].shape)
                 result_shape.insert(0, nmodel)
                 result = ma.zeros(result_shape)
@@ -378,7 +378,7 @@ def convert_evaluation_result(evaluation_result, subregion = False):
         for isubregion in range(nsubregion):
             subregion_results = []
             for imetric in range(nmetric):
-                if evaluation_result[0][imetric][isubregion].ndim >=2:
+                if evaluation_result[0][imetric][isubregion].ndim !=0:
                     result_shape = list(evaluation_result[0][imetric][isubregion].shape)
                     result_shape.insert(0, nmodel)
                     result = ma.zeros(result_shape)
@@ -398,7 +398,7 @@ def convert_unary_evaluation_result(evaluation_result, subregion = False):
         nmodel = len(evaluation_result[0])
         results = []
         for imetric in range(nmetric):
-            if evaluation_result[imetric][0].ndim >=2:
+            if evaluation_result[imetric][0].ndim !=0:
                 result_shape = list(evaluation_result[imetric][0].shape)
                 result_shape.insert(0, nmodel)
                 result = ma.zeros(result_shape)
@@ -419,7 +419,7 @@ def convert_unary_evaluation_result(evaluation_result, subregion = False):
         for isubregion in range(nsubregion):
             subregion_results = []
             for imetric in range(nmetric):
-                if evaluation_result[imetric][isubregion][0].ndim >=2:
+                if evaluation_result[imetric][isubregion][0].ndim !=0:
                     result_shape = list(evaluation_result[imetric][isubregion][0].shape)
                     result_shape.insert(0, nmodel)
                     result = ma.zeros(result_shape)