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

Alex Goodman commented on CLIMATE-88:
-------------------------------------

Actually, I am not allocating a completely new array in my function. I am using 
what's called a view which just constructs a new ndarray object that shares the 
same data in memory with another one, but can have different attributes (eg 
shape).

http://wiki.scipy.org/Tentative_NumPy_Tutorial#head-4306be2ef34ad134f9fa0b87d426fa711119c167

This is done in the line:

data = dataset1[:]

The main reason I wanted this all in one helper function is because if I didn't 
I would have to manually calculate the new shape for every routine in 
metrics.py, so I would be saving several lines of code.

I think I should perhaps add a comment or two in the function that explains 
this so people who are unfamiliar with this don't get confused by it in the 
future.
                
> Performance improvements for metrics.py
> ---------------------------------------
>
>                 Key: CLIMATE-88
>                 URL: https://issues.apache.org/jira/browse/CLIMATE-88
>             Project: Apache Open Climate Workbench
>          Issue Type: Improvement
>          Components: metrics
>    Affects Versions: 0.1-incubating
>            Reporter: Alex Goodman
>            Assignee: Chris A. Mattmann
>             Fix For: 0.1-incubating
>
>         Attachments: benchmark_metrics.py, 
> benchmark_metrics_with_resize_method.py
>
>
> The performance for many of the functions in metrics.py can be improved by 
> removing some unnecessary loops and utilizing shape manipulation. 
> I have attached some example code that benchmarks the differences between the 
> original and proposed methodology if you did not see it in the mailing list.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to