8000 Adjust trend analysis interpolation behavior by mdeceglie · Pull Request #278 · NREL/rdtools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Adjust trend analysis interpolation behavior #278

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

Merged
merged 7 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Con 8000 versations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions rdtools/analysis_chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ def __init__(self, pv, poa_global=None, temperature_cell=None, temperature_ambie
pv = normalization.interpolate(pv, interp_freq, max_timedelta)
if poa_global is not None:
poa_global = normalization.interpolate(
poa_global, interp_freq, max_timedelta)
poa_global, pv.index, max_timedelta)
if temperature_cell is not None:
temperature_cell = normalization.interpolate(
temperature_cell, interp_freq, max_timedelta)
temperature_cell, pv.index, max_timedelta)
if temperature_ambient is not None:
temperature_ambient = normalization.interpolate(
temperature_ambient, interp_freq, max_timedelta)
temperature_ambient, pv.index, max_timedelta)
if power_expected is not None:
power_expected = normalization.interpolate(
power_expected, interp_freq, max_timedelta)
power_expected, pv.index, max_timedelta)
if isinstance(windspeed, pd.Series):
windspeed = normalization.interpolate(
windspeed, interp_freq, max_timedelta)
windspeed, pv.index, max_timedelta)

if pv_input == 'power':
self.pv_power = pv
Expand Down Expand Up @@ -169,25 +169,24 @@ def set_clearsky(self, pvlib_location=None, pv_azimuth=None, pv_tilt=None,
Pandas Time Series or single numeric value.

'''
interp_freq = self.interp_freq
max_timedelta = self.max_timedelta

if interp_freq is not None:
if self.interp_freq is not None:
if poa_global_clearsky is not None:
poa_global_clearsky = normalization.interpolate(
poa_global_clearsky, interp_freq, max_timedelta)
poa_global_clearsky, self.pv_energy.index, max_timedelta)
if temperature_cell_clearsky is not None:
temperature_cell_clearsky = normalization.interpolate(
temperature_cell_clearsky, interp_freq, max_timedelta)
temperature_cell_clearsky, self.pv_energy.index, max_timedelta)
if temperature_ambient_clearsky is not None:
temperature_ambient_clearsky = normalization.interpolate(
temperature_ambient_clearsky, interp_freq, max_timedelta)
temperature_ambient_clearsky, self.pv_energy.index, max_timedelta)
if isinstance(pv_azimuth, (pd.Series, pd.DataFrame)):
pv_azimuth = normalization.interpolate(
pv_azimuth, interp_freq, max_timedelta)
pv_azimuth, self.pv_energy.index, max_timedelta)
if isinstance(pv_tilt, (pd.Series, pd.DataFrame)):
pv_tilt = normalization.interpolate(
pv_tilt, interp_freq, max_timedelta)
pv_tilt, self.pv_energy.index, max_timedelta)

self.pvlib_location = pvlib_location
self.pv_azimuth = pv_azimuth
Expand Down
47 changes: 47 additions & 0 deletions rdtools/test/analysis_chains_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,53 @@ def sensor_analysis_exp_power(sensor_parameters):
return rd_analysis


def test_interpolation(basic_parameters, degradation_trend):

power = degradation_trend
shifted_index = power.index + pd.to_timedelta('8 minutes')

dummy_series = power * 0 + 25
dummy_series.index = shifted_index

basic_parameters['pv'] = power
basic_parameters['poa_global'] = dummy_series
basic_parameters['temperature_ambient'] = dummy_series
basic_parameters['temperature_cell'] = dummy_series
basic_parameters['windspeed'] = dummy_series
basic_parameters['power_expected'] = dummy_series
basic_parameters['interp_freq'] = 'H'

rd_analysis = TrendAnalysis(**basic_parameters)

pd.testing.assert_index_equal(rd_analysis.pv_energy.index,
rd_analysis.poa_global.index[1:])
pd.testing.assert_index_equal(rd_analysis.pv_energy.index,
rd_analysis.temperature_ambient.index[1:])
pd.testing.assert_index_equal(rd_analysis.pv_energy.index,
rd_analysis.temperature_cell.index[1:])
pd.testing.assert_index_equal(rd_analysis.pv_energy.index,
rd_analysis.windspeed.index[1:])
pd.testing.assert_index_equal(rd_analysis.pv_energy.index,
rd_analysis.power_expected.index[1:])

rd_analysis.set_clearsky(pv_azimuth=dummy_series,
pv_tilt=dummy_series,
poa_global_clearsky=dummy_series,
temperature_cell_clearsky=dummy_series,
temperature_ambient_clearsky=dummy_series)

pd.testing.assert_index_equal(rd_analysis.pv_energy.index,
rd_analysis.pv_azimuth.index)
pd.testing.assert_index_equal(rd_analysis.pv_energy.index,
rd_analysis.pv_tilt.index)
pd.testing.assert_index_equal(rd_analysis.pv_energy.index,
rd_analysis.poa_global_clearsky.in 56FD dex)
pd.testing.assert_index_equal(rd_analysis.pv_energy.index,
rd_analysis.temperature_cell_clearsky.index)
pd.testing.assert_index_equal(rd_analysis.pv_energy.index,
rd_analysis.temperature_ambient_clearsky.index)


def test_sensor_analysis(sensor_analysis):
yoy_results = sensor_analysis.results['sensor']['yoy_degradation']
rd = yoy_results['p50_rd']
Expand Down
0