Notes on Celestial Navigation

CNLAT - Calculate the observer's latitude from a transit

Description: Determine the observer's latitude using a celestial object transit (upper or lower).

Inputs:

Transit U or LUpper or lower transit
GP N or SLocation of the object's GP relative to the observer, north or south
DecDeclination of the object
HHeight of the object

Outputs:

LatObserver's latitude

Sample execution:

Transit U or L? u
GP N or S? s
Dec? -15,10.5
H? 44,39.6

Lat: 30° 09.9'

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


# CNLAT - Calculate latitude from a transit

from math import *
from CN_LIB import *

ul = input("Transit U or L? ")
ns = input("GP N or S? ")
d = stod("Dec? ")
h = stod("H? ")

lat = 0
z = 90-h

# Upper transit

if ul.lower().startswith("u"):
    if ns.lower().startswith("s"): lat = d+z # GP south
    elif ns.lower().startswith("n"): lat = d-z # GP north

# Lower transit

elif ul.lower().startswith("l"):
    if ns.lower().startswith("s"): lat = (z-d)-180 # GP south
    elif ns.lower().startswith("n"): lat = 180-(d+z) # GP north
    
print("")
print("Lat: "+dtos(lat))