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

Remove deprecated functions #419

Merged
merged 30 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c390d9b
add test for hour_angle_filter
martin-springer Apr 29, 2024
e366176
add test_directional_tukey_filter
martin-springer Apr 29, 2024
f99a214
add test_insolation_filter
martin-springer Apr 29, 2024
05b0af3
add test_two_way_window_filter
martin-springer Apr 29, 2024
dd06d29
add bootstrap additive test
martin-springer Apr 29, 2024
8172208
bootstrap_test fix linting
martin-springer Apr 29, 2024
c45d438
run blake
martin-springer Apr 30, 2024
4c84bdc
bootstrap test for value error
martin-springer Apr 30, 2024
f1378d9
irradiance rescale test for value error
martin-springer Apr 30, 2024
b072b57
test for ValueError
martin-springer Apr 30, 2024
6ac03a1
flake8 ignore E203
martin-springer Apr 30, 2024
73d60c0
add pvlib clearsky filter
martin-springer May 1, 2024
664a7a1
add aggregated filter tests to analysis chain tests
martin-springer May 21, 2024
0a11728
add missing line
martin-springer May 22, 2024
fb13bac
analysis chain hour angle filter test
martin-springer May 22, 2024
99d4913
liniting
martin-springer May 22, 2024
d942380
sensor_clearsky_filter vs sensor_pvlib_clearsky_filter
martin-springer Jun 25, 2024
42142c2
update pandocfilters to 1.5.1
martin-springer Jun 25, 2024
c6bf396
restrict numpy<2.0
martin-springer Jun 25, 2024
18e10f7
CODS testing turn on verbose flag
martin-springer Jun 25, 2024
8870cb6
remove deprecated sapm_dc_power()
martin-springer Jun 25, 2024
ebb966e
remove deprecated normalize_with_sapm()
martin-springer Jun 25, 2024
0f4d12c
remove normalize_with_sapm from init
martin-springer Jun 25, 2024
8d3e37c
add deprecations to changelog
martin-springer Jun 26, 2024
5d22195
remove unused pvlib import from normalization.py
martin-springer Jun 26, 2024
fc0ee0c
add pull request number to changelog
martin-springer Jun 26, 2024
616e358
Merge branch 'aggregated_filters_for_trials' into remove-deprecated-f…
mdeceglie Jul 2, 2024
33176ae
uncomment sensor_clearsky_filter block
mdeceglie Jul 2, 2024
197a203
remove blank line
mdeceglie Jul 2, 2024
1a8b45e
remove blank line from end of file
mdeceglie Jul 2, 2024
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
1 change: 0 additions & 1 deletion docs/sphinx/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ Normalization
irradiance_rescale
normalize_with_expected_power
normalize_with_pvwatts
normalize_with_sapm
pvwatts_dc_power
sapm_dc_power
delta_index
Expand Down
5 changes: 5 additions & 0 deletions docs/sphinx/source/changelog/pending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Requirements
------------
* Specified versions in ``requirements.txt`` and ``docs/notebook_requirements.txt`` have been updated (:pull:`412`)

Deprecations
------------
* Removed :py:func:`~rdtools.normalization.sapm_dc_power` (:pull:`419`)
* Removed :py:func:`~rdtools.normalization.normalize_with_sapm` (:pull:`419`)

Contributors
------------
* Martin Springer (:ghuser:`martin-springer`)
Expand Down
1 change: 0 additions & 1 deletion rdtools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from rdtools.normalization import normalize_with_sapm
from rdtools.normalization import normalize_with_pvwatts
from rdtools.normalization import irradiance_rescale
from rdtools.normalization import energy_from_power
Expand Down
133 changes: 0 additions & 133 deletions rdtools/normalization.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'''Functions for normalizing, rescaling, and regularizing PV system data.'''

import pandas as pd
import pvlib
import numpy as np
from scipy.optimize import minimize
import warnings
Expand Down Expand Up @@ -176,138 +175,6 @@ def normalize_with_pvwatts(energy, pvwatts_kws):
return energy_normalized, insolation


@deprecated(since='2.0.0', removal='3.0.0',
alternative='normalize_with_expected_power')
def sapm_dc_power(pvlib_pvsystem, met_data):
'''
Use Sandia Array Performance Model (SAPM) and PVWatts to compute the
effective DC power using measured irradiance, ambient temperature, and wind
speed. Effective irradiance and cell temperature are calculated with SAPM,
and DC power with PVWatts.

.. warning::
The ``pvlib_pvsystem`` argument must be a ``pvlib.pvsystem.LocalizedPVSystem``
object, which is no longer available as of pvlib 0.9.0. To use this function
you'll need to use an older version of pvlib.

Parameters
----------
pvlib_pvsystem : pvlib.pvsystem.LocalizedPVSystem
Object contains orientation, geographic coordinates, equipment
constants (including DC rated power in watts). The object must also
specify either the ``temperature_model_parameters`` attribute or both
``racking_model`` and ``module_type`` attributes to infer the temperature model parameters.
met_data : pandas.DataFrame
Measured irradiance components, ambient temperature, and wind speed.
Expected met_data DataFrame column names:
['DNI', 'GHI', 'DHI', 'Temperature', 'Wind Speed']

Note
----
All series are assumed to be right-labeled, meaning that the recorded
value at a given timestamp refers to the previous time interval

Returns
-------
power_dc : pandas.Series
DC power in watts derived using Sandia Array Performance Model and
PVWatts.
effective_poa : pandas.Series
Effective irradiance calculated with SAPM
'''

solar_position = pvlib_pvsystem.get_solarposition(met_data.index)

total_irradiance = pvlib_pvsystem\
.get_irradiance(solar_position['zenith'],
solar_position['azimuth'],
met_data['DNI'],
met_data['GHI'],
met_data['DHI'])

aoi = pvlib_pvsystem.get_aoi(solar_position['zenith'],
solar_position['azimuth'])

airmass = pvlib_pvsystem\
.get_airmass(solar_position=solar_position, model='kastenyoung1989')
airmass_absolute = airmass['airmass_absolute']

effective_irradiance = pvlib.pvsystem\
.sapm_effective_irradiance(poa_direct=total_irradiance['poa_direct'],
poa_diffuse=total_irradiance['poa_diffuse'],
airmass_absolute=airmass_absolute,
aoi=aoi,
module=pvlib_pvsystem.module)

temp_cell = pvlib_pvsystem\
.sapm_celltemp(total_irradiance['poa_global'],
met_data['Temperature'],
met_data['Wind Speed'])

power_dc = pvlib_pvsystem\
.pvwatts_dc(g_poa_effective=effective_irradiance,
temp_cell=temp_cell)

return power_dc, effective_irradiance


@deprecated(since='2.0.0', removal='3.0.0',
alternative='normalize_with_expected_power')
def normalize_with_sapm(energy, sapm_kws):
'''
Normalize system AC energy output given measured met_data and
meteorological data. This method relies on the Sandia Array Performance
Model (SAPM) to compute the effective DC energy using measured irradiance,
ambient temperature, and wind speed.

Energy timeseries and met_data timeseries can be different granularities.

.. warning::
The ``pvlib_pvsystem`` argument must be a ``pvlib.pvsystem.LocalizedPVSystem``
object, which is no longer available as of pvlib 0.9.0. To use this function
you'll need to use an older version of pvlib.

Parameters
----------
energy : pandas.Series
Energy time series to be normalized in watt hours.
Must be a right-labeled regular time series.
sapm_kws : dict
Dictionary of parameters required for sapm_dc_power function. See
Other Parameters.

Other Parameters
---------------
pvlib_pvsystem : pvlib.pvsystem.LocalizedPVSystem object
Object contains orientation, geographic coordinates, equipment
constants (including DC rated power in watts). The object must also
specify either the ``temperature_model_parameters`` attribute or both
``racking_model`` and ``module_type`` to infer the model parameters.
met_data : pandas.DataFrame
Measured met_data, ambient temperature, and wind speed. Expected
column names are ['DNI', 'GHI', 'DHI', 'Temperature', 'Wind Speed']

Note
----
All series are assumed to be right-labeled, meaning that the recorded
value at a given timestamp refers to the previous time interval

Returns
-------
energy_normalized : pandas.Series
Energy divided by Sandia Model DC energy.
insolation : pandas.Series
Insolation associated with each normalized point
'''

power_dc, irrad = sapm_dc_power(**sapm_kws)

energy_normalized, insolation = normalize_with_expected_power(energy, power_dc, irrad,
pv_input='energy')

return energy_normalized, insolation


def _delta_index(series):
'''
Takes a pandas series with a DatetimeIndex as input and
Expand Down
1 change: 1 addition & 0 deletions rdtools/test/bootstrap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test_bootstrap_module(
cods_normalized_daily,
cods_normalized_daily_wo_noise,
decomposition_type=decomposition_type)

else:
# Rest make time serie bootstrap samples and construct of confidence intervals.
# Test make bootstrap samples
Expand Down
1 change: 1 addition & 0 deletions rdtools/test/irradiance_rescale_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def test_rescale(method, simple_irradiance):
if method == "error":
with pytest.raises(ValueError):
irradiance_rescale(simple_irradiance, simple_irradiance * 1.05, method=method)

else:
modeled = simple_irradiance
measured = 1.05 * simple_irradiance
Expand Down
125 changes: 0 additions & 125 deletions rdtools/test/normalization_sapm_test.py

This file was deleted.

Loading