Principles of Field Astronomy

Example 4.1,Page 81

In [2]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    sd=round(sd,2)
    return [d, m, sd]
theta=25+14.0/60;
R=6370.0;

#calculation
AB=cos(theta*pi/180)*(16+10.0/60)
dis=2*pi*R*AB/360.0;

#result
print "distance of AB in m ",round(dis,3)
distance of AB in m  1625.863

Example 4.2,Page 81

In [2]:
#initialisation of variable
import numpy as np
from scipy import linalg
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    sd=round(sd,2)
    return [d, m, sd]
LongA=52+24.0/60;
LongB=55+30.0/60;
latA=18+10.0/60;
latB=15.0;
R=6370.0;#radius of earth

#calculation
P=LongB-LongA;
PA=90-latA;
PB=90-latB;
AB=acos(cos(PB*pi/180)*cos(PA*pi/180)+sin(PB*pi/180)*sin(PA*pi/180)*cos(P*pi/180));
dis=AB*R;
#solving for A
a = np.array([[0.5,0.5], [0.5,-0.5]])
b = np.array([atan(cos((PB/2-PA/2)*pi/180)/tan(P*pi/180)/cos((PB/2+PA/2)*pi/180))*180/pi,atan(sin((PB/2-PA/2)*pi/180)/tan(P*pi/180)/sin((PB/2+PA/2)*pi/180))*180/pi])
x = np.linalg.solve(a, b)
A=x[0];
A=deg_to_dms(A);

#result
print "distance of AB in km ",round(dis,2)
print "direction of B to A in deg min sec",A
distance of AB in km  482.72
direction of B to A in deg min sec [117, 8, 30.72]

Example 4.3,Page 83

In [12]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    sd=round(sd,2)
    return [d, m, sd]
b=40.0;
p=6.0;

#calculation
a=pi/2-asin(cos(b*pi/180)*cos(p*pi/180));
BC=a*180/pi-b;
BC=BC*1.853*60;
B=asin(sin(b*pi/180)/sin(a))
B=deg_to_dms(B*180/pi);

#result
print "distance BC in km",round(BC,2)
print "angle of B deg min sec",B
distance BC in km 41.43
angle of B deg min sec [82, 53, 56.83]

Example 4.4,Page 105

In [25]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    sd=round(sd,2)
    return [d, m, sd]
coal=90.0-28.0-24.0/60;#coaltitude
cola=90.0-48.0-30.0/60;#colatitude


#calculation
delta=pi/2-acos((cos(coal*pi/180)*cos(cola*pi/180)+sin(coal*pi/180)*sin(cola*pi/180)*cos(50*pi/180)));
H=acos(cos(coal*pi/180)/(sin(cola*pi/180)*cos(delta))-tan(delta)/tan(cola*pi/180));
H=deg_to_dms(H*180/pi);       
delta=deg_to_dms(delta*180/pi);  

#result
print "H in deg min sec",H
print "declination in deg mi sec",delta
H in deg min sec [99, 7, 55.94]
delta in deg mi sec [46, 57, 38.26]

Example 4.5,Page 107

In [17]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    sd=round(sd,2)
    return [d, m, sd]
delta=22+45.0/60;
theta=55.0;
H=45+15.0/60;

#calculation
alpha=asin((cos(H*pi/180)+tan(theta*pi/180)*tan(delta*pi/180))*cos(theta*pi/180)*cos(delta*pi/180));
alpha=alpha*180/pi;
A=acos(sin(delta*pi/180)/(cos(theta*pi/180)*cos(alpha*pi/180))-tan(alpha*pi/180)*tan(theta*pi/180));
A=deg_to_dms(360-A*180/pi);

#result
print "azimuth in deg mi sec",A
azimuth in deg mi sec [244, 40, 8.11]

Example 4.6,Page 109

In [33]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    sd=round(sd,2)
    return [d, m, sd]
coal=42.0;
code=100+40.0/60;#co-declination

#calculation
alpha=pi/2-acos((cos(coal*pi/180)*cos(code*pi/180)+sin(coal*pi/180)*sin(code*pi/180)*cos(35*pi/180)));
A=acos((cos(code*pi/180)-cos(coal*pi/180)*cos(pi/2-alpha))/(sin(coal*pi/180)*sin(pi/2-alpha)));
A=deg_to_dms(A*180/pi);
alpha=deg_to_dms(alpha*180/pi);

#result
print "azimuth in deg min sec",A
print "alpha in deg min sec",alpha
azimuth in deg mi sec [142, 1, 26.46]
alpha in deg min sec [23, 38, 48.21]

Example 4.7,Page 113

In [41]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    sd=round(sd,2)
    return [d, m, sd]
theta=33+42.0/60+34.0/3600;
delta=81+55.0/60+14.0/3600;

#calculation
H1=acos(tan(theta*pi/180)/tan(delta*pi/180));
H1=deg_to_dms(360-H1*180/pi);
alpha=asin(sin(theta*pi/180)/sin(delta*pi/180));
alpha=deg_to_dms(alpha*180/pi);
A=asin(cos(delta*pi/180)/cos(theta*pi/180));
A=deg_to_dms(A*180/pi);


#result
print "azimuth in deg min sec",A
print "alpha in deg min sec",alpha
print "hour angle in deg min sec",H1
azimuth in deg min sec [9, 43, 37.11]
alpha in deg min sec [34, 5, 36.7]
hour angle in deg min sec [275, 26, 3.85]

Example 4.8,Page 114

In [42]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    sd=round(sd,2)
    return [d, m, sd]
alpha=0.0;
theta=25+45.0/60;

#calculation
delta=asin(sin(alpha)/sin(theta*pi/180));

#result
print "declination in degrees",delta
declination in degrees 0.0

Example 4.9,Page 116

In [18]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    sd=round(sd,2)
    return [d, m, sd]
cola=90.0-49.0;#colatitude
code=90.0+19.0;#codeclination

#calculation
A1=acos((cos(code*pi/180)-cos(cola*pi/180)*cos(pi/2))/sin(cola*pi/180)/sin(pi/2));
A1=deg_to_dms(360-A1*180/pi);
H=acos((0-cos(cola*pi/180)*cos(code*pi/180))/sin(cola*pi/180)*sin(code*pi/180));
H=deg_to_dms(H*180/pi)

#result
print "azimuth in deg min sec",A1
print "hour angle in deg min sec",H
azimuth in deg min sec [240, 14, 52.45]
hour angle in deg min sec [69, 15, 38.0]

Example 4.10,Page 120

In [20]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    sd=round(sd,2)
    return [d, m, sd]
#part1
delta=38+15.0/60;
theta=25+10.0/60;

#calculation
z=delta-theta;
alpha=90-z;
z=deg_to_dms(z);
alpha=deg_to_dms(alpha);

#result
print "zenith distance in deg min sec",z
print "altitude in deg min sec",alpha

#part2
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
delta=22+40.0/60;
theta=25+10.0/60;

#calculation
z=-delta+theta;
alpha=90-z;
z=deg_to_dms(z);
alpha=deg_to_dms(alpha);

#result
print "zenith distance in deg min sec",z
print "altitude in deg min sec",alpha

#part3
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md+1)
    sd = (md - m) * 60
    sd=round(sd,2)
    return [d, m, sd]
delta=70+20.0/60;
theta=25+10.0/60;

#calculation
z=delta-theta;
z=deg_to_dms(z);


#result
print "zenith distance in deg min sec",z
zenith distance in deg min sec [13, 4, 60.0]
altitude in deg min sec [76, 55, 0.0]
zenith distance in deg min sec [2, 30, 0.0]
altitude in deg min sec [87, 30, 0.0]
zenith distance in deg min sec [45, 10, -0.0]

Example 4.11,Page 122

In [21]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
theta=42+50.0/60;
delta=83+40.0/60;

#calculation
z=180-delta-theta;
alpha=90-z;
z=deg_to_dms(z);
alpha=deg_to_dms(alpha);

#result
print "zenith distance in deg min sec",z
print "altitude in deg min sec",alpha
zenith distance in deg min sec [53, 29, 60.0]
altitude in deg min sec [36, 30, 0.0]

Example 4.12,Page 133

In [66]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
#part1
dol=110-82-30.0/60; #differnce in longitude
ST=18+35.0/60+10.0/3600;#standard time

#calculation
LMT=ST+dol/15.0;
LMT=deg_to_dms(LMT);

#result
print "LMT in hr min sec",LMT

#part2
dol=82+30.0/60+30; #differnce in longitude
ST=18+35.0/60+10.0/3600;#standard time

#calculation
LMT=ST-dol/15.0;
LMT=deg_to_dms(LMT);

#result
print "LMT in hr min sec",LMT

#part1
dol=82+30.0/60-30; #differnce in longitude
ST=18+35.0/60+10.0/3600;#standard time

#calculation
LMT=ST-dol/15.0;
LMT=deg_to_dms(LMT);

#result
print "LMT in hr min sec",LMT
LMT in hr min sec [20, 25, 10.0]
LMT in hr min sec [11, 5, 10.0]
LMT in hr min sec [15, 5, 10.0]

Example 4.13,Page 134

In [71]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
#part1
LMT=8+30.0/60+15.0/3600;
Long=45+30.0/60;

#calculation
GMT=LMT+Long/15.0;
GMT=deg_to_dms(GMT)

#result
print "GMT in hr min sec (AM)",GMT


#part2
LMT=6+40.0/60+10.0/3600;
Long=55+30.0/60;

#calculation
GMT=LMT-Long/15.0;
GMT=deg_to_dms(GMT)

#result
print "GMT in hr min sec (PM)",GMT
GMT in hr min sec (AM) [11, 32, 15.0]
GMT in hr min sec (PM) [2, 58, 10.0]

Example 4.14,Page 134

In [74]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
#part1
GMT=20+30.0/60+15.0/3600;
Long=82+30.0/60;

#calculation
LMT=GMT+Long/15.0-24;
LMT=deg_to_dms(LMT);

#result
print "LMT in hr min sec (next day)",LMT

#part1
GMT=20+30.0/60+15.0/3600;
Long=120.0;

#calculation
LMT=GMT-Long/15.0;
LMT=deg_to_dms(LMT);

#result
print "LMT in hr min sec (same day)",LMT
LMT in hr min sec (next day) [2, 0, 15.0]
LMT in hr min sec (same day) [12, 30, 15.0]

Example 4.15,Page 135

In [76]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
#part1
RA=6+15.0/60+20.0/3600;
HA=8+10.0/60+30.0/3600;

#calculation
LST=RA+HA;
LST=deg_to_dms(LST);

#result
print "LST in hr min sec",LST

#part2
RA=8+40.0/60+15.0/3600;
HA=3+50.0/60+20.0/3600;

#calculation
LST=RA-HA;
LST=deg_to_dms(LST);

#result
print "LST in hr min sec",LST
LST in hr min sec [14, 25, 50.0]
LST in hr min sec [4, 49, 55.0]

Example 4.16,Page 135

In [78]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
#part1
LHA=6+30.0/60+10.0/3600;

#calculation
LAT=LHA+12;
LAT=deg_to_dms(LAT);

#result
print "LAT in hr min sec",LAT;

#part2
LHA=18+40.0/60+20.0/3600;

#calculation
LAT=LHA+12-24;
LAT=deg_to_dms(LAT);

#result
print "LAT in hr min sec",LAT;
LAT in hr min sec [18, 30, 10.0]
LAT in hr min sec [6, 40, 20.0]

Example 4.17,Page 136

In [79]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=60.0;
LHA=5+30.0/60+20.0/3600;

#calculation
GMT=LHA+12-Long/15.0;
GMT=deg_to_dms(GMT);

#result
print "GMT in hr min sec",GMT
GMT in hr min sec [13, 30, 20.0]

Example 4.18,Page 138

In [81]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
#parta
GMT=0;
ET=10.0/60+1.8/3600;

#calculaion
GAT=GMT+ET;
GAT=deg_to_dms(GAT);

#result
print "GAT in hr min sec",GAT

#partb
GMT=0;
ET=-13.0/60-28.5/3600;

#calculaion
GAT=GMT+ET+24;
GAT=deg_to_dms(GAT);

#result
print "GAT in hr min sec",GAT
GAT in hr min sec [0, 10, 1.8]
GAT in hr min sec [23, 46, 31.5]

Example 4.19,Page 138

In [83]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
ET1=-3.0/60-51.4/3600; #ET at april 2
ET2=-3.0/60-33.5/3600; #ET at april 3

#calculation
dET=(ET2-ET1)*18.0/24; #change in ET
ET=ET1+dET;
ET=deg_to_dms(ET);

#result
print "ET (-ve) in hr min s",ET
ET in hr min s [0, 3, 37.97]

Example 4.20,Page 138

In [84]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
LAT=15+12.0/60+40.0/3600;
Long=20+3.0/60;
GMN=5.0/60+10.65/3600;

#calculation
GAT=LAT+Long/15.0;
e1=(GAT-12)*0.22/3600+GMN;
LAT=GAT+e1-Long/15.0;
LAT=deg_to_dms(LAT);

#result
print "LAT in hr min sec",LAT
LAT in hr min sec [15, 17, 51.65]

Example 4.21,Page 139

In [86]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=56+35.0/60;
LMT=7+15.0/60+25.0/3600;
GMN=3.0/60+54.0/3600;

#calculation
GMT=LMT-Long/15.0;
e1=GMN+(12-GMN)*0.25/3600;
LAT=GMT+Long/15.0+e1;
LAT=deg_to_dms(LAT);

#result
print "LAT in hr min sec",LAT
LAT in hr min sec [7, 19, 21.98]

Example 4.22,Page 142

In [87]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
ST=7+15.0/60+30.0/3600;

#calculation
tr=9.8296/3600*ST;
ST=ST-tr;
ST=deg_to_dms(ST);

#result
print "solar mean time in hr min sec",ST
solar mean time in hr min sec [7, 14, 18.65]

Example 4.23,Page 142

In [90]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
ST=7+45.0/60+50.0/3600;

#calculation
tr=9.8565/3600*ST;
ST=ST+tr;
ST=deg_to_dms(ST);

#result
print "solar mean time in hr min sec",ST
solar mean time in hr min sec [7, 47, 6.52]

Example 4.24,Page 143

In [93]:
#finding LST

#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=140+35.0/60+20.0/3600;
GST=13+15.0/60+30.0/3600;

#calculation
LST=GST+9.8565/3600*Long/15.0;
LST=deg_to_dms(LST);

#result
print "LST in deg min sec",LST

#part2
Long=160+45.0/60+30.0/3600;
GST=13+15.0/60+30.0/3600;

#calculation
LST=GST-9.8565/3600*Long/15.0;
LST=deg_to_dms(LST);

#result
print "LST in deg min sec",LST
LST in deg min sec [13, 17, 2.38]
LST in deg min sec [13, 13, 44.37]

Example 4.25,Page 145

In [95]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=75.0;
GST=15+55.0/60+13.0/3600;
LMT=11.0;

#calculation
LST=GST+Long/15.0*9.8565/3600+LMT+9.8565/3600*LMT;
LST=LST-24;
LST=deg_to_dms(LST);

#result
print "LST of next day in deg min sec",LST
LST of next day in deg min sec [2, 57, 50.7]

Example 4.26,Page 145

In [96]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=75.0;
GST=5+25.0/60+15.0/3600;
LMT=5.0+40.0/60;

#calculation
LST=GST-Long/15.0*9.8565/3600+LMT+9.8565/3600*(LMT);
LST=deg_to_dms(LST);

#result
print "LST of next day in deg min sec",LST
LST of next day in deg min sec [11, 5, 21.57]

Example 4.27,Page 146

In [97]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=75.0;
GST=11+45.0/60+10.0/3600;
LST=26+35.0/60+42.0/3600;

#calculation
LMM=GST+Long/15*9.8565/3600;
LMT=LST-LMM-(LST-LMM)*9.8296/3600;
LMT=deg_to_dms(LMT-12)

#result
print "LMT in hr min sec (PM)",LMT 
LMT in hr min sec (PM) [2, 47, 16.96]

Example 4.28,Page 147

In [100]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=90.0;
GST=9+15.0/60+14.0/3600;
LST=31+35.0/60+12.0/3600;

#calculation
LMM=GST-Long/15*9.8565/3600;
LMT=LST-LMM-(LST-LMM)*9.8296/3600;
LMT=deg_to_dms(LMT-12)

#result
print "LMT in hr min sec (PM)",LMT
LMT in hr min sec (PM) [10, 17, 17.46]

Example 4.29,Page 149

In [102]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=150.0;
GST=12+25.0/60+15.0/3600;
LST=30+15.0/60+10.0/3600;
LMN=18+15.0/60+10.0/3600;

#calculation
LMM=GST+Long/15*9.8565/3600;
LMT=LMN-LMM-(LMN-LMM)*9.8296/3600;
LMT=deg_to_dms(LMT)

#result
print "LMT in hr min sec (PM)",LMT

#part2
LMM=GST+Long/15*9.8565/3600;
LMT=LST-LMM-(LST-LMM)*9.8296/3600;
LMT=deg_to_dms(LMT-12)

#result
print "LMT in hr min sec (AM)",LMT
LMT in hr min sec (PM) [5, 47, 19.38]
LMT in hr min sec (AM) [5, 45, 21.42]

Example 4.30,Page 150

In [103]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
theta=35+15.0/60+20.0/3600;
delta=88+15.0/60+45.0/3600;
RA=1+45.0/60+15.0/3600;

#calculation
H=acos(tan(theta*pi/180)/tan(delta*pi/180));
H=H*180/pi/15;
LST=RA+H;
LST=deg_to_dms(LST);

#result
print "LST in hr min sec",LST
LST in hr min sec [7, 40, 20.12]

Example 4.31,Page 151

In [105]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
RA=22+25.0/60+10.0/3600;
ST=14+45.0/60;#sidereal time
Long=90.0;
GMT=27+15.0/60;
LMN=15+21.0/60+15.0/3600;

#calculation
MT=12+24-GMT+Long/15;#mean time interval
acc=9.8565/3600*MT;
HA=LMN-acc-MT;
LST=HA+24-RA;
LST=deg_to_dms(LST);

#result
print "LST in hr min sec",LST
LST in hr min sec [2, 8, 39.62]

Example 4.32,Page 152

In [107]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=60;
GMT=11+15.0/60+20.0/3600;

#calculation
LMT=GMT-Long/15*9.8296/3600;
LMT=deg_to_dms(LMT);

#result
print "LMT in hr min sec ",LMT

#part2
Long=45;
GMT=11+15.0/60+20.0/3600;

#calculation
LMT=GMT+Long/15*9.8296/3600;
LMT=deg_to_dms(LMT);

#result
print "LMT in hr min sec ",LMT
LMT in hr min sec  [11, 14, 40.68]
LMT in hr min sec  [11, 15, 49.49]

Example 4.33,Page 153

In [111]:
#finding LMT

#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=75;
GMT=6+18.0/60+20.0/3600;
LST=10+25.0/60+15.0/3600;

#calculation
LMT=GMT+Long/15*9.8296/3600;
LST=LST-9.8296/3600*LST;
LMT=LMT+LST;
LMT=deg_to_dms(LMT);

#result
print "LMT in hr min sec ",LMT
LMT in hr min sec  [16, 42, 41.72]

Example 4.34,Page 154

In [112]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
GST=7+35.0/60+40.0/3600;

#calculation
GMT=24-GST-(24-GST)*9.8296/3600;
GMT=deg_to_dms(GMT);

#result
print "GMT in hr min sec",GMT
GMT in hr min sec [16, 21, 38.74]

Example 4.34,Page 154

In [114]:
#finding LMT

#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=120.0;
GMT=12+3.0/60+24.6/3600;

#calculation
LMT=GMT-17.8/24*Long/15.0/3600;
LMT=deg_to_dms(LMT);

#result
print "LMT of LAN in hr min sec",LMT

#part2
Long=45;
GMT=12+3.0/60+24.6/3600;

#calculation
LMT=GMT+17.8/24*Long/15.0/3600;
LMT=deg_to_dms(LMT);

#result
print "LMT of LAN in hr min sec",LMT
LMT of LAN in hr min sec [12, 3, 18.67]
LMT of LAN in hr min sec [12, 3, 26.83]

Example 4.35,Page 156

In [117]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
#one of the 2 solution
f0=5+1.9/60;
n=0.25;
del0=0;
del1=-0.1;
d2=23.0;#del1/2

#calculation
fn=f0+n*d2/60+n*(n-1)/2*(del1+del0)/60;
fn=deg_to_dms(fn)

#result
print "sun declination in deg min sec",fn
sun declination in deg min sec [5, 7, 39.56]

Example 4.36,Page 157

In [1]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
alt=23+40.0/60;
azi=145.0;
lat=50.0;

#calculation
delta=pi/2-acos(cos(pi/2-lat*pi/180)*cos(pi/2-alt*pi/180)+sin(pi/2-lat*pi/180)*sin(pi/2-alt*pi/180)*cos(azi*pi/180));
H=acos((cos(pi/2-alt*pi/180)-cos(pi/2-lat*pi/180)*cos(pi/2-delta))/sin(pi/2-lat*pi/180)*sin(pi/2-delta))
H=deg_to_dms(360-H*180/pi);
delta=deg_to_dms(delta*180/pi);

#result
print "there is a calculation mistake in calculating H in the book"
print "declination in deg min sec",delta
print "hour angle in deg min sec",H
declination in deg min sec [-10, 3, 51.85]
hour angle in deg min sec [325, 4, 44.11]

Example 4.37,Page 158

In [122]:
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
alt=25+30.0/60;
azi=45.0;
lat=42.0;

#calculation
delta=pi/2-acos(cos(pi/2-lat*pi/180)*cos(pi/2-alt*pi/180)+sin(pi/2-lat*pi/180)*sin(pi/2-alt*pi/180)*cos(azi*pi/180));
H=acos((cos(pi/2-alt*pi/180)-cos(pi/2-lat*pi/180)*cos(pi/2-delta))/sin(pi/2-lat*pi/180)*sin(pi/2-delta))
H=deg_to_dms(H*180/pi);
delta=deg_to_dms(delta*180/pi);

#result
print "declination in deg min sec",delta
print "hour angle in deg min sec",H
declination in deg min sec [49, 40, 22.06]
hour angle in deg min sec [93, 58, 30.79]

Example 4.38,Page 158

In [130]:
#finding hour angle,azimuth

#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
delta=21.0*pi/180+25.0/60*pi/180;
lat=25+40.0/60;

#calculation
H=acos((0-cos(pi/2-lat*pi/180)*cos(pi/2-delta))/sin(pi/2-lat*pi/180)*sin(pi/2-delta));
A=acos(cos(pi/2-delta)/sin(pi/2-lat*pi/180));
H=deg_to_dms(360-H*180/pi);
A=deg_to_dms(A*180/pi);

#result
print "hour angle in deg min sec",H
print "azimuth in deg min sec",A
hour angle in deg min sec [260, 35, 53.78]
azimuth in deg min sec [66, 6, 4.59]

Example 4.39,Page 161

In [131]:
#finding latitude

#initialisation of variable
import numpy as np
from scipy import linalg
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
#calculation
A=np.array([[1,1],[1,-1]]);
b=np.array([[90],[0]]);
x=np.linalg.solve(A,b);

#result
print "latitude in degrees",x[0]
latitude in degrees [ 45.]

Example 4.40,Page 161

In [132]:
#finding altitude

#initialisation of variable
import numpy as np
from scipy import linalg
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
theta=53+20.0/60;
delta=53+20.0/60;

#calculation
alpha=theta+delta-90;
alpha=deg_to_dms(alpha);

#result
print "altitude in deg min sec",alpha
altitude in deg min sec [16, 40, 0.0]

Example 4.41,Page 162

In [133]:
#finding GAT

#initialisation of variable
import numpy as np
from scipy import linalg
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
GMT=18+30.0/60;
ET=1.0/60+25.4/3600-0.67*6.5/3600;

#calculation
GAT=GMT+ET;
GAT=deg_to_dms(GAT)

#result
print "GAT in hr min sec",GAT
GAT in hr min sec [18, 31, 21.05]

Example 4.42,Page 163

In [134]:
#finding LMT

#initialisation of variable
import numpy as np
from scipy import linalg
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=30.0;
GAT=13+15.0/60+10.0/3600;
ET=6.0/60+15.35/3600+0.3/3600*1.25278;

#calculation
LMT=GAT+ET-Long/15.0;
LMT=deg_to_dms(LMT);

#result
print "LMT in hr min sec",LMT
LMT in hr min sec [11, 21, 25.73]

Example 4.43,Page 163

In [135]:
#finding LHA

#initialisation of variable
import numpy as np
from scipy import linalg
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
Long=45.0;
E=11+55.0/60+5.0/3600-1.5/6*17.0/3/3600;

#calculation
GMT=14+40.0/60+Long/15.0;
GHA=GMT+E;
LHA=GHA-24-Long/15;
LHA=deg_to_dms(LHA);

#result
print "LHA of the sun in hr min sec",LHA
LHA of the sun in hr min sec [2, 35, 3.58]

Example 4.44,Page 164

In [136]:
#finding GMT

#initialisation of variable
import numpy as np
from scipy import linalg
from math import pi,tan,sqrt,sin,cos,acos,atan,asin
def deg_to_dms(deg):
    d = int(deg)
    md = abs(deg - d) * 60
    m = int(md)
    sd = (md - m) * 60
    if sd==60:
        m=m+1;
        sd=0;
       
    sd=round(sd,2)
    return [d, m, sd]
E=11+55.0/60+24.0/3600+0.5/3600*(2+40.0/60+21.2/3600);
GHA=8+35.0/60+45.2/3600;

#calculation
GMT=GHA+24-E;
GMT=deg_to_dms(GMT);

#result
print "GMT in hr min sec",GMT
GMT in hr min sec [20, 40, 19.86]