OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
pderiv.f
Go to the documentation of this file.
1  subroutine pderiv(ngps,igyr,igday,gpsec,vecs,orbinit,
2  * iyinit,idinit,secinit,driv)
3 c
4 c Purpose: This routine computes partial derivatives of the orbit positions
5 c with respect to the initial mean elements. Methods and
6 c algorithms are described in TBD
7 c
8 c Calling Arguments:
9 c
10 c Name Type I/O Description
11 c -------- ---- --- -----------
12 c ngps I*4 I Number of vectors
13 c igyr I*4 I Time tag year
14 c igday I*4 I Time tag day-of-year
15 c gpsec(ngps) R*8 I Time tag seconds-of-day
16 c vecs(6,ngps) R*8 I Input orbit vectors
17 c orbinit(6) R*8 I Initial orbital elements
18 c iyinit I*4 I Orbital element epoch year
19 c idinit I*4 I Orbital element epoch day-of-year
20 c secinit R*8 I Orbital element epoch seconds-of-day
21 c driv(6,3,ngps) R*8 O Partial derivatives of orbit position vectors
22 c
23 c
24 c By: Frederick S. Patt, GSC, December 21, 1993
25 c
26 c Notes:
27 c
28 c Modification History:
29 c
30  implicit none
31 #include "nav_cnst.fin"
32 
33  real*8 gpsec(maxlin),vecs(6,maxlin),driv(6,3,maxlin),orbinit(6)
34  real*8 on(3), v(3), p(3), gm, aj2, ddif, secinit
35  real*8 pm, vm, om, oxy, tmp, xmm, t, oa, am, dldi, dmdi
36  real*8 sini, cosi, sinl, cosl, sino, coso, sinm, cosm
37  integer*4 ngps, igyr, igday, iyinit, idinit
38  integer*4 i, j, k, jd
39  data gm/398600.5d0/,aj2/1.08263d-3/
40 
41 
42 c Compute day offset of data from element epoch
43  ddif = (jd(igyr,1,igday) - jd(iyinit,1,idinit))*864.d2
44 
45 c Compute constant for precession rates
46  tmp = 1.5d0*aj2*sqrt(gm)*re**2/orbinit(1)**3.5
47 
48 c Compute mean motion with J2 correction
49  xmm = sqrt(gm/orbinit(1)**3)*(1.d0 + 1.5*aj2*(re/orbinit(1))**2
50  * *(4.d0*cos(orbinit(3)/radeg)**2 - 1.d0))
51 
52 c Loop through orbit vectors
53  do i=1,ngps
54 
55 c Compute time offset from element epoch
56  t = gpsec(i) - secinit + ddif
57 
58 c Load vector in local arrays
59 c Orbit velocities must be corrected for Earth rotation rate
60  p(1) = vecs(1,i)
61  p(2) = vecs(2,i)
62  p(3) = vecs(3,i)
63  v(1) = vecs(4,i) - omegae*p(2)
64  v(2) = vecs(5,i) + omegae*p(1)
65  v(3) = vecs(6,i)
66 
67 c Compute position and velocity magnitudes
68  pm = sqrt(p(1)*p(1) + p(2)*p(2) + p(3)*p(3))
69  vm = sqrt(v(1)*v(1) + v(2)*v(2) + v(3)*v(3))
70 
71 c Compute instantaneous orbit normal
72  on(1) = p(2)*v(3) - p(3)*v(2)
73  on(2) = p(3)*v(1) - p(1)*v(3)
74  on(3) = p(1)*v(2) - p(2)*v(1)
75  om = sqrt(on(1)*on(1) + on(2)*on(2) + on(3)*on(3))
76  oxy = sqrt(on(1)*on(1) + on(2)*on(2))
77 
78 c Compute sines and cosines of inclination, RA of ascending node and
79 c orbit angle
80  sini = oxy/om
81  cosi = on(3)/om
82  sinl = on(1)/oxy
83  cosl = -on(2)/oxy
84  coso = p(1)*cosl + p(2)*sinl
85  sino = p(3)/sini
86  oa = atan2(sino,coso)
87 
88 c Compute anomaly (includes correction for perigee precession)
89  am = oa - orbinit(5)/radeg - tmp*t*(2.-2.5*sini*sini)
90  sinm = sin(am)
91  cosm = cos(am)
92 
93 c Compute partial derivatives
94 
95 c With respect to semimajor axis
96  do j=1,3
97  driv(1,j,i) = (p(j) - 1.5d0*v(j)*t)/pm
98  end do
99 
100 c With respect to eccentricity
101  do j=1,3
102  driv(2,j,i) = 2.d0*sinm*pm*v(j)/vm - cosm*p(j)
103  end do
104 
105 c With respect to RA of ascending node
106  driv(4,1,i) = -p(2)
107  driv(4,2,i) = p(1)
108  driv(4,3,i) = 0.d0
109 
110 c With respect to argument of perigee
111  do j=1,3
112  driv(5,j,i) = -orbinit(2)*(2.d0*cosm*pm*v(j)/vm + sinm*p(j))
113  end do
114 
115 c With respect to mean anomaly
116  do j=1,3
117  driv(6,j,i) = v(j)/xmm
118  end do
119 
120 c With respect to inclination
121 c Includes corrections to mean motion and ascending node rates
122  dmdi = -8.*sini*cosi*tmp
123  dldi = sini*tmp
124  do j=1,3
125  driv(3,j,i) = sino*on(j)/om + driv(4,j,i)*t*dldi
126  * + driv(6,j,i)*t*dmdi
127  end do
128 
129 c Convert all angle derivatives to degrees
130  do j=1,3
131  do k=3,6
132  driv(k,j,i) = driv(k,j,i)/radeg
133  end do
134  end do
135 
136 c End of main loop
137  end do
138 
139  return
140  end
#define real
Definition: DbAlgOcean.cpp:26
subroutine pderiv(ngps, igyr, igday, gpsec, vecs, orbinit, iyinit, idinit, secinit, driv)
Definition: pderiv.f:3
#define re
Definition: l1_czcs_hdf.c:701
Definition: jd.py:1
this program makes no use of any feature of the SDP Toolkit that could generate such a then geolocation is calculated at that and then aggregated up to Resolved feature request Bug by adding three new int8 SDSs for each high resolution offsets between the high resolution geolocation and a bi linear interpolation extrapolation of the positions This can be used to reconstruct the high resolution geolocation Resolved Bug by delaying cumulation of gflags until after validation of derived products Resolved Bug by setting Latitude and Longitude to the correct fill resolving to support Near Real Time because they may be unnecessary if use of entrained ephemeris and attitude data is turned on(as it will be in Near-Real-Time processing).