Notes on Celestial Navigation

CNDEC - Estimate Sun's Declination

Description: Estimates the Sun's declination on any given day of the year.

Inputs:

YearYear
MonthMonth of the year (1-12)
DayDay of the month (1-31)
HourHour of the day (0-23)

Outputs:

DecThe estimated declination using a simple formula
Dec2A more accurate estimated declination using Astronomical Algorithms

Sample execution:

Year? 2024
Month(1-12)? 5
Day(1-31)? 14
Hour(0-23)? 15

Dec: 18° 50.8'
Dec2: 18° 50.8'

(For explanation of notation, conventions etc, see python-programs).



Copyright (C) 2024 Ian Staniforth

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.


# CNDEC - Calculate Sun's declination at a given day and time

from math import *
from CN_LIB import *

year = int(input("Year? "))
month = int(input("Month(1-12)? "))
day = int(input("Day(1-31)? "))
hour = stot("Hour(0-23)? ")

N = dayofyear(year,month,day)
y = ydrift(year) # quarter day for calendar drift
x = hour/24

# Simple estimate

t = N+x+y
dec = 23.4659*sin(0.0169*t-1.3595)

# Astronomical Algorithms

jd = julianday(year,month,day+x)
T = (jd-J2000)/JC
ra,dec2 = sunradec(T)

print("")
print("Dec: "+dtos(dec))
print("Dec2: "+dtos(dec2))