#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)
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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;
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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]
#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
#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
#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
#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
#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