How to use the solarforecastarbiter.validation.quality_mapping.mask_flags function in solarforecastarbiter

To help you get started, we’ve selected a few solarforecastarbiter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / validation / validator.py View on Github external
@mask_flags('LIMITS EXCEEDED')
def check_dni_limits_QCRad(dni, solar_zenith, dni_extra, limits=None):
    """
    Tests for physical limits on DNI using the QCRad criteria.

    Test passes if a value > lower bound and value < upper bound. Lower bounds
    are constant for all tests. Upper bounds are calculated as

    .. math::
        ub = min + mult * dni_extra * cos( solar_zenith)^exp

    Parameters
    ----------
    dni : Series
        Direct normal irradiance in W/m^2
    solar_zenith : Series
        Solar zenith angle in degrees
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / validation / validator.py View on Github external
@mask_flags('STALE VALUES', invert=False)
def detect_stale_values(x, window=6, rtol=1e-5, atol=1e-8):
    """ Detects stale data.

    For a window of length N, the last value (index N-1) is considered stale
    if all values in the window are close to the first value (index 0).

    Parameters
    ----------
    x : Series
        data to be processed
    window : int, default 6
        number of consecutive values which, if unchanged, indicates stale data
    rtol : float, default 1e-5
        relative tolerance for detecting a change in data values
    atol : float, default 1e-8
        absolute tolerance for detecting a change in data values
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / validation / validator.py View on Github external
@mask_flags('LIMITS EXCEEDED')
def check_wind_limits(wind_speed, wind_limits=(0., 50.)):
    """ Checks for extreme wind speeds.

    Parameters
    ----------
    wind_speed : Series
        Wind speed in m/s
    wind_limits : tuple, default (0, 50)
        (lower bound, upper bound) for wind speed.

    Returns
    -------
    extreme_wind_flag : Series
        True if wind_speed > lower bound and wind_speed < upper bound.
    """
    extreme_wind_flag = _check_limits(wind_speed, lb=wind_limits[0],
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / validation / validator.py View on Github external
@mask_flags('CLEARSKY EXCEEDED')
def check_ghi_clearsky(ghi, ghi_clearsky, kt_max=1.1):
    """
    Flags GHI values greater than clearsky values.

    Parameters
    ----------
    ghi : Series
        Global horizontal irradiance in W/m^2
    ghi_clearsky : Series
         Global horizontal irradiance in W/m^2 under clear sky conditions
    kt_max : float
        maximum clearness index that defines when ghi exceeds clear-sky value.

    Returns
    -------
    flags : Series
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / validation / validator.py View on Github external
@mask_flags('CLIPPED VALUES', invert=False)
def detect_clipping(ac_power, window=4, fraction_in_window=0.75, rtol=5e-3,
                    levels=2):
    """ Detects clipping in a series of AC power.

    Possible clipped power levels are found by detect_levels. Within each
    sliding window, clipping is indicated when at least fraction_in_window
    of points are close to a clipped power level.

    Parameters
    ----------
    ac_power : Series
        data to be processed

    window : int
        number of data points defining the length of a rolling window
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / validation / validator.py View on Github external
@mask_flags('INCONSISTENT IRRADIANCE COMPONENTS')
def check_irradiance_consistency_QCRad(ghi, solar_zenith, dni_extra, dhi, dni,
                                       param=None):
    """
    Checks consistency of GHI, DHI and DNI. Not valid for night time.

    Parameters
    ----------
    ghi : Series
        Global horizontal irradiance in W/m^2
    solar_zenith : Series
        Solar zenith angle in degrees
    dni_extra : Series
        Extraterrestrial normal irradiance in W/m^2
    dhi : Series
        Diffuse horizontal irradiance in W/m^2
    dni : Series
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / validation / validator.py View on Github external
@mask_flags('LIMITS EXCEEDED')
def check_dhi_limits_QCRad(dhi, solar_zenith, dni_extra, limits=None):
    """
    Tests for physical limits on DHI using the QCRad criteria.

    Test passes if a value > lower bound and value < upper bound. Lower bounds
    are constant for all tests. Upper bounds are calculated as

    .. math::
        ub = min + mult * dni_extra * cos( solar_zenith)^exp

    Parameters
    ----------
    dhi : Series
        Diffuse horizontal irradiance in W/m^2
    solar_zenith : Series
        Solar zenith angle in degrees
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / validation / validator.py View on Github external
@mask_flags('LIMITS EXCEEDED')
def check_irradiance_limits_QCRad(solar_zenith, dni_extra, ghi=None, dhi=None,
                                  dni=None, limits=None):
    """
    Tests for physical limits on GHI, DHI or DNI using the QCRad criteria.

    Test passes if a value > lower bound and value < upper bound. Lower bounds
    are constant for all tests. Upper bounds are calculated as

    .. math::
        ub = min + mult * dni_extra * cos( solar_zenith)^exp

    Parameters
    ----------
    solar_zenith : Series
        Solar zenith angle in degrees
    dni_extra : Series
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / validation / validator.py View on Github external
@mask_flags('LIMITS EXCEEDED')
def check_ac_power_limits(power, solar_zenith, capacity,
                          capacity_limit_low=-0.05,
                          capacity_limit_high_day=1.05,
                          capacity_limit_high_night=0.05):
    """ Checks for extreme AC power.

    Parameters
    ----------
    power : Series
        DC or AC power.
    solar_zenith : Series
        Solar zenith angle in degrees.
    capacity : float
        AC capacity.
    capacity_limit_low : float
        Lower bound in fraction of capacity.
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / validation / validator.py View on Github external
@mask_flags('CLEARSKY EXCEEDED')
def check_poa_clearsky(poa_global, poa_clearsky, kt_max=1.1):
    """
    Flags plane of array irradiance values greater than clearsky values.

    Parameters
    ----------
    poa_global : Series
        Plane of array irradiance in W/m^2
    poa_clearsky : Series
        Plane of array irradiance under clear sky conditions, in W/m^2
    kt_max : float
        maximum allowed ratio of poa_global to poa_clearsky

    Returns
    -------
    flags : Series