예제 #1
0
def validate_daily_ac_power(observation, values):
    """
    Run a number of validation checks on a daily timeseries of AC power.

    Parameters
    ----------
    observation : solarforecastarbiter.datamodel.Observation
       Observation object that the data is associated with
    values : pandas.Series
       Series of observation values

    Returns
    -------
    timestamp_flag, night_flag, limit_flag, stale_flag, interpolation_flag, clipping_flag : pandas.Series
        Integer bitmask series from
        :py:func:`.validator.check_timestamp_spacing`,
        :py:func:`.validator.check_irradiance_day_night`,
        :py:func:`.validator.check_power_limits`,
        :py:func:`.validator.detect_stale_values`,
        :py:func:`.validator.detect_interpolation`,
        :py:func:`.validator.detect_clipping`
    """  # NOQA: E501
    timestamp_flag, night_flag, ac_limit_flag = validate_ac_power(observation,
                                                                  values)
    stale_flag, interpolation_flag = _validate_stale_interpolated(observation,
                                                                  values)
    clipping_flag = validator.detect_clipping(values, _return_mask=True)
    return (timestamp_flag, night_flag, ac_limit_flag, stale_flag,
            interpolation_flag, clipping_flag)
예제 #2
0
def validate_daily_ac_power(observation, values):
    """
    Run a number of validation checks on a daily timeseries of AC power.

    Parameters
    ----------
    observation : solarforecastarbiter.datamodel.Observation
       Observation object that the data is associated with
    values : pandas.Series
       Series of observation values

    Returns
    -------
    tuple
        Tuple of integer bitmask series of flags from the following tests, in
        order,
        `validator.check_timestamp_spacing`
        `validator.detect_stale_values`
        `validator.detect_interpolation`
        `validator.detect_clipping`
    """
    timestamp_flag = _validate_timestamp(observation, values)
    stale_flag = validator.detect_stale_values(values, _return_mask=True)
    interpolation_flag = validator.detect_interpolation(values,
                                                        _return_mask=True)
    clipping_flag = validator.detect_clipping(values, _return_mask=True)
    return (timestamp_flag, stale_flag, interpolation_flag, clipping_flag)
예제 #3
0
def test_detect_clipping(ghi_clipped):
    placeholder = pd.Series(index=ghi_clipped.index, data=False)
    expected = placeholder.copy()
    # for window=4 and fraction_in_window=0.75
    expected.iloc[3:6] = True
    expected.iloc[14:17] = True
    expected.iloc[18:20] = True
    expected.iloc[25] = True
    expected.iloc[30:36] = True
    expected.iloc[38:46] = True
    expected.iloc[56:60] = True
    flags = validator.detect_clipping(ghi_clipped, window=4,
                                      fraction_in_window=0.75, rtol=5e-3,
                                      levels=4)
    assert_series_equal(flags, expected)