OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
lladjust.f
Go to the documentation of this file.
1  subroutine lladjust(tilt,roll,pitch,yaw,senz,xlon,ylat)
2 
3 c Adjusts navigation for CZCS pixel longitudes and latitudes
4 c This version applies an along-track (orbit) and yaw adjustment
5 c Adjustments are assumes to be small angles
6 
7  real senz(1968),xlon(1968),ylat(1968)
8  real vll(3),vecn(3),veco(3),dvo(3),dvy(3)
9  real*8 th,tmp1,tmp2,sini
10  data xincl/99.28/
11  data orbadj/0.046/,yawadj/0.18/
12 
13  real*8 pi,radeg,re,rem,f,omf2,omegae
14  common /gconst/pi,radeg,re,rem,f,omf2,omegae
15 
16 
17 c First find nadir pixel
18  szm = 90.
19  i = 900
20  dowhile(senz(i).lt.szm)
21  szm = senz(i)
22  i = i + 1
23  end do
24  i = i - 1
25 
26 c Compute orbit normal unit vector
27 
28  sini = sin(xincl/radeg)
29  cosi = cos(xincl/radeg)
30 
31 c Orbit angle from ascending node
32 c th = radeg*asin(sin(ylat(i)/radeg)/sini)
33  tmp1 = ylat(i)/radeg
34  tmp2 = dsin(tmp1)/sini
35  if (tmp2.gt.1.d0) then
36  th = 90.d0
37  else if (tmp2.lt.(-1.d0)) then
38  th = -90.d0
39  else
40  th = radeg*dasin(tmp2)
41  end if
42 
43 c Longitude of ascending node
44  xlnn = xlon(i) - radeg*atan(tan(th/radeg)*cosi)
45 
46 c Orbit normal vector
47  veco(1) = sini*sin(xlnn/radeg)
48  veco(2) = -sini*cos(xlnn/radeg)
49  veco(3) = cosi
50 
51 c Compute unit vector along spacecraft nadir
52 c Determine along-track angle from zenith and tilt
53  if ((tilt+pitch).gt.0) then
54  tal = senz(i) - tilt - pitch
55  else
56  tal = -senz(i) - tilt - pitch
57  end if
58  th = th - tal
59 
60 c Compute nadir vector
61  vecn(1) = cos(th/radeg)*cos(xlnn/radeg)
62  * - sin(th/radeg)*cosi*sin(xlnn/radeg)
63  vecn(2) = sin(th/radeg)*cosi*cos(xlnn/radeg)
64  * + cos(th/radeg)*sin(xlnn/radeg)
65  vecn(3) = sin(th/radeg)*sini
66 
67 c Scale both vectors by adjustment angle
68  do i=1,3
69  vecn(i) = vecn(i)*yawadj/radeg
70  veco(i) = veco(i)*orbadj/radeg
71  end do
72 
73 c Adjust pixel lons/lats
74 
75 c For every pixel
76  do i=1,1968
77 
78 c Convert to a vector
79  vll(1) = cos(xlon(i)/radeg)*cos(ylat(i)/radeg)
80  vll(2) = sin(xlon(i)/radeg)*cos(ylat(i)/radeg)
81 
82  vll(3) = sin(ylat(i)/radeg)
83 
84 c Compute adjustment vectors
85  call crossp(vecn,vll,dvy)
86  call crossp(veco,vll,dvo)
87 
88 c Adjust vector
89  do j=1,3
90  vll(j) = vll(j) + dvy(j) + dvo(j)
91  end do
92 
93 c Compute adjusted lon and lat
94  xlon(i) = radeg*atan2(vll(2),vll(1))
95  ylat(i) = radeg*asin(vll(3))
96 
97  end do
98 
99  return
100  end
101 
subroutine lladjust(tilt, roll, pitch, yaw, senz, xlon, ylat)
Definition: lladjust.f:2
#define real
Definition: DbAlgOcean.cpp:26
#define re
Definition: l1_czcs_hdf.c:701
subroutine crossp(v1, v2, v3)
Definition: crossp.f:2
#define pi
Definition: vincenty.c:23
#define omf2
Definition: l1_czcs_hdf.c:703
#define f
Definition: l1_czcs_hdf.c:702