-
Notifications
You must be signed in to change notification settings - Fork 156
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
[BUGFIX] Circular upsampling across wind directions #943
Conversation
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.
@paulf81 thanks for the thorough PR description; that really helps make it clear what the bug was and how this works!
I've put in a few comments for you to consider, but none of them is critical I think, so I'm going ahead and approving this to ensure your other workflows can proceed. Feel free to address my comments as you see fit and merge when you're ready.
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.
This looks like the right approach to me, and I agree, very helpful description of the problem and solution.
@misi9170 and @ejsimley , sorry to do this, I had to make a few more medium-substantial changes, dealing with the wind direction range and sorting, I kept finding small bugs, and finally decided to pull out a few smaller functions to do the trickier bits so I can test a lot of possibilities directly. I think it was helpful but changed a bit the code so would appreciate a re-review, feel free to merge if happy! |
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.
This looks OK to me. @ejsimley , if you're happy, I can get this merged.
Fix upsample
(Note this is cleaned up version of #942 from a git history perspective, closing that one in favor of this one)
The upsample function in wind_data.py (both
WindRose
andWindTIRose
) has a subtle issue. Because the current implementation assumes the same range of wind directions and wind speeds in the resampled rose as in the original, there can be a gap in the range implied by the combination of the original wind direction steps and bin size. The issue is illustrated by the code snippet:Which produces:
This pull request fixes the issue by setting the new wind directions to cover the complete span of the covered directions. This change is not breaking per se, but does require changing some of the tests to match the new expected behavior. For example, a previous test was:
But note this result only extends to 267.5, not the 265 of the original version. The new test concludes with:
With the improvements, above figure is now:
Related issue
This pull request takes into more focus work originally done within #919 but we thought should be its own pull request to make the changes clearer
Impacted areas of the software
wind_data.py