pingswept / pysolar

Pysolar is a collection of Python libraries for simulating the irradiation of any point on earth by the sun. It includes code for extremely precise ephemeris calculations.

This URL has Read+Write access

pysolar / poly.py
100644 16 lines (12 sloc) 0.613 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/python
 
coeff_list = [
('ArgumentOfLatitudeOfMoon', (93.27191, 483202.017538, -0.0036825, 327270.0)),
('LongitudeOfAscendingNode', (125.04452, -1934.136261, 0.0020708, 450000.0)),
('MeanElongationOfMoon', (297.85036, 445267.111480, -0.0019142, 189474.0)),
('MeanAnomalyOfMoon', (134.96298, 477198.867398, 0.0086972, 56250.0)),
('MeanAnomalyOfSun', (357.52772, 35999.050340, -0.0001603, -300000.0))
]
 
def buildPolyFit((a, b, c, d)):
return (lambda x: a + b * x + c * x ** 2 + (x ** 3) / d)
 
def buildPolyDict():
return dict([(name, buildPolyFit(coeffs)) for (name, coeffs) in coeff_list])