Repository navigation
Conversation
When custom direction_bin_labels (e.g. ['northerly', 'easterly', ...]) are passed to Shear.BySector, plot_shear_by_sector() fails with IndexError because re.findall() cannot extract numeric bin edges from non-numeric label strings. Fix: Try extracting numbers from index label first; if that fails (fewer than 2 numbers found), use direction_bin_array to compute bin edges. Added direction_bin_array parameter to plot_shear_by_sector() and updated Shear.BySector to pass it through. Fixes brightwind-dev#636
|
Hi — I want to double-check one detail of the |
|
Following up on the What the branch changes, concretely:
The original failure was that with custom text labels such as One thing worth flagging for review: the fallback relies on If you would prefer a different resolution order (for example, always using |
Summary
Fix IndexError in plot_shear_by_sector() when custom direction_bin_labels are used with Shear.BySector().
Problem
The function uses a regex to extract numeric bin edges from index labels. When labels are non-numeric (custom text labels), the regex returns an empty list, causing IndexError at index [0].
Solution
Changes
Fixes #636