Skip to content

Commit

Permalink
check input bins validity issue python-windrose#268
Browse files Browse the repository at this point in the history
  • Loading branch information
HIKassem authored and Hassan Kassem committed May 28, 2024
1 parent 47ab1b5 commit e0b6134
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions windrose/windrose.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ def _init_plot(self, direction, var, **kwargs):
bins = np.asarray(bins)
nbins = len(bins)

if np.isnan(bins).any():
raise ValueError(
"Input bins contain NaN values. If bins are not explicitly "\
"provided as 1D array, that means var array has NaN values.")

# Number of sectors
nsector = kwargs.pop("nsector", None)
if nsector is None:
Expand Down

0 comments on commit e0b6134

Please sign in to comment.