[ 
https://issues.apache.org/jira/browse/CLIMATE-798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15333396#comment-15333396
 ] 

ASF GitHub Bot commented on CLIMATE-798:
----------------------------------------

Github user coveralls commented on the issue:

    https://github.com/apache/climate/pull/358
  
    
    [![Coverage 
Status](https://coveralls.io/builds/6621610/badge)](https://coveralls.io/builds/6621610)
    
    Coverage decreased (-0.4%) to 83.785% when pulling 
**82350ab92a9e4e0e7bb15cf9b56a3765b4c3e016 on jarifibrahim:CLIMATE-798** into 
**6b9fae9d5fe2432fd9a8c84e33976a78a2e8236e on apache:master**.



> Redundant code in evaluations.py
> --------------------------------
>
>                 Key: CLIMATE-798
>                 URL: https://issues.apache.org/jira/browse/CLIMATE-798
>             Project: Apache Open Climate Workbench
>          Issue Type: Bug
>            Reporter: Ibrahim Jarif
>            Assignee: Ibrahim Jarif
>            Priority: Minor
>
> The following 4 code sections in *evaluation.py* file are redundant and will 
> never execute under any working condition.
> 1. *convert_evaluation_result* function *lines 367 - 369*
> {code}
> if evaluation_result[0][imetric].ndim !=0:
>    ....
> else:
>         result = ma.zeros(nmodel)
>         for imodel in range(nmodel):
>              result[imodel] = evaluation_result[imodel][imetric]
> {code}
> The ndim of any possible index of *evaluation_result* array will always be 
> *greater than zero* because this function is only called by 
> *_run_subregion_evaluation* function (line 273) which appends an *[] element* 
> (line 278){code}results.append([])
> {code} to the *results* array (the result array is the evaluation_result 
> array). So the ndim value of all the indexes of result array *becomes greater 
> than zero* ( the ndim value of an empty array i.e array = [[]] is also 1).
> So the above if condition is always true and the else part is never executed. 
> Hence they should be removed.
> The next 3 points have same explanation as 1.
> 2. *convert_evaluation_result* function *lines 388 - 390*.
> {code}
> if evaluation_result[0][imetric][isubregion].ndim !=0:
>     ....
> else:
>     result = ma.zeros(nmodel)
>     for imodel in range(nmodel):
>         result[imodel] = evaluation_result[imodel][imetric][isubregion]
> {code}
> 3.*convert_unary_evaluation_result* function *lines 408 - 410*
> {code}
> if evaluation_result[imetric][0].ndim !=0:
>     ....
> else:
>     result = ma.zeros(nmodel)
>     for imodel in range(nmodel):
>         result[imodel] = evaluation_result[imetric][imodel]
> {code}
> 4.*convert_unary_evaluation_result* function *lines 429 - 431*
> {code}
> if evaluation_result[imetric][isubregion][0].ndim !=0:
>     ....
> else:
>     result = ma.zeros(nmodel) 
>     for imodel in range(nmodel):
>         result[imodel] = evaluation_result[imetric][isubregion][imodel]
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to