Notes on Celestial Navigation

CNGHASUN - Estimate the Sun's GHA

Description: Estimates the Sun's GHA for a given time and day of the year.

Inputs:

YearYear
MonthMonth of the year
DayDay of the month
HourUT hour of interest
MinuteUT minute of interest
SecondUT second of interest

Outputs:

GHAThe estimated GHA
GHA2A more accurate GHA estimation using Astronomical Algorithms

Sample execution:

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

GHA: 45° 55.2'
GHA2: 45° 54.7'

(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/.


# CNGHASUN - Calculate the Sun's GHA at a given time and day

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)? ")
minute = stot("Minute? ")
second = stot("Second? ")

ut = hour+minute/60+second/3600
day = day+ut/24

EoT = eot(year,month,day)

EoT = EoT/60
t = hour-(12-EoT)
gha = (15*t+360)%360

gha2 = ghasun(year,month,day)

print("")
print("GHA: "+dtos(gha))
print("GHA2: "+dtos(gha2))