NREL's Solar and Moon Position Algorithm (SAMPA) calculates the solar and lunar zenith and azimuth angles in the period from the year -2000 to 6000, with uncertainties of +/- 0.0003 degrees for the Sun and +/- 0.003 degrees for the Moon, based on the date, time, and location on Earth. The algorithm can be used for solar eclipse monitoring and estimating the reduction in solar irradiance for many applications, such as smart grid, solar energy, etc.
(Reference: Reda, I. (2010). Solar Eclipse Monitoring for Solar Energy Applications Using the Solar and Moon Position Algorithms. 35 pp.; NREL Report No. TP-3B0-47681).
This packages requires Go 1.13. If you installed it and set up your GOPATH, just run:
go get -u github.com/maltegrosse/go-sampa
You can find some examples in the examples directory.
Please visit https://midcdmz.nrel.gov/sampa for additional information.
Some additional helper functions have been added to the original application logic.
NREL sampa_tester.c | GO Sampa | |
---|---|---|
Julian Day | 2455034.564583 | 2455034.564583 |
L | 299.4024 | 299.402381 |
B | -0.00001308059 | -0.000013080591 |
R | 1.016024 | 1.016024218757 |
H | 344.999100 | 344.999099851812 |
Delta Psi | 0.004441121 | 0.004441121189 |
Delta Epsilon | 0.001203311 | 0.001203311382 |
Epsilon | 23.439252 | 23.439252167574 |
Zenith | 14.512686 | 14.512686209564 |
Azimuth | 104.387917 | 104.387916743210 |
Angular dist | 0.374760 | 0.374759984176 |
Sun Radius | 0.262360 | 0.262359778407 |
Moon Radius | 0.283341 | 0.283341456977 |
Area unshaded | 78.363514 | 78.363513779787 |
DNI | 719.099358 | 719.099358263094 |
Adoption in Golang under MIT license 2020 © Malte Grosse.