diff --git a/windrose/windrose.py b/windrose/windrose.py index cb3c68b..1f2159a 100644 --- a/windrose/windrose.py +++ b/windrose/windrose.py @@ -376,6 +376,12 @@ def _init_plot(self, direction, var, **kwargs): bins = np.asarray(bins) nbins = len(bins) + if np.isnan(bins).any(): + raise ValueError( + "Could not compute the bins due to the presence of NaNs in " + "either the bins provided or the original data.", + ) + # Number of sectors nsector = kwargs.pop("nsector", None) if nsector is None: