@@ -92,7 +92,7 @@ def sg2(times, latitude, longitude, elevation=0, *, pressure=101325,
9292 np .where ((year_dec >= 1986 ) & (year_dec <= 2005 ), 1 ,
9393 np .where ((year_dec >= 2005 ) & (year_dec <= 2030 ), 2 ,
9494 np .nan
95- ))).astype (int )[ 0 ]
95+ ))).astype (int )
9696
9797 delta_t = 0.0
9898 for k in range (0 , 6 ):
@@ -107,7 +107,7 @@ def sg2(times, latitude, longitude, elevation=0, *, pressure=101325,
107107 + 365.0 * year_mod + np .floor (year_mod / 4.0 ) + hour / 24 - 0.5
108108 - np .floor (year_mod / 100.0 ) + np .floor (year_mod / 400.0 ))
109109
110- jd_tt = jd_ut + delta_t / 86400
110+ jd_tt = jd_ut + delta_t . values / 86400
111111
112112 jd_ut_mod = jd_ut - 2444239.5
113113 jd_tt_mod = jd_tt - 2444239.5
@@ -204,25 +204,25 @@ def sg2(times, latitude, longitude, elevation=0, *, pressure=101325,
204204 omega = mst + D_psi * np .cos (epsilon ) - ra + longitude - D_r_a
205205
206206 # Sun topocentric azimuth [rad]
207- azimuth = np .arctan2 (np .sin (omega ), np .cos (omega ) * np .sin (latitude )
208- - np .tan (declination ) * np .cos (latitude )) + np .pi
207+ solar_azimuth = np .arctan2 (np .sin (omega ), np .cos (omega ) * np .sin (latitude )
208+ - np .tan (declination ) * np .cos (latitude )) + np .pi
209209
210210 # Sun topocentric elevation angle without refraction correction [rad]
211- elevation = np .arcsin (np .sin (latitude ) * np .sin (declination )
212- + np .cos (latitude ) * np .cos (declination )
213- * np .cos (omega ))
211+ solar_elevation = np .arcsin (np .sin (latitude ) * np .sin (declination )
212+ + np .cos (latitude ) * np .cos (declination )
213+ * np .cos (omega ))
214214
215- elevation_deg = np .rad2deg (elevation )
215+ solar_elevation_deg = np .rad2deg (solar_elevation )
216216
217217 # Atmospheric refraction correction term
218- r = refraction .sg2 (np .array (elevation_deg ), pressure , temperature )
218+ r = refraction .sg2 (np .array (solar_elevation_deg ), pressure , temperature )
219219
220220 result = pd .DataFrame ({
221- 'elevation' : elevation_deg ,
222- 'apparent_elevation' : elevation_deg + r ,
223- 'zenith' : 90 - elevation_deg ,
224- 'apparent_zenith' : 90 - elevation_deg - r ,
225- 'azimuth' : np .rad2deg (azimuth ),
221+ 'elevation' : solar_elevation_deg ,
222+ 'apparent_elevation' : solar_elevation_deg + r ,
223+ 'zenith' : 90 - solar_elevation_deg ,
224+ 'apparent_zenith' : 90 - solar_elevation_deg - r ,
225+ 'azimuth' : np .rad2deg (solar_azimuth ),
226226 }, index = times )
227227 return result
228228
0 commit comments