@@ -0,0 +1,2751 @@
+''' Energy Normalization Module%0A%0AThis module contains functions to help normalize AC energy output with measured%0Airradiance in preparation for calculating PV system degradation.%0A'''%0A%0Aimport pandas as pd%0Aimport pvlib%0A%0A%0Adef normalize_with_sapm(pvlib_pvsystem, energy, irradiance):%0A    '''%0A    Normalize system AC energy output given measured irradiance and%0A    meteorological data. This method relies on the Sandia Array Performance%0A    Model (SAPM) to compute the effective DC energy using measured irradiance,%0A    ambient temperature, and wind speed.%0A%0A    Energy timeseries and irradiance timeseries can be different granularities.%0A%0A    Parameters%0A    ----------%0A    pvlib_pvsystem: pvlib-python LocalizedPVSystem object%0A        Object contains orientation, geographic coordinates, equipment constants.%0A    energy: Pandas Series (numeric)%0A        Energy time series to be normalized.%0A    irradiance: Pandas DataFrame (numeric)%0A        Measured irradiance, ambient temperature, and wind speed.%0A%0A    Returns%0A    -------%0A    normalized_energy: Pandas Series (numeric)%0A        Energy divided by Sandia Model DC energy.%0A    '''%0A%0A    solar_position = pvlib_pvsystem.get_solarposition(irradiance.index)%0A%0A    total_irradiance = pvlib_pvsystem%5C%0A        .get_irradiance(solar_position%5B'zenith'%5D,%0A                        solar_position%5B'azimuth'%5D,%0A                        irradiance%5B'DNI'%5D,%0A                        irradiance%5B'GHI'%5D,%0A                        irradiance%5B'DHI'%5D)%0A%0A    aoi = pvlib_pvsystem.get_aoi(solar_position%5B'zenith'%5D,%0A                                 solar_position%5B'azimuth'%5D)%0A%0A    airmass = pvlib_pvsystem%5C%0A        .get_airmass(solar_position=solar_position, model='kastenyoung1989')%0A    airmass_absolute = airmass%5B'airmass_absolute'%5D%0A%0A    effective_poa = pvlib.pvsystem%5C%0A        .sapm_effective_irradiance(poa_direct=total_irradiance%5B'poa_direct'%5D,%0A                                   poa_diffuse=total_irradiance%5B'poa_diffuse'%5D,%0A                                   airmass_absolute=airmass_absolute,%0A                                   aoi=aoi,%0A                                   module=pvlib_pvsystem.module,%0A                                   reference_irradiance=1)%0A%0A    temp_cell = pvlib_pvsystem%5C%0A        .sapm_celltemp(irrad=total_irradiance%5B'poa_global'%5D,%0A                       wind=irradiance%5B'Wind Speed'%5D,%0A                       temp=irradiance%5B'Temperature'%5D)%0A%0A    p_dc = pvlib_pvsystem%5C%0A        .pvwatts_dc(g_poa_effective=effective_poa,%0A                    temp_cell=temp_cell%5B'temp_cell'%5D)%0A%0A    if energy.index.freq is None:%0A        freq = pd.infer_freq(energy.index)%0A    else:%0A        freq = energy.index.freq%0A%0A    energy_dc = p_dc.resample(freq).sum()%0A    normalized_energy = energy / energy_dc%0A%0A    return normalized_energy%0A

Rename 'tools' to 'rdtools' module directory.