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/11/06 21:51:13 UTC
[4/6] climate git commit: CLIMATE-542: Make variable names more
meaningful
CLIMATE-542: Make variable names more meaningful
Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/7363794b
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/7363794b
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/7363794b
Branch: refs/heads/master
Commit: 7363794bf0e3567a9e0627551e8885a00a85430a
Parents: 00bffd7
Author: rlaidlaw <rl...@gmail.com>
Authored: Thu Nov 6 12:04:37 2014 -0800
Committer: rlaidlaw <rl...@gmail.com>
Committed: Thu Nov 6 12:04:37 2014 -0800
----------------------------------------------------------------------
ocw/metrics.py | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/climate/blob/7363794b/ocw/metrics.py
----------------------------------------------------------------------
diff --git a/ocw/metrics.py b/ocw/metrics.py
index 1504404..1ef5f87 100644
--- a/ocw/metrics.py
+++ b/ocw/metrics.py
@@ -171,17 +171,19 @@ class TemporalCorrelation(BinaryMetric):
array of confidence levels associated with the temporal correlation
coefficients
'''
- nt, ny, nx = reference_dataset.values.shape
- tc = numpy.zeros([ny, nx])
- cl = numpy.zeros([ny, nx])
- for iy in numpy.arange(ny):
- for ix in numpy.arange(nx):
- tc[iy, ix], cl[iy, ix] = stats.pearsonr(
- reference_dataset.values[:, iy, ix],
- target_dataset.values[:, iy, ix]
- )
- cl[iy, ix] = 1 - cl[iy, ix]
- return tc, cl
+ nTimes, nLats, nLons = reference_dataset.values.shape
+ coefficients = numpy.zeros([nLats, nLons])
+ levels = numpy.zeros([nLats, nLons])
+ for iLats in numpy.arange(nLats):
+ for iLons in numpy.arange(nLons):
+ coefficients[iLats, iLons], levels[iLats, iLons] = (
+ stats.pearsonr(
+ reference_dataset.values[:, iLats, iLons],
+ target_dataset.values[:, iLats, iLons]
+ )
+ )
+ levels[iLats, iLons] = 1 - levels[iLats, iLons]
+ return coefficients, levels
class TemporalMeanBias(BinaryMetric):