Skip to content

bifacial.pvfactors expects arrays for surface_tilt and surface_azimuth inputs #1127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cwhanse opened this issue Jan 7, 2021 · 0 comments · Fixed by #1361
Closed

bifacial.pvfactors expects arrays for surface_tilt and surface_azimuth inputs #1127

cwhanse opened this issue Jan 7, 2021 · 0 comments · Fixed by #1361
Labels
Milestone

Comments

@cwhanse
Copy link
Member

cwhanse commented Jan 7, 2021

The docstring for bifacial.pvfactors describes these two parameters:

    surface_azimuth: numeric
        Azimuth angle of the front surface of the PV modules, using pvlib's
        convention (deg)
    surface_tilt: numeric
        Tilt angle of the PV modules, going from 0 to 180 (deg)

Based on the docstring I would expect the function to run with e.g. surface_azimuth being a float. But it doesn't; it only runs when surface_azimuth is an array or Series of the same length as other time-dependent inputs. Providing surface_azimuth as a float yields IndexError: too many indices for array

Issue originally reported in #1125

To reproduce:

from datetime import datetime
import numpy as np
import pandas as pd
import pvlib


df_inputs = pd.DataFrame({'solar_zenith': [20., 50.],
                          'solar_azimuth': [110., 250.],
                          'surface_tilt': [10., 20.],
                          'surface_azimuth': [90., 270.],
                          'dni': [1000., 900.],
                          'dhi': [50., 100.],
                          'albedo': [0.2, 0.2]},
                          index=[datetime(2017, 8, 31, 11),
                                 datetime(2017, 8, 31, 15)])

pvarray_parameters = {'n_pvrows': 3,            # number of pv rows
                      'pvrow_height': 1,        # height of pvrows (measured at center / torque tube)
                      'pvrow_width': 1,         # width of pvrows
                      'axis_azimuth': 0.,       # azimuth angle of rotation axis
                      'gcr': 0.4,               # ground coverage ratio
                      }

pvfactor = pvlib.bifacial.pvfactors_timeseries(
    solar_azimuth=df_inputs['solar_azimuth'],
    solar_zenith=df_inputs['solar_zenith'],
    surface_azimuth=180, 
    surface_tilt=40, 
    axis_azimuth=0.0,
    timestamps=df_inputs.index, 
    dni=df_inputs['dni'],
    dhi=df_inputs['dhi'],
    gcr=2.0/7.0,
    pvrow_height=1,
    pvrow_width=7,
    albedo=0.2,
    n_pvrows=2,
    index_observed_pvrow=3,
    rho_front_pvrow=0.03,
    rho_back_pvrow=0.05,
    horizon_band_angle=15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants