用Blanco Muriel编写的用C++编写的太阳位置算法Python包装器。
sunpos的Python项目详细描述
由blanco muriel用c++编写的太阳位置算法的python包装器。 1999年至2015年期间精度为1度。
Blanco Muriel M.,Alarcon Padilla D.C.,Lopez Mratala D.和Lara Coira M.,“计算太阳矢量”,太阳能第70卷,第5期,第431-44119001页。
To calculate sun position: | |
---|---|
>>> import sunpos: >>> print sunpos.__doc__
Sunpos package provides three structueres:
cTime: whith fields:
iYear: year, integer iMonth: month, integer iDay: day, integer dHours: double, UTC hours dMinutes: double, minutes dSeconds: double, seconds cLocation: with fields:
dLongitude: double, longitude dLatitude: double, latitude cSunCoordinates: with fields:
dZenithAngle: double, zenith angle, degrees dAzimuth: double, azimuth angle, degrees
>>> loc=sunpos.cLocation() >>> loc.dLatitude = 43.1 >>> loc.dLongitude = 131.9 >>> time=sunpos.cTime() >>> time.iYear = 2013 #imteger, year >>> time.iMonth = 10 #Integer, month >>> time.iDay = 13 #integer, day >>> time.dHours = 16 #double, hours UTC >>> time.dMinutes = 32 #double, minutes >>> time.dSeconds = 12 #double, seconds >>> #calculations >>> res = sunpos.sunposf(time, loc) >>> #or >>> res = sunpos.cSunCoordinates() >>> sunpos.sunpos(time, loc, res) >>> print res.dZenithAngle # sun's zenith angle >>> print res.dAzimuth # sun's azimuth angle: >>>