check the provided bins arguments and raise an Error if wrong #275
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.
previously when specifying bins that did not include all (wind speed-) data, the data was simply not displayed and silently ignored.
it now raises an error and displays a helpful message.
Some example:
We define custom bins
everything works as expected
The resulting plot
We define custom bins not starting at
0
We're silently losing 20% of our data (everything below the lowest bin)!
The resulting plot
We define custom bins and a
calm_limim
. The custom bins are below thecalm_limit
We're getting an incorrect legend showing bins with data that was excluded with the
calm_limit
filter. The plot itself is correct.The resulting plot
We will now get an error. For the first example:
For the 2nd example:
I think raising an error is the correct way. We force the user to be explicit. We could of course silently change the
bins
value according tocalm_limit
or the minimum data. However, the user was already explicit by manually providingbins
and/orcalm_limit
as kwargs. They might as well provide the correct values.The way it is now gave me quite a headache debugging why things did not add up to 100%.
In my example for the subplots in
usage.ipynb
this was correct (by accident).Happy to hear your thoughts on this!
...ah there was a ruff warning I fixed in
pyproject.toml
...in the baseline plots only the legend changed from 0.0 to 0.2 (the
calm_limit
)