CNAZALT - Calculate the Azimuth and Altitude of a Celestial Object
Description: The calculated azimuth and altitude of a celestial object are used principally with Saint-Hilaire's Method.
Inputs:
| DR Lat | DR Latitude of the observer |
| DR Lon | DR Longitude of the observer |
| GHA | GHA of the celestial object |
| Dec | Declination of the celestial object |
Outputs:
| Az | Azimuth of the celestial object from the observer's position |
| Alt | Altitude/height of the celestial object from the observer's position |
Sample execution:
DR Lat? 42,32.4 DR Lon? 18,08.5 GHA? 350,02.2 Dec? 20,20.2 Az: 199° 45.2' Alt: 66° 45.3'
(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/.
# CNAZALT - Calculate Azimuth and Altitude of an Object from a Sight
from math import *
from CN_LIB import *
lat = stod("DR Lat? ")
lon = stod("DR Lon? ")
gha = stod("GHA? ")
dec = stod("Dec? ")
lha = (gha+lon+360)%360
h = aSin(Sin(lat)*Sin(dec)+Cos(lat)*Cos(dec)*Cos(lha))
z = aCos((Sin(dec)-Sin(h)*Sin(lat))/(Cos(h)*Cos(lat)))
zn = 360-z if lha <= 180 else z
print("")
print("Az: "+dtos(zn))
print("Alt: "+dtos(h))