-
Notifications
You must be signed in to change notification settings - Fork 6
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
Optimize wind turbulence calculation #13
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ly efficient instead of using circstd and modify testing to check whether the results of both methods are the same.
…urblance based on the new and old approaches
Signed-off-by: code_reformat <>
…sede-open/pyELQ into optimize_circstd_implementation
Signed-off-by: code_reformat <>
…sede-open/pyELQ into optimize_circstd_implementation
Signed-off-by: bvandekerkhof <[email protected]>
bvandekerkhof
approved these changes
Sep 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for implementing.
Signed-off-by: bvandekerkhof <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The motivation for the pull request is to optimize the calculation of wind turbulence in meteorology class to speed up the calculation by a factor of 100. This is very useful when meteorology data is large.
The function calculate_wind_turbulence_horizontal in the meteorology class is modified and instead of using rolling.apply(scipy.stats.circstd) for a window of choosing, the equation for calculating circstd is used enabling the use of rolling.mean which is 100 times faster. The rolling.apply is like performing a loop over the data and built in rolling methods such as rolling.mean are optimized for the speed.
Following is a piece of code that illustrate the time-efficiency of the proposed method by comparing the time it takes to calculate the horizontal wind turbulence using the circstd and optimized method.
Running the above code gives the following results
Time took to calculate wind turbulence using circstd function is 1.6943280000014056 seconds.
Time took to calculate wind turbulence using the optimized approach is 0.0017694999987725168 seconds.
Calculating wind turbulence using the optimized approach is 100 times faster than circstd function: True
Optimized approach for calculating the wind turbulence is identical to those from the circstd: True
Fixes # (issue)
The time-inefficient calculation of the wind turbulence in case of having large meteorology data.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
It has been tested using the above piece of code that the optimized approach for calculating the wind turbulence gives the same results as circstd function (scipy.stats.circstd).
It has been also tested that the proposed change speeds up the calculation of the wind turbulence by a factor of 100.
Checklist: