-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MATLAB warning flags #5
Comments
Most warning flag is due to the fact that many variables' size would change during loops, so MATLAB automatically suggest parallel computation. But parallel computation is actually not suitable for this case. As what mentioned in manuscript, parallel computation is not suitable here as the size of the resultant MHW/MCS dataset would change with loops, which is against the rule that each loop should be independent of others in a parallel computation. It should be noted that parallel computation could be used if each detected event is stored independently. However, this would mean that another loop should be included to all events into one composite. We have tested this approach and found that it would not be faster than the version using simple loops |
My understanding of the JOSS review process is that it's supposed to help improve code not just check that it works. The comments below are given in that spirit, but I am quite happy for them to be ignored if I have misunderstood, and if the Editor feels these are not appropriate or necessary for publication. Eliminating the warning flags would be a useful exercise especially if combined with improvements to readability and style throughout. The code is not easy to follow for several reasons: (1) there is a lack of comments within the functions describing what is going on; (2) some basic good practices are ignored, such as spaces around
These work equally well - and marginally faster - if you simply put:
For example, part of your code in mhwint_max = [];
for le = 1:size(potential_event,1)
maxanom = <some code>;
mhwint_max = [mhwint_max; maxanom];
end To preallocate you would change this to: mhwint_max = NaN(size(potential_event,1),1);
for le = 1:size(potential_event,1)
maxanom = <some code>;
mhwint_max(le) = maxanom;
end This allows your computer to use memory more efficiently and your code to run faster.
|
Thanks a lot for careful and thoughtful review. I have edited the script for your suggestion. Thanks a lot. Now most warning flag has been removed. I need to mention that |
Hi @mvdh7. for your consideration, I send the toolbox to @codacy-badger and get the code quality A. Please see https://github.com/ZijieZhaoMMHW/m_mhw1.0 |
Nice work. I hope this has helped improve the code. Thank you for pointing out the code quality tester - I hadn't come across that before. However, I don't think it supports MATLAB, so the badge it has given may not be very meaningful. |
For JOSS review
The MATLAB code for the functions themselves contains many warning messages indicating inefficient or unnecessary constructs. I strongly suggest the authors work through and eliminate these, to improve code legibility, and in some cases, its performance.
The text was updated successfully, but these errors were encountered: