Skip to content

Commit

Permalink
make a few more functions private (#222)
Browse files Browse the repository at this point in the history
* make a few more functions private

* update change log

* Deprecate instead

* Add backticks in doc string for normalize_with_expected_power
  • Loading branch information
mdeceglie authored Oct 20, 2020
1 parent 5e5d120 commit 93e6980
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/sphinx/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ Normalization
.. autosummary::
:toctree: generated/

check_series_frequency
delta_index
energy_from_power
interpolate
irradiance_rescale
Expand All @@ -103,6 +101,8 @@ Normalization
normalize_with_sapm
pvwatts_dc_power
sapm_dc_power
delta_index
check_series_frequency


Aggregation
Expand Down
1 change: 1 addition & 0 deletions docs/sphinx/source/changelog/v2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Deprecations
:py:func:`~rdtools.normalization.normalize_with_sapm` have been deprecated
in favor of :py:func:`~rdtools.normalization.normalize_with_expected_power`.
(:pull:`215`)
* :py:func:`~rdtools.normalization.delta_index` and :py:func:`~rdtools.normalization.check_series_frequency` (:pull:`222`)

Enhancements
------------
Expand Down
18 changes: 12 additions & 6 deletions rdtools/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def normalize_with_expected_power(pv, power_expected, poa_global,
Right-labeled time series of plane-of-array irradiance associated with
``expected_power``
pv_input : {'power' or 'energy'}
Specifies the type of input used for pv parameter. Default: 'power'
Specifies the type of input used for ``pv`` parameter. Default: 'power'
Returns
-------
Expand All @@ -40,7 +40,7 @@ def normalize_with_expected_power(pv, power_expected, poa_global,
'''

freq = check_series_frequency(pv, 'pv')
freq = _check_series_frequency(pv, 'pv')

if pv_input == 'power':
energy = energy_from_power(pv, freq, power_type='right_labeled')
Expand All @@ -50,8 +50,8 @@ def normalize_with_expected_power(pv, power_expected, poa_global,
else:
raise ValueError("Unexpected value for pv_input. pv_input should be 'power' or 'energy'.")

model_tds, mean_model_td = delta_index(power_expected)
measure_tds, mean_measure_td = delta_index(energy)
model_tds, mean_model_td = _delta_index(power_expected)
measure_tds, mean_measure_td = _delta_index(energy)

# Case in which the model less frequent than the measurements
if mean_model_td > mean_measure_td:
Expand Down Expand Up @@ -298,7 +298,7 @@ def normalize_with_sapm(energy, sapm_kws):
return energy_normalized, insolation


def delta_index(series):
def _delta_index(series):
'''
Takes a pandas series with a DatetimeIndex as input and
returns (time step sizes, average time step size) in hours
Expand Down Expand Up @@ -333,6 +333,9 @@ def delta_index(series):
return deltas, np.mean(deltas.dropna())


delta_index = deprecated('2.0.0', removal='3.0.0')(_delta_index)


def irradiance_rescale(irrad, irrad_sim, max_iterations=100,
method='iterative', convergence_threshold=1e-6):
'''
Expand Down Expand Up @@ -426,7 +429,7 @@ def _rmse(fact):
raise ValueError('Invalid method')


def check_series_frequency(series, series_description):
def _check_series_frequency(series, series_description):
'''
Returns the inferred frequency of a pandas series, raises ValueError
using ``series_description`` if it can't.
Expand Down Expand Up @@ -456,6 +459,9 @@ def check_series_frequency(series, series_description):
return freq


check_series_frequency = deprecated('2.0.0', removal='3.0.0')(_check_series_frequency)


def _t_step_nanoseconds(time_series):
'''
return a series of right labeled differences in the index of time_series
Expand Down

0 comments on commit 93e6980

Please sign in to comment.