Skip to content
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

Bins array limits #268

Open
HIKassem opened this issue May 24, 2024 · 2 comments
Open

Bins array limits #268

HIKassem opened this issue May 24, 2024 · 2 comments

Comments

@HIKassem
Copy link
Contributor

bins = np.linspace(np.min(var), np.max(var), 6)
if isinstance(bins, int):
bins = np.linspace(np.min(var), np.max(var), bins)

In cases where bins argument isn't provided by the user. Both np.min and np.max functions may return nan if the var array has nan values. I think simply replacing them with np.nanmin and np.nanmax would fix this issue. Otherwise just an error message would be nice at this point because currently matplotlib throws an error which is hard to trace to this issue.

@ocefpaf
Copy link
Collaborator

ocefpaf commented May 24, 2024

While I do like the np.nan(min/max) idea I think that we should not assume a lot about user data. Maybe checking for NaNs and trowing an error is better and let the user fix that in the way they prefer, like specifying the bins or using the nan min/max themselves.

Do you want to send a PR for that?

@HIKassem
Copy link
Contributor Author

Sure, no problem.

HIKassem added a commit to HIKassem/windrose that referenced this issue May 28, 2024
ocefpaf added a commit that referenced this issue May 29, 2024
check input bins validity issue #268
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants