diff --git a/docs/sphinx/source/api.rst b/docs/sphinx/source/api.rst index 1386ee5f..fe3be2e0 100644 --- a/docs/sphinx/source/api.rst +++ b/docs/sphinx/source/api.rst @@ -93,8 +93,6 @@ Normalization .. autosummary:: :toctree: generated/ - check_series_frequency - delta_index energy_from_power interpolate irradiance_rescale @@ -103,6 +101,8 @@ Normalization normalize_with_sapm pvwatts_dc_power sapm_dc_power + delta_index + check_series_frequency Aggregation diff --git a/docs/sphinx/source/changelog/v2.0.0.rst b/docs/sphinx/source/changelog/v2.0.0.rst index 0cb5396d..1a8a5222 100644 --- a/docs/sphinx/source/changelog/v2.0.0.rst +++ b/docs/sphinx/source/changelog/v2.0.0.rst @@ -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 ------------ diff --git a/rdtools/normalization.py b/rdtools/normalization.py index c6cb2753..fe9c3665 100644 --- a/rdtools/normalization.py +++ b/rdtools/normalization.py @@ -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 ------- @@ -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') @@ -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: @@ -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 @@ -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): ''' @@ -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. @@ -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