@@ -86,7 +86,7 @@ def GetAltitudeFast(latitude_deg, longitude_deg, utc_datetime):
86
86
87
87
# expect 19 degrees for solar.GetAltitude(42.364908,-71.112828,datetime.datetime(2007, 2, 18, 20, 13, 1, 130320))
88
88
89
- day = GetDayOfYear (utc_datetime )
89
+ day = julian . GetDayOfYear (utc_datetime )
90
90
declination_rad = math .radians (GetDeclination (day ))
91
91
latitude_rad = math .radians (latitude_deg )
92
92
hour_angle = GetHourAngle (utc_datetime , longitude_deg )
@@ -133,7 +133,7 @@ def GetAzimuth(latitude_deg, longitude_deg, utc_datetime, elevation = 0):
133
133
134
134
def GetAzimuthFast (latitude_deg , longitude_deg , utc_datetime ):
135
135
# expect -50 degrees for solar.GetAzimuth(42.364908,-71.112828,datetime.datetime(2007, 2, 18, 20, 18, 0, 0))
136
- day = GetDayOfYear (utc_datetime )
136
+ day = julian . GetDayOfYear (utc_datetime )
137
137
declination_rad = math .radians (GetDeclination (day ))
138
138
latitude_rad = math .radians (latitude_deg )
139
139
hour_angle_rad = math .radians (GetHourAngle (utc_datetime , longitude_deg ))
@@ -149,11 +149,6 @@ def GetAzimuthFast(latitude_deg, longitude_deg, utc_datetime):
149
149
def GetCoefficient (jme , constant_array ):
150
150
return sum ([constant_array [i - 1 ][0 ] * math .cos (constant_array [i - 1 ][1 ] + (constant_array [i - 1 ][2 ] * jme )) for i in range (len (constant_array ))])
151
151
152
- def GetDayOfYear (utc_datetime ):
153
- year_start = datetime .datetime (utc_datetime .year , 1 , 1 , tzinfo = utc_datetime .tzinfo )
154
- delta = (utc_datetime - year_start )
155
- return delta .days
156
-
157
152
def GetDeclination (day ):
158
153
'''The declination of the sun is the angle between
159
154
Earth's equatorial plane and a line between the Earth and the sun.
@@ -297,7 +292,7 @@ def GetRefractionCorrection(pressure_millibars, temperature_celsius, topocentric
297
292
return a / b
298
293
299
294
def GetSolarTime (longitude_deg , utc_datetime ):
300
- day = GetDayOfYear (utc_datetime )
295
+ day = julian . GetDayOfYear (utc_datetime )
301
296
return (((utc_datetime .hour * 60 ) + utc_datetime .minute + (4 * longitude_deg ) + EquationOfTime (day ))/ 60 )
302
297
303
298
# Topocentric functions calculate angles relative to a location on the surface of the earth.
0 commit comments