Exemple #1
0
def test_check_poa_clearsky(mocker, times):
    dt = pd.date_range(start=datetime(2019, 6, 15, 12, 0, 0),
                       freq='15T', periods=5)
    poa_global = pd.Series(index=dt, data=[800, 1000, 1200, -200, np.nan])
    poa_clearsky = pd.Series(index=dt, data=1000)
    result = validator.check_poa_clearsky(poa_global, poa_clearsky)
    expected = pd.Series(index=dt, data=[True, True, False, True, False])
    assert_series_equal(result, expected)
    result = validator.check_poa_clearsky(poa_global, poa_clearsky, kt_max=1.2)
    expected = pd.Series(index=dt, data=[True, True, True, True, False])
    assert_series_equal(result, expected)
Exemple #2
0
def validate_poa_global(observation, values):
    """
    Run validation checks on a POA observation.

    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, poa_clearsky_flag : pandas.Series
        Integer bitmask series from
        :py:func:`.validator.check_timestamp_spacing`,
        :py:func:`.validator.check_irradiance_day_night`,
        :py:func:`.validator.check_poa_clearsky` respectively
    """
    solar_position, dni_extra, timestamp_flag, night_flag = _solpos_dni_extra(
        observation, values)
    clearsky = pvmodel.calculate_clearsky(
        observation.site.latitude, observation.site.longitude,
        observation.site.elevation, solar_position['apparent_zenith'])
    aoi_func = pvmodel.aoi_func_factory(observation.site.modeling_parameters)
    poa_clearsky = pvmodel.calculate_poa_effective(
        aoi_func=aoi_func, apparent_zenith=solar_position['apparent_zenith'],
        azimuth=solar_position['azimuth'], ghi=clearsky['ghi'],
        dni=clearsky['dni'], dhi=clearsky['dhi'])
    poa_clearsky_flag = validator.check_poa_clearsky(values, poa_clearsky,
                                                     _return_mask=True)
    return timestamp_flag, night_flag, poa_clearsky_flag