Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] allow sub-daily inputs to degradation_year_on_year #315

Draft
wants to merge 3 commits into
base: development
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions rdtools/degradation.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,6 @@ def degradation_year_on_year(energy_normalized, recenter=True,
energy_normalized.name = 'energy'
energy_normalized.index.name = 'dt'

# Detect sub-daily data:
if min(np.diff(energy_normalized.index.values, n=1)) < \
np.timedelta64(23, 'h'):
raise ValueError('energy_normalized must not be '
'more frequent than daily')

# Detect less than 2 years of data
if energy_normalized.index[-1] - energy_normalized.index[0] < \
pd.Timedelta('730d'):
Expand All @@ -245,6 +239,9 @@ def degradation_year_on_year(energy_normalized, recenter=True,
else:
renorm = 1.0

is_leap_day = energy_normalized.index.strftime('%m-%d') == '02-28'
energy_normalized = energy_normalized.loc[~is_leap_day]

energy_normalized = energy_normalized.reset_index()
energy_normalized['energy'] = energy_normalized['energy'] / renorm

Expand Down