围绕nrel solpos和spectrl2的python包装器
SolarUtils的Python项目详细描述
solarutils是一组围绕公共可用 NRELSOLPOS和 SPECTRL2C语言计算机 计算太阳位置和光谱分解的程序。请阅读 是NREL disclaimer and license。用法 这个软件意味着接受这些条款。
安装
使用pip安装 SolarUtils from the PyPI:
pip install SolarUtils
您还可以从pypi下载源发行版或克隆存储库 使用pythondistutils:
python setup.py install
要求
Solarutils对安装、测试和 要制作文档,您需要以下包装:
- 努比
- pytest
- 斯芬克斯
用法
见SOLPOS Documentation 和 SPECTRL2 Documentation 更多细节。
示例
>>> from solar_utils import * >>> import pandas as pd >>> location = [35.56836, -119.2022, -8.0] >>> datetime = [2013, 6, 5, 12, 31, 0] >>> weather = [1015.62055, 40.0] >>> (angles, airmass) = solposAM(location, datetime, weather) >>> zenith, azimuth = angles >>> zenith 15.074043273925781 >>> azimuth 213.29042053222656] >>> am, amp = airmass >>> am 1.0352272987365723 >>> amp 1.0379053354263306]>>> units = 1 >>> location = [33.65, -84.43, -5.0] >>> datetime = [1999, 7, 22, 9, 45, 37] >>> weather = [1006.0, 27.0] >>> orientation = [33.65, 135.0] >>> atmospheric_conditions = [1.14, 0.65, -1.0, 0.2, 1.36] >>> albedo = [0.3, 0.7, 0.8, 1.3, 2.5, 4.0] + ([0.2] * 6) >>> specdif, specdir, specetr, specglo, specx = spectrl2( ... units, location, datetime, weather, orientation, ... atmospheric_conditions, albedo ... ) >>> spec = pd.DataFrame( ... {'DIF': specdif, 'DIR': specdir, 'ETR': specetr, 'GLO': specglo}, ... index=specx ... ) >>> f = spec.plot() >>> f.set_title('Solar Spectrum Example') >>> f.set_xlabel('Wavelength, $\lambda [\mu m]$') >>> f.set_ylabel('Spectral Irradiance, $I_{\lambda} [W/m^2/\mu m]$') >>> f.grid(True) >>> f.figure.show()