How to use the pvlib.atmosphere 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 pvlib / pvlib-python / pvlib / location.py View on Github external
pressure : None, float, or array-like, default None
            If None, pressure will be calculated using
            :py:func:`atmosphere.alt2pres` and ``self.altitude``.
        temperature : None, float, or array-like, default 12

        kwargs
            passed to :py:func:`solarposition.get_solarposition`

        Returns
        -------
        solar_position : DataFrame
            Columns depend on the ``method`` kwarg, but always include
            ``zenith`` and ``azimuth``.
        """
        if pressure is None:
            pressure = atmosphere.alt2pres(self.altitude)

        return solarposition.get_solarposition(times, latitude=self.latitude,
                                               longitude=self.longitude,
                                               altitude=self.altitude,
                                               pressure=pressure,
                                               temperature=temperature,
                                               **kwargs)
github BreakingBytes / pvfree / pvfree / api.py View on Github external
zenith_data = pd.DataFrame(columns, index=times)
    if zenith_file and zenith_data is None:
        if filetype == 'json':
            zenith_data = pd.read_json(zenith_file)
        elif filetype == 'csv':
            zenith_data = pd.read_csv(zenith_file)
        elif filetype == 'xlsx':
            zenith_data = pd.read_excel(zenith_file)
        else:
            return JsonResponse(params.errors, status=400)
    if not model:
        model = 'kastenyoung1989'
    apparent_or_true = APPARENT_OR_TRUE.get(model)
    if not apparent_or_true:
        return JsonResponse(params.errors, status=400)
    am = atmosphere.get_relative_airmass(zenith_data[apparent_or_true], model)
    am.fillna(-9999.9, inplace=True)
    am.index = times.strftime('%Y-%m-%dT%H:%M:%S%z')
    data = am.to_dict()
    return JsonResponse(data)
github pvlib / pvlib-python / pvlib / pvsystem.py View on Github external
spectral mismatch factor (unitless) which can be multiplied
            with broadband irradiance reaching a module's cells to estimate
            effective irradiance, i.e., the irradiance that is converted to
            electrical current.
        """

        if 'first_solar_spectral_coefficients' in \
                self.module_parameters.keys():
            coefficients = \
                   self.module_parameters['first_solar_spectral_coefficients']
            module_type = None
        else:
            module_type = self._infer_cell_type()
            coefficients = None

        return atmosphere.first_solar_spectral_correction(pw,
                                                          airmass_absolute,
                                                          module_type,
                                                          coefficients)
github pvlib / pvlib-python / pvlib / solarposition.py View on Github external
applications. Solar Energy, vol. 76, no. 5, pp. 577-589, 2004.

    .. [2] I. Reda and A. Andreas, Corrigendum to Solar position algorithm for
       solar radiation applications. Solar Energy, vol. 81, no. 6, p. 838,
       2007.

    .. [3] NREL SPA code: http://rredc.nrel.gov/solar/codesandalgorithms/spa/
    """

    if altitude is None and pressure is None:
        altitude = 0.
        pressure = 101325.
    elif altitude is None:
        altitude = atmosphere.pres2alt(pressure)
    elif pressure is None:
        pressure = atmosphere.alt2pres(altitude)

    method = method.lower()
    if isinstance(time, dt.datetime):
        time = pd.DatetimeIndex([time, ])

    if method == 'nrel_c':
        ephem_df = spa_c(time, latitude, longitude, pressure, temperature,
                         **kwargs)
    elif method == 'nrel_numba':
        ephem_df = spa_python(time, latitude, longitude, altitude,
                              pressure, temperature,
                              how='numba', **kwargs)
    elif method == 'nrel_numpy':
        ephem_df = spa_python(time, latitude, longitude, altitude,
                              pressure, temperature,
                              how='numpy', **kwargs)