OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
eci2ecef.f
Go to the documentation of this file.
1  subroutine eci2ecef(time,ecivec,ecrvec)
2 c
3 c Converts inertial Earth-centered coordinates of position and
4 c velocity into Earth-centered, Earth-fixed (ECEF) coordinates,
5 c using the Greenwich Hour Angle as the rotation angle.
6 c
7  implicit none
8 c
9  real*8 time ! julian vector time
10  real*8 ecivec(6) ! eci vector (x,y,z,vx,vy,vz)
11  real*8 ecrvec(6) ! eci vector (x,y,z,vx,vy,vz)
12 c
13  real*8 gha
14  integer*4 year
15  integer*4 day
16  real*8 sec
17 c
18  logical*4 firstCall
19  real*8 pi,radeg,re,rem,f,omf2,omegae
20  common /gconst/pi,radeg,re,rem,f,omf2,omegae
21  data firstcall / .true. /
22 c
23  if (firstcall) then
24  firstcall = .false.
25  call cdata
26  endif
27 c
28  call jul2yds(time,year,day,sec)
29  call gha2000(year,day+sec/86400.d0,gha)
30 c
31  call ecef(gha,ecivec(1),ecivec(4),ecrvec(1),ecrvec(4))
32 
33 c rgha = gha/radeg
34 c cosgha = dcos(rgha)
35 c singha = dsin(rgha)
36 
37 c
38 c Position rotation
39 c ecrvec(1) = ecivec(1)*cosgha + ecivec(2)*singha
40 c ecrvec(2) = -ecivec(1)*singha + ecivec(2)*cosgha
41 c ecrvec(3) = ecivec(3)
42 
43 c
44 c Velocity rotation
45 c
46 c term1 = ecivec(4)*cosgha + ecivec(5)*singha
47 c term2 = omegae*(-ecivec(4)*singha + ecivec(5)*cosgha)
48 c ecrvec(4) = term1+term2
49 c
50 c term1 = -ecivec(4)*singha + ecivec(5)*cosgha
51 c term2 = omegae*(-ecivec(4)*cosgha - ecivec(5)*singha)
52 c ecrvec(5) = term1+term2
53 c
54 c ecrvec(6) = ecivec(6)
55 c
56  return
57  end
subroutine eci2ecef(time, ecivec, ecrvec)
Definition: eci2ecef.f:2
#define real
Definition: DbAlgOcean.cpp:26
subroutine ecef(gha, posi, veli, pose, vele)
Definition: ecef.f:2
subroutine cdata
Definition: cdata.f:2
#define re
Definition: l1_czcs_hdf.c:701
#define pi
Definition: vincenty.c:23
#define omf2
Definition: l1_czcs_hdf.c:703
#define f
Definition: l1_czcs_hdf.c:702
subroutine jul2yds(jul, year, day, sec)
Definition: jul2yds.f:9