How to use the pvlib.irradiance.get_extra_radiation function in pvlib

To help you get started, we’ve selected a few pvlib 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 sunspec / prodromos / forecasting / pv_forecast_dev.py View on Github external
Returns
    ----------
    poa : pandas Series
        plane-of-array irradiance
    """

    # get solar position information
    sp = solar_position(pvobj, dr)
    zenith = sp['zenith']
    apparent_zenith = sp['zenith']
    solar_azimuth = sp['azimuth']

#    clearSky['zenith'] = sp['zenith']
#    clearSky['elevation'] = sp['elevation']

    extraI = pvlib.irradiance.get_extra_radiation(dr)

    # calculate GHI using Haurwitz model
    haurwitz = pvlib.clearsky.haurwitz(apparent_zenith)
    ghi = haurwitz['ghi']

    disc = pvlib.irradiance.disc(ghi, zenith, dr)
    #dniDiscIrrad(clearSky)
    dni = disc['dni']

    dhi = ghi - dni * np.sin((90.0 - zenith) * (np.pi / 180))

    if not pvobj.tracking:
        aoi = pvlib.irradiance.aoi(surface_tilt=pvobj.tilt,
                                   surface_azimuth=pvobj.azimuth,
                                   solar_zenith=zenith,
                                   solar_azimuth=solar_azimuth)
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / pvmodel.py View on Github external
surface_tilt : float or pd.Series
    surface_azimuth : float or pd.Series
    aoi : pd.Series
    apparent_zenith : pd.Series
        Solar apparent zenith
    azimuth : pd.Series
        Solar azimuth
    ghi : pd.Series
    dni : pd.Series
    dhi : pd.Series

    Returns
    -------
    poa_effective : pd.Series
    """
    dni_extra = pvlib.irradiance.get_extra_radiation(apparent_zenith.index)
    poa_sky_diffuse = pvlib.irradiance.get_sky_diffuse(
        surface_tilt, surface_azimuth,
        apparent_zenith, azimuth,
        dni, ghi, dhi,
        dni_extra=dni_extra,
        model='haydavies')
    poa_ground_diffuse = pvlib.irradiance.get_ground_diffuse(
        surface_tilt, ghi, albedo=0.25)
    aoi_modifier = pvlib.iam.physical(aoi)
    beam_effective = dni * aoi_modifier
    poa_effective = beam_effective + poa_sky_diffuse + poa_ground_diffuse
    # aoi, tilt, azi is not defined for tracking systems
    # when sun is below horizon. replace nan with 0
    poa_effective = poa_effective.where(aoi.notna(), other=0.)
    return poa_effective
github SunPower / pvfactors / pvfactors / irradiance / utils.py View on Github external
df_inputs : `pandas.DataFrame`
        Dataframe with the following columns:
        ['solar_zenith', 'solar_azimuth', 'surface_tilt', 'surface_azimuth',
        'dhi', 'dni', 'vf_horizon', 'vf_circumsolar', 'vf_isotropic',
        'luminance_horizon', 'luminance_circuqmsolar', 'luminance_isotropic',
        'poa_isotropic', 'poa_circumsolar', 'poa_horizon', 'poa_total_diffuse']

    """
    # Create a dataframe to help filtering on all arrays
    df_inputs = pd.DataFrame(
        {'surface_tilt': surface_tilt, 'surface_azimuth': surface_azimuth,
         'solar_zenith': solar_zenith, 'solar_azimuth': solar_azimuth,
         'dni': dni, 'dhi': dhi},
        index=pd.DatetimeIndex(timestamps))

    dni_et = irradiance.get_extra_radiation(df_inputs.index.dayofyear)
    am = atmosphere.get_relative_airmass(df_inputs.solar_zenith)

    # Need to treat the case when the sun is hitting the back surface of pvrow
    aoi_proj = irradiance.aoi_projection(
        df_inputs.surface_tilt, df_inputs.surface_azimuth,
        df_inputs.solar_zenith, df_inputs.solar_azimuth)
    sun_hitting_back_surface = ((aoi_proj < 0) &
                                (df_inputs.solar_zenith <= 90))
    df_inputs_back_surface = df_inputs.loc[sun_hitting_back_surface].copy()
    # Reverse the surface normal to switch to back-surface circumsolar calc
    df_inputs_back_surface.loc[:, 'surface_azimuth'] = (
        df_inputs_back_surface.loc[:, 'surface_azimuth'] - 180.)
    df_inputs_back_surface.loc[:, 'surface_azimuth'] = np.mod(
        df_inputs_back_surface.loc[:, 'surface_azimuth'], 360.
    )
    df_inputs_back_surface.loc[:, 'surface_tilt'] = (
github pvlib / pvlib-python / pvlib / forecast.py View on Github external
:py:func:`pvlib.irradiance.liujordan` model

        Parameters
        ----------
        cloud_cover : Series

        Returns
        -------
        irradiance : DataFrame
            Columns include ghi, dni, dhi
        """
        # in principle, get_solarposition could use the forecast
        # pressure, temp, etc., but the cloud cover forecast is not
        # accurate enough to justify using these minor corrections
        solar_position = self.location.get_solarposition(cloud_cover.index)
        dni_extra = get_extra_radiation(cloud_cover.index)
        airmass = self.location.get_airmass(cloud_cover.index)

        transmittance = self.cloud_cover_to_transmittance_linear(cloud_cover,
                                                                 **kwargs)

        irrads = liujordan(solar_position['apparent_zenith'],
                           transmittance, airmass['airmass_absolute'],
                           dni_extra=dni_extra)
        irrads = irrads.fillna(0)

        return irrads
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / validation / tasks.py View on Github external
def _solpos_dni_extra(observation, values):
    solar_position, night_flag = _solpos_night(observation, values)
    dni_extra = get_extra_radiation(values.index)
    timestamp_flag = _validate_timestamp(observation, values)
    return solar_position, dni_extra, timestamp_flag, night_flag