Skip to content

Commit

Permalink
AMAROC-681 handle empty array in cloud base calc
Browse files Browse the repository at this point in the history
  • Loading branch information
regDaniel committed Nov 9, 2023
1 parent 1c8e379 commit 5d0fcbc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ampycloud/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit 5d0fcbc

Please sign in to comment.