diff --git a/src/ampycloud/layer.py b/src/ampycloud/layer.py index a53ff11..d436eb6 100644 --- a/src/ampycloud/layer.py +++ b/src/ampycloud/layer.py @@ -247,9 +247,12 @@ def _calc_base_alt(vals, lookback_perc, alt_perc): - int(len(vals) * lookback_perc / 100): ] n_largest_elements = vals[n_largest_idxs] - print("NLARGEST") - print(n_largest_elements) - print(vals) + if len(n_largest_elements) == 0: + warnings.warn( + 'Cloud base calculation got an empty array.' + 'Maybe check lookback percentage (is set to %i)' %lookback_perc + ) + return np.nan return np.percentile(n_largest_elements, alt_perc) mean_comp_heights = [