[
https://issues.apache.org/jira/browse/CLIMATE-542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14198725#comment-14198725
]
Ross Laidlaw commented on CLIMATE-542:
--------------------------------------
Here's the original code from
https://github.com/apache/climate/blob/master/rcmet/src/main/python/rcmes/toolkit/metrics_kyo.py#L393:
{code}
def calcTemporalCorrelation(evaluationData, referenceData):
'''
Purpose ::
Calculate the temporal correlation.
Assumption(s) ::
The first dimension of two datasets is the time axis.
Input ::
evaluationData - model data array of any shape
referenceData- observation data array of any shape
Output::
temporalCorelation - A 2-D array of temporal correlation coefficients
at each subregion
sigLev - A 2-D array of confidence levels related to temporalCorelation
REF: 277-281 in Stat methods in atmos sci by Wilks, 1995, Academic Press,
467pp.
sigLev: the correlation between model and observation is significant at
sigLev * 100 %
'''
evaluationDataMask = process.create_mask_using_threshold(evaluationData,
threshold = 0.75)
referenceDataMask = process.create_mask_using_threshold(referenceData,
threshold = 0.75)
nregion = evaluationData.shape[0]
temporalCorrelation = ma.zeros([nregion])-100.
sigLev = ma.zeros([nregion])-100.
for iregion in np.arange(nregion):
temporalCorrelation[iregion], sigLev[iregion] =
stats.pearsonr(evaluationData[iregion,:], referenceData[iregion,:])
sigLev[iregion] = 1 - sigLev[iregion]
temporalCorrelation=ma.masked_equal(temporalCorrelation.data, -100.)
sigLev=ma.masked_equal(sigLev.data, -100.)
return temporalCorrelation, sigLev
{code}
I think we can remove the following lines, as {{evaluationDataMask}} and
{{referenceDataMask}} aren't used in the method after they've been initialized:
{code}
evaluationDataMask = process.create_mask_using_threshold(evaluationData,
threshold = 0.75)
referenceDataMask = process.create_mask_using_threshold(referenceData,
threshold = 0.75)
{code}
> Port 'calcTemporalCorrelation' method over to ocw/metrics.py module
> -------------------------------------------------------------------
>
> Key: CLIMATE-542
> URL: https://issues.apache.org/jira/browse/CLIMATE-542
> Project: Apache Open Climate Workbench
> Issue Type: Sub-task
> Components: metrics
> Affects Versions: 0.4
> Reporter: Ross Laidlaw
> Assignee: Ross Laidlaw
> Fix For: 0.5
>
>
> Port the 'calcTemporalCorrelation' method from
> rcmet/src/main/python/rcmes/toolkit/metrics_kyo.py to ocw/metrics.py.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)