need to calculate the solar declination. Solar
declination is the angle between the sun's rays and the plane of
Earth's equator. Its value depends on where Earth is in its orbit
around the sun; the declination angle varies from -23.44 to +23.44
throughout the year.
Define the function solar_declination(day_num,
solar_hour) that returns the angle between the sun's rays and
the plane of Earth's equator, for the given day number and solar
hour.
The day number is the number of days since solar midnight on Jan
1. So Jan 1 is 0, and 31 Dec is 364. You should use the following
formula, which gives a good approximation based on the day of the
year:
ππππππππ‘πππ=β23.44Γπππ _π(360365Γ(π+10))declination=β23.44Γcos_d(360365Γ(n+10))
Where:
π=πππ¦_ππ’π+π ππππ_βππ’π24n=day_num+solar_hour24
For example, if day_num is 10
and solar_hour is 12, then the effective day
number will be 10.5. This accounts for the change in declination
during the day.
Notes:
Test Result -23.058 at noon on 81 23.218 at noon on 38: = day = 6 result = solar_declination (day, 12) nice_date = nice_date_str(day) print('{result:.3f} at noon on {nice_date}') day = 180 result = solar_declination(day, 12) nice_date = nice_date_str(day) print(f'{result:.3f} at noon on {nice_date}') day - 79 result = solar_declination(day, 6.5) nice_date = nice_date_str(day) print(+'{result:.3f} at 6:30 on {nice_date}') -0.798 at 6:30 on 21 Answer: (penalty regime: 0, 0, 0, 5, 10, 15, 20, 25, 30, 40, ... %) Reset answer 1 | Assignment module. You'll add more functions as yo 2 import math 3 from datetime import date, timedelta 4 5 AXIAL_TILT = 23.44 6 MINUTES_PER_HOUR = 60 7 HOURS_PER_DAY = 24 8 8 DAYS_PER_YEAR = 365 9 10 11 . def nice_date_str(day_num): 12 " Returns a human readable date string for the 13 day_num days after 1 Jan 2022. For example, 14 day 0 -> 01 Jan 15 day 364 -> 31 Dec 16 The day number should be between 0 and 364, inclus 17 Values greater than 364 will roll over into subseg 18 Don't worry too much about how this works. 19 20 base_date = date(2022, 1, 1) 21 delta = timedelta(days-day-num) 22 the_date = base_date + delta 23 return the_date.strftime("%d %b' 24 25 26. def cos_d(degrees): 27 "" To Save us converting to radians all the time 28 return math.cos(math.radians(degrees) 29 30 31. def solar_declination(day_num, solar_hour): 32 " Returns the angle of the sun's rays and the p 33 of the earth's equator, for the given day number 34 35 # Your code goes here
