def test_check_ghi_limits_QCRad(irradiance_QCRad):
    expected = irradiance_QCRad
    ghi_out_expected = expected['ghi_limit_flag']
    ghi_out = validator.check_ghi_limits_QCRad(expected['ghi'],
                                               expected['solar_zenith'],
                                               expected['dni_extra'])
    assert_series_equal(ghi_out, ghi_out_expected)
예제 #2
0
def validate_ghi(observation, values):
    """
    Run validation checks on a GHI observation.

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

    Returns
    -------
    timestamp_flag : pandas.Series
        Bitmask from :py:func:`.validator.check_timestamp_spacing`
    night_flag : pandas.Series
        Bitmask from :py:func:`.validator.check_day_night` or
        :py:func:`.validator.check_day_night_interval`
    ghi_limit_flag : pandas.Series
        Bitmask from :py:func:`.validator.check_ghi_limits_QCRad`
    ghi_clearsky_flag : pandas.Series
        Bitmask from :py:func:`.validator.check_ghi_clearsky`
    cloud_free_flag : pandas.Series
        Bitmask from :py:func:`.validator.detect_clearsky_ghi`
    """
    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'])

    ghi_limit_flag = validator.check_ghi_limits_QCRad(values,
                                                      solar_position['zenith'],
                                                      dni_extra,
                                                      _return_mask=True)
    ghi_clearsky_flag = validator.check_ghi_clearsky(values,
                                                     clearsky['ghi'],
                                                     _return_mask=True)
    cloud_free_flag = validator.detect_clearsky_ghi(values,
                                                    clearsky['ghi'],
                                                    _return_mask=True)
    return (timestamp_flag, night_flag, ghi_limit_flag, ghi_clearsky_flag,
            cloud_free_flag)
예제 #3
0
def validate_ghi(observation, values):
    """
    Run validation checks on a GHI observation.

    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.check_irradiance_day_night`,
        `validator.check_ghi_limits_QCRad`,
        `validator.check_ghi_clearsky`
    """
    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'])

    ghi_limit_flag = validator.check_ghi_limits_QCRad(values,
                                                      solar_position['zenith'],
                                                      dni_extra,
                                                      _return_mask=True)
    ghi_clearsky_flag = validator.check_ghi_clearsky(values,
                                                     clearsky['ghi'],
                                                     _return_mask=True)
    return timestamp_flag, night_flag, ghi_limit_flag, ghi_clearsky_flag