OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
czsuba.f
Go to the documentation of this file.
1  subroutine czsuba(rad,altcor,tilt,xnu,pitch,roll,yaw,
2  * rpsi,rths,rth)
3 c
4 c Internal navigation routine to compute trackline effective
5 c bearing to pixel in radians (rpsi), effective scan angle
6 c modified by tilt (rths), and earth surface distance in radians
7 c from ground point to pixel (rth).
8 c
9  implicit real*8 (a-h,o-z)
10  real*4 tilt,pitch,roll,yaw
11 c
12  pid2 = atan(1.0)*2.0
13  pi = acos(-1.0)
14  pi3d2 = pid2*3.0
15  rnu = xnu/rad
16  t = tilt*0.5
17  rt = t/rad
18 c If tilt = 0, it's easy
19  if (tilt .eq. 0.0)then
20  if (xnu .ge. 0.0)then
21  rpsi = pid2
22  else
23  rpsi = pi3d2
24  endif
25  rths = abs(rnu)
26  go to 2
27  endif
28 c If not, ...
29 c Calculate theta-n and phi-n from Scripps Geolocation Algorithm
30 c Report, Wilson, et al
31  root = 1.0/sqrt(2.0)
32  cosc = root*(sin(rt)*cos(rnu)+cos(rt))
33  rthr = 2.0*acos(cosc)
34  rphim = atan(sin(rnu)/(sin(rt)-cos(rt)*cos(rnu)))+pi
35 c Calculate theta and phi
36  rthp = acos(-sin(rthr)*cos(rphim))
37  rtan = sin(rthr)/cos(rthr)
38  rphip = atan(rtan*sin(rphim))
39  if (tilt .lt. 0.0)then
40  rphip = pi+rphip
41  endif
42 c Roll, pitch, yaw corrections
43  if (roll .ne. 0.0 .or. pitch .ne. 0.0 .or. yaw .ne. 0.0)then
44  u = sin(rthp)*cos(rphip)
45  v = sin(rthp)*sin(rphip)
46  w = cos(rthp)
47  y = yaw/rad
48  r = roll/rad
49  p = pitch/rad
50  xp = (1.0+y*r*p)*u + (-y+r*p)*v + p*w
51  yp = y*u + v - r*w
52  zp = (-p+y*r)*u + (-p*y+r)*v + w
53  rths = acos(zp)
54  rpsi = atan2(yp,xp)
55  else
56  rpsi = rphip
57  rths = rthp
58  endif
59 c
60 c Earth distance
61 2 sina = altcor*sin(rths)
62  a = asin(sina)
63  rth = a - rths
64 c
65  return
66  end
#define real
Definition: DbAlgOcean.cpp:26
subroutine czsuba(rad, altcor, tilt, xnu, pitch, roll, yaw, rpsi, rths, rth)
Definition: czsuba.f:3
#define pi
Definition: vincenty.c:23
#define abs(a)
Definition: misc.h:90