pvlib-bifacy.pvfactors_timeseries()值错误:缓冲区的维度数错误(应为1,实际为2)



我正在使用pvlib/pvfactors双面.pvfactors_timeseries,时间戳有一些问题。我使用了一个DatetimeIndex,可以看到:

times = pd.date_range('2021-01-01', '2021-01-02', closed='left', freq='1min',
tz=None)
rear_rad=bifacial.pvfactors_timeseries(
solar_azimuth=235.7,
solar_zenith=75.6,
surface_azimuth=270.0, #cte
surface_tilt=-72.8, #tracker
axis_azimuth=180.0, #cte
timestamps=times,
dni=29.0,
dhi=275.0,
gcr=0.2,
pvrow_height=2.0,
pvrow_width=2.0,
albedo=0.2, #variable mensual
n_pvrows=3,
index_observed_pvrow=1,
rho_front_pvrow=0.03, #reflectividad
rho_back_pvrow=0.05, #refletividad
horizon_band_angle=15.0)

我总是有这样的错误:

ValueError:缓冲区的维度数错误(应为1,实际为2(

错误的完整回溯是:

文件"****&";,第18行,inrear_rad=双面.pvfactors_时间序列(

文件";C: \Users\tomas.rodriguez\Anaconda3\lib\site-packages\pvlib\bifacer.py",第141行,在pvfactors_timeseries中report=运行时间序列引擎(

文件";C: \Users\tomas.rodriguez\Anaconda3\lib\site-packages\pvfactors\run.py",第106行,在run_timeseries_engine中eng.fit(时间戳、dni、dhi、太阳天顶、太阳方位角、表面倾斜、

文件";C: \Users\tomas.rodriguez\Anaconda3\lib\site-packages\pvfactors\engine.py",线161,配合自辐照度拟合(时间戳、DNI、DHI、太阳天顶、太阳方位角、

文件";C: \Users\tomas.rodriguez\Anaconda3\lib\site-packages\pvfactors\辐照度\models.py",线527,配合自我_calculate_luminance_poa_components(

文件";C: \Users\tomas.rodriguez\Anaconda3\lib\site-packages\pvfactors\辐照度\models.py",第993行,在_calculate_luminance_poa_components中df_inputs=perez_diffuse_luminance(

文件";C: \Users\tomas.rodriguez\Anaconda3\lib\site-packages\pvfactors\辐照度\utils.py",第63行,perez_diffuse_luminancedni_et=辐照度.get_extra_radiation(df_inputs.index.dayofyear(

文件";C: \Users\tomas.rodriguez\Anaconda3\lib\site-packages\pandas\core\indexes\extension.py",第81行,fgetresult=getattr(self._data,name(

文件";C: \Users\tomas.rodriguez\Anaconda3\lib\site-packages\pandas\core\arrays \datetimes.py",第139行,fresult=fields.get_date_field(值,字段(

文件";pandas_libs\tslibs\fields.pyx";,305线,大熊猫_libs.tslibs.fields.get_date_field

ValueError:缓冲区的维度数错误(应为1,实际为2(

问题是pvfactors_timeseries的一些参数需要是数组、序列等,而不是像您使用的标量。这个可用性问题已经被注意到,应该在下一个pvlib版本中修复(0.9.1,尚未发布(;看见https://github.com/pvlib/pvlib-python/issues/1332

这个修改后的代码版本运行时没有错误:

rear_rad = bifacial.pvfactors_timeseries(
solar_azimuth=pd.Series(235.7, times),
solar_zenith=pd.Series(75.6, times),
surface_azimuth=pd.Series(270.0, times), #cte
surface_tilt=pd.Series(-72.8, times), #tracker
axis_azimuth=180.0, #cte
timestamps=times,
dni=pd.Series(29.0, times),
dhi=pd.Series(275.0, times),
gcr=0.2,
pvrow_height=2.0,
pvrow_width=2.0,
albedo=0.2, #variable mensual
n_pvrows=3,
index_observed_pvrow=1,
rho_front_pvrow=0.03, #reflectividad
rho_back_pvrow=0.05, #refletividad
horizon_band_angle=15.0,
)

还有一件事:pvlib希望surface_tilt是非负的,我不确定函数对于负的surface_tilt会返回什么。注意,在pvlib约定中,跟踪器旋转可以是正的或负的,以指示它是向东还是向西倾斜,但surface_tilt始终是正的(或零(,东/西方向由surface_azimuth表示。

附言:这是一种很好的做法,当事情没有像你预期的那样工作时,最好提及你安装的软件包版本(参见print(pvlib.__version__)pip show pvlib(。有时,不同版本之间会发生变化,答案取决于您使用的版本。

最新更新