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 8052b94 commit af7a13f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sup3r/bias/bias_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,10 +689,13 @@ def _reduce_base_data(base_ti, base_data, base_cs_ghi, base_dset,
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
mask = np.isnan(base_data)
msg = ('Could not calculate daily average "clearsky_ratio" with '
'base_data and base_cs_ghi inputs: \n{}, \n{}'
.format(base_data, base_cs_ghi))
'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 af7a13f

Please sign in to comment.