@@ -28,7 +28,7 @@ def solar_declination_angle(date):
2828 angle = julian_day (date ) / DAYS_PER_YEAR * np .pi * 2
2929
3030 # declination in [degrees]
31- declination = (
31+ declination = float (
3232 0.396372
3333 - 22.91327 * np .cos (angle )
3434 + 4.025430 * np .sin (angle )
@@ -38,7 +38,7 @@ def solar_declination_angle(date):
3838 + 0.084798 * np .sin (3 * angle )
3939 )
4040 # time correction in [ h.degrees ]
41- time_correction = (
41+ time_correction = float (
4242 0.004297
4343 + 0.107029 * np .cos (angle )
4444 - 1.837877 * np .sin (angle )
@@ -68,13 +68,16 @@ def cos_solar_zenith_angle(date, latitudes, longitudes):
6868 http://answers.google.com/answers/threadview/id/782886.html
6969
7070 """
71- # declination angle + time correction for solar angle
72- declination , time_correction = solar_declination_angle (date )
73-
7471 xp = array_namespace (latitudes , longitudes )
75- declination = xp .asarray (declination )
7672 latitudes = xp .asarray (latitudes )
7773 longitudes = xp .asarray (longitudes )
74+ device = xp .device (latitudes )
75+
76+ # declination angle + time correction for solar angle
77+ declination , time_correction = solar_declination_angle (date )
78+
79+ declination = xp .asarray (declination , device = device )
80+ time_correction = xp .asarray (time_correction , device = device )
7881
7982 # solar_declination_angle returns degrees
8083 # TODO: deg2rad() is not part of the array API standard
0 commit comments