c Wind direction
integer ddd
print*,'Enter zonal and meridional wind'
read*,u,v
ff=sqrt((u*u)+(v*v))
if ((u.eq.0).and.(v.lt.0))then
ddd=0
endif
if ((u.lt.0).and.(v.lt.0))then
ddd=(atan(u/v))*180/3.14
endif
if ((u.lt.0).and.(v.eq.0))then
ddd=90
endif
if ((u.lt.0).and.(v.gt.0))then
ddd=180+(atan(u/v))*180/3.14
endif
if ((u.eq.0).and.(v.gt.0))then
ddd=180
endif
if ((u.gt.0).and.(v.gt.0))then
ddd=180+(atan(u/v))*180/3.14
endif
if ((u.gt.0).and.(v.eq.0))then
ddd=270
endif
if ((u.gt.0).and.(v.lt.0))then
ddd=360+(atan(u/v))*180/3.14
endif
print *,'wind Speed =',ff
print *,'wind direction =',ddd
if(ddd.eq.0)then
print*,'Northerly'
endif
if(ddd.eq.180)then
print*,'Southerly'
endif
if(ddd.eq.90)then
print*,'Easterly'
endif
if(ddd.eq.270)then
print*,'Westerly'
endif
if(ddd.eq.45)then
print*,'Northeasterly'
endif
if(ddd.eq.135)then
print*,'Southeasterly'
endif
if(ddd.eq.225)then
print*,'Southwesterly'
endif
if(ddd.eq.315)then
print*,'Northwesterly'
endif
stop
end
No comments:
Post a Comment