OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
earcomp.f
Go to the documentation of this file.
1  subroutine earcomp(tlm, time, pos, vel, nlines, gaclac, navqc,
2  1 navctl, nad_bod, nadbodfl, widphse, widphfl )
3 c
4 c earcomp(tlm, time, pos, vel, nlines, gaclac, navqc,
5 c navctl, nad_bod, nadbodfl, widphse, widphfl )
6 c
7 c purpose: process the earth sensor data into line-by-line satellite
8 c nadir vectors
9 c
10 c calling arguments:
11 c
12 c name Type i/o description
13 c -------- ---- --- -----------
14 c tlm struct i telemetry containing the sun sensor
15 c data
16 c time r*8 i size nlines time of each line in seconds
17 c past the reference time
18 c pos r*4 i size 3 by nlines gps smoothed position
19 c data for the orbit(km)
20 c vel r*4 i size 3 by nlines gps smoothed velocity
21 c data for the orbit(km/sec)
22 c nlines i*4 i number of lines in this segment
23 c gaclac i*4 i flag for gac or lac data type,
24 c 1 = gac, 0 = lac
25 c navqc struct i quality controls including sun angle
26 c and sun angle rate change tolerences
27 c navctl struct i navigation controls including sun-sensor
28 c to spacrcraft transform matricies
29 c nad_bod r*4 o size 3 by nlines weighted sun vectors
30 c in s/c frame
31 c nadbodfl i*4 o quality flags for sun_bod vectors, 0 = good
32 c widphse r*4 o size 2 by nlines by 2 sensor processed
33 c width and phase
34 c widphfl i*4 o size nlines by 2 sensor width and phase flags
35 c
36 c by: w. robinson, gsc, 13 apr 93
37 c
38 c notes:
39 c
40 c modification history:
41 c
42 c modified logic to set larger smoothing interval for lac and hrpt data.
43 c f. s. patt, gsc, december 24, 1997.
44 c
45  implicit none
46 c
47 #include "tlm_str.fin"
48 #include "navqc_s.fin"
49 #include "navctl_s.fin"
50 c
51  type(tlm_struct) :: tlm
52  type(navqc_struct) :: navqc
53  type(navctl_struct) :: navctl
54  integer*4 nlines, gaclac, nadbodfl(maxlin), widphfl(maxlin,2)
55  real*8 time(nlines)
56  real*4 nad_bod(3,maxlin), pos(3,nlines),
57  1 vel(3,nlines), widphse(2,maxlin,2)
58 c
59  integer*4 earrng(2,2), isens, nper, numact, iret, procrng(2,2),
60  1 ilin, nfpts, nskip
61  real*4 measlcl(2,maxlin)
62 c
63 c initially set all output flags
64  do isens = 1, 2
65  do ilin = 1, nlines
66  widphfl(ilin,isens) = 1
67  end do
68  end do
69 c
70 c start, determine the active ranges for each sensor
71 c(assume 1 quasi-contiguous range)
72 c
73  do isens = 1, 2
74  call actrng( tlm%ntlm, tlm%earth(isens)%active,
75  1 earrng(1,isens) )
76  end do
77 c
78 c for the active ranges, check the 2 angles to be within tolerence
79 c
80  call eartol( tlm%earth, navqc, earrng )
81 c
82 c check the remaining unflagged angles for consistency
83 c
84  call earcnst( gaclac, navqc, earrng, tlm%earth )
85 c
86 c perform a running 3rd order polynomial fit over the active ranges
87 c
88  nfpts = navctl%nefpts
89  nskip = navctl%neskip
90  if( gaclac .eq. 1 ) then
91  nper = 5
92  else
93  nper = 1
94  nfpts = nfpts*20
95  nskip = nskip*20
96  end if
97 c
98  do isens = 1, 2
99 
100 c If valid data within 3 frames of start or end of data,
101 c extend range to end
102  if (earrng(1,isens) .le. 3) earrng(1,isens) = 1
103  if (earrng(2,isens) .ge. (tlm%ntlm-3))
104  * earrng(2,isens) = tlm%ntlm
105  if( earrng(1,isens) .gt. 0 ) then
106  numact = earrng(2,isens) - earrng(1,isens) + 1
107 c
108  procrng(1,isens) = ( earrng(1,isens) - 1 ) * nper + 1
109  procrng(2,isens) = earrng(2,isens) * nper
110 c
111  call runfit3t( nfpts, nskip, measlcl,
112  1 tlm%earth(isens)%widphse(1,earrng(1,isens)), numact, 2,
113  1 tlm%earth(isens)%flag(earrng(1,isens)), nper,
114  1 time(procrng(1,isens)),
115  1 tlm%earth(isens)%deltim(earrng(1,isens)),
116  1 widphse(1,procrng(1,isens),isens),
117  1 widphfl(procrng(1,isens),isens), iret )
118 c
119  else
120  procrng(1,isens) = -1
121  end if
122  end do
123 c
124 c
125 c the sensor data is now checked and fitted to every data line.
126 c now, create the set of nadir vectors assuming a reference
127 c yaw of 0
128 c
129 c yawest = 0.
130 c do ilin = 1, nlines
131 c call earth( pos(1,ilin), vel(1,ilin), widphse(1,ilin,1),
132 c 1 widphfl(ilin,1), widphse(1,ilin,2), widphfl(ilin,2),
133 c 1 yawest, navctl, nad_bod(1,ilin), nadbodfl(ilin) )
134 c end do
135 c
136 c and end
137 c
138  return
139  end
int navigation(int32_t fileID)
Definition: l1_octs_hdf.c:696
subroutine earcnst(gaclac, navqc, earrng, earth)
Definition: earcnst.f:2
subroutine actrng(nitem, active, irange)
Definition: actrng.f:2
subroutine earth(pos, vel, widphse1, widphfl1, widphse2,
Definition: earth.f:2
void fit(float x[], float y[], int ndata, float sig[], int mwt, float *a, float *b, float *siga, float *sigb, float *chi2, float *q)
#define real
Definition: DbAlgOcean.cpp:26
subroutine eartol(earth, navqc, earrng)
Definition: eartol.f:2
float rd(float x, float y, float z)
subroutine earcomp(tlm, time, pos, vel, nlines, gaclac, navqc,
Definition: earcomp.f:2
===========================================================================V5.0.48(Terra) 03/20/2015 Changes shown below are differences from MOD_PR02 V5.0.46(Terra)============================================================================Changes noted for V6.1.20(Terra) below were also instituted for this version.============================================================================V6.1.20(Terra) 03/12/2015 Changes shown below are differences from MOD_PR02 V6.1.18(Terra)============================================================================Changes from v6.1.18 which may affect scientific output:A situation can occur in which a scan which contains sector rotated data has a telemetry value indicating the completeness of the sector rotation. This issue is caused by the timing of the instrument command to perform the sector rotation and the recording of the telemetry point that reports the status of sector rotation. In this case a scan is considered valid by L1B and pass through the calibration - reporting extremely high radiances. Operationally the TEB calibration uses a 40 scan average coefficient, so the 20 scans(one mirror side) after the sector rotation are contaminated with anomalously high radiance values. A similar timing issue appeared before the sector rotation was fixed in V6.1.2. Our analysis indicates the ‘SET_FR_ENC_DELTA’ telemetry correlates well with the sector rotation encoder position. The use of this telemetry point to determine scans that are sector rotated should fix the anomaly occured before and after the sector rotation(usually due to the lunar roll maneuver). The fix related to the sector rotation in V6.1.2 is removed in this version.============================================================================V6.1.18(Terra) 10/01/2014 Changes shown below are differences from MOD_PR02 V6.1.16(Terra)============================================================================Added doi attributes to NRT(Near-Real-Time) product.============================================================================V6.1.16(Terra) 01/27/2014 Changes shown below are differences from MOD_PR02 V6.1.14(Terra)============================================================================Migrate to SDP Toolkit 5.2.17============================================================================V6.1.14(Terra) 06/26/2012 Changes shown below are differences from MOD_PR02 V6.1.12(Terra)============================================================================Added the doi metadata to L1B product============================================================================V6.1.12(Terra) 04/25/2011 Changes shown below are differences from MOD_PR02 V6.1.8(Terra)============================================================================1. The algorithm to calculate uncertainties for reflective solar bands(RSB) is updated. The current uncertainty in L1B code includes 9 terms from prelaunch analysis. The new algorithm regroups them with the new added contributions into 5 terms:u1:the common term(AOI and time independent) and
Definition: HISTORY.txt:126
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_MPI") target_link_libraries(afrt_nc4 $
Definition: CMakeLists.txt:16
subroutine runfit3t(nfpts, nskip, measlcl, meas, nmeas, nquant, flag, nper, time, timdif, measout, flgout, iret)
Definition: runfit3t.f:3
subroutine phase
Definition: phase.f:2
flags
Definition: DDAlgorithm.h:22
#define f
Definition: l1_czcs_hdf.c:702