Skip to content

Commit

Permalink
bug fix for daily cs ghi == 0 causing nan values in clearsky ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
grantbuster committed Aug 16, 2024
1 parent f71cb86 commit 89a27e8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sup3r/bias/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,13 @@ def _reduce_base_data(
if cs_ratio:
daily_ghi = df.groupby('date').sum()['base_data'].values
daily_cs_ghi = df.groupby('date').sum()['base_cs_ghi'].values
daily_ghi[daily_cs_ghi == 0] = 0
daily_cs_ghi[daily_cs_ghi == 0] = 1
base_data = daily_ghi / daily_cs_ghi
msg = (
'Could not calculate daily average "clearsky_ratio" with '
'base_data and base_cs_ghi inputs: \n{}, \n{}'.format(
base_data, base_cs_ghi
)
)
mask = np.isnan(base_data)
msg = ('Could not calculate daily average "clearsky_ratio" with '
'input ghi and cs ghi inputs: \n{}, \n{}'
.format(daily_ghi[mask], daily_cs_ghi[mask]))
assert not np.isnan(base_data).any(), msg

elif daily_reduction.lower() in ('avg', 'average', 'mean'):
Expand Down

0 comments on commit 89a27e8

Please sign in to comment.