Python PVLIB error 'erbs() got an unexpected k

2019-08-17 19:06发布

问题:

I run the following code to estimate DNI and DHI from GHI using the Erbs model available in Sandia's PVLIB.

The original code as here is:

pvlib.irradiance.erbs(ghi, zenith, datetime_or_doy, min_cos_zenith=0.065, max_zenith=87)

My code is:

df= pvlib.irradiance.erbs(df.ghi, sun.zenith, df.index, min_cos_zenith=0.065, max_zenith=85)

But my code returns erbs() got an unexpected keyword argument 'min_cos_zenith'. Any help is appreciated.

I use:
Python 3.7.3
PVLIB 0.6.1
Pandas 0.24.2

EDIT:
Maybe the solution is to upgrade to PVLIB v0.6.2. But, how to upgrade it. In my machine, none of the following works: pip install pvlib, pip install --upgrade pvlib, pip install pvliv ==0.6.2

回答1:

Just call the function without the new (optional) arguments:

df= pvlib.irradiance.erbs(df.ghi, sun.zenith, df.index)



回答2:

AS of 2019-04-28 the pvlib version was v0.6.1 which does not yet have the min_cos_zenith optional argument for erbs(). As Will Holmgren commented, a workaround in the meantime would be to install the latest master from GitHub using pip vcs support:

$ pip install -e git+https://github.com/pvlib/pvlib-python.git@master#egg=pvlib


标签: pvlib