BUG: fix wind heading and direction wraparound interpolation#974
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #974 +/- ##
===========================================
+ Coverage 80.27% 81.18% +0.91%
===========================================
Files 104 113 +9
Lines 12769 14698 +1929
===========================================
+ Hits 10250 11933 +1683
- Misses 2519 2765 +246 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
12f3f1e to
1e2f92d
Compare
Member
Author
Unwrap wind heading/direction angles (np.unwrap) before building the linear interpolation Function, then wrap back with % 360 on evaluation. This removes the spurious mid-altitude spikes that appeared when the profile crossed the 360/0 boundary (e.g. 350 deg -> 10 deg). The shared logic lives in a single private helper (__set_wind_angle_function) used by both wind setters, keeping the module under pylint's max-module-lines. Adds a unit test covering the wraparound case. Closes #253 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Gui-FernandesBR
added a commit
that referenced
this pull request
Jul 3, 2026
…ronmentAnalysis The per-date/hour wind_heading and wind_direction Function objects stored in EnvironmentAnalysis.original_pressure_level_data were never read internally: every consumer (surface_wind_direction_by_hour, average_wind_heading_profile and _by_hour, wind_heading_profiles_list) recomputes heading/direction from the wind velocity components (u/v) via arctan2 -- the correct circular method. The stored functions linearly interpolated raw degrees, so they also carried the 360/0 wraparound artifact fixed for the Environment class in #974. Removes the two Function constructions plus their now-unused current_units and conversion_dict entries. Direction/heading remain fully derivable from the retained wind_velocity_x / wind_velocity_y functions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Gui-FernandesBR
added a commit
that referenced
this pull request
Jul 3, 2026
…ronmentAnalysis (#1041) * MNT: remove redundant wind_heading/wind_direction functions from EnvironmentAnalysis The per-date/hour wind_heading and wind_direction Function objects stored in EnvironmentAnalysis.original_pressure_level_data were never read internally: every consumer (surface_wind_direction_by_hour, average_wind_heading_profile and _by_hour, wind_heading_profiles_list) recomputes heading/direction from the wind velocity components (u/v) via arctan2 -- the correct circular method. The stored functions linearly interpolated raw degrees, so they also carried the 360/0 wraparound artifact fixed for the Environment class in #974. Removes the two Function constructions plus their now-unused current_units and conversion_dict entries. Direction/heading remain fully derivable from the retained wind_velocity_x / wind_velocity_y functions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * DOC: add changelog entry for #1041 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or 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
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.

This fixes the issue where linear interpolation of wind heading and direction values over discrete altitudes caused unexpected spikes/wiggles around the 360/0 wraparound boundary.
Closes #253