nidas  v1.2-1520
metek.h
Go to the documentation of this file.
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; -*-
2 // vim: set shiftwidth=4 softtabstop=4 expandtab:
3 /*
4  ********************************************************************
5  ** NIDAS: NCAR In-situ Data Acquistion Software
6  **
7  ** 2006, Copyright University Corporation for Atmospheric Research
8  **
9  ** This program is free software; you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation; either version 2 of the License, or
12  ** (at your option) any later version.
13  **
14  ** This program is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** The LICENSE.txt file accompanying this software contains
20  ** a copy of the GNU General Public License. If it is not found,
21  ** write to the Free Software Foundation, Inc.,
22  ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  **
24  ********************************************************************
25 */
26 
27 #ifndef NIDAS_DNYLD_ISFF_METEK_H
28 #define NIDAS_DNYLD_ISFF_METEK_H
29 
30 namespace nidas {
31 
32 namespace dynld { namespace isff {
33 
34 //namespace metek contains metek specific paramters
35 namespace metek {
36  union uvwt { double array[4]; struct { double u; double v; double w; double t; }; };
37  void CorrectTemperature(uvwt&);
39  void Apply3DCorrect(uvwt&);
40  void Apply3DCorrect(float uvwtd[5]);
41  double CalcCorrection(double[6], double , const double[20][7]);
42 
43  //const double PI = 3.141592653589793; //nidas codebad calls this M_PI
44  const double Degrees2Rad = 0.01745329251994329577; // === PI/180
45 
46  /* Orginal Metek correction for nc(alpha_raw, phi_raw). Note, the labels in the paper are incorrect*/
47  const double mu_lut[20][7] = {
48  // C_0 C_3 S_3 C_6 S_6 C_9 S_9 phi (in degrees)
49  {1.23095, -0.0859199, -0.0674271, 0.0160088, 0.0363397, 0.0141701, -0.0271955}, //-50
50  {1.19323, -0.0430575, 0.00309311, 0.0430652, 0.0225135, 0.000740028, -0.0114045}, //-45
51  {1.17255, -0.0206394, 0.0145473, 0.0399041, -0.00592748, -0.00650942, -0.00762305}, //-40
52  {1.15408, -0.00768472, 0.0614486, 0.0382888, 0.0123096, -0.0124673, -0.00598534}, //-35
53  {1.12616, -5.36477e-6, 0.0636543, 0.0386879, 0.0153428, -0.014148, -0.000210096}, //-30
54  {1.09976, 0.00667086, 0.0705414, 0.0198549, 0.0165582, -0.0114517, -0.00115495}, //-25
55  {1.07518, 0.00583915, 0.0591098, 0.011127, 0.0104259, -0.00665653, 0.00119842}, //-20
56  {1.05173, 0.00731099, 0.0527018, 0.00230123, 0.00587927, -0.00229463, -0.00297294}, //-15
57  {1.02428, 0.00885121, 0.0330304, -0.000597029, 0.00340367, -0.000745781, -0.000283634}, //-10
58  { 1.011, 0.00930375, 0.0218448, -0.0046575, 0.00203972, -0.00112652, 0.00179908}, // -5
59  {1.00672, 0.0105659, 0.0034918, -0.00844128, 0.00228384, -0.000824805, 0.000200667}, // 0
60  {1.01053, 0.00885115, -0.0182222, -0.00894106, -0.000719837, -0.000420398, -0.00049521}, // 5
61  {1.02332, 0.00618183, -0.035471, -0.00455248, -0.00215202, -0.00229836, -0.000309162}, // 10
62  {1.04358, 0.00648413, -0.0494223, 0.000323015, -0.00396036, -0.00465476, -0.000117245}, // 15
63  {1.06928, 0.00733521, -0.0638425, 0.0101036, -0.00829634, -0.0073708, -0.00051887}, // 20
64  {1.09029, 0.00396333, -0.0647836, 0.0187147, -0.0126355, -0.0115659, 0.000482614}, // 25
65  {1.11877, 0.00299473, -0.0661552, 0.0293485, -0.00957493, -0.00963845, 0.0029231}, // 30
66  {1.13779, 0.00812517, -0.0526322, 0.0341525, -0.00971735, -0.0114763, 0.0013481}, // 35
67  {1.16659, -0.00869651, -0.0537855, 0.0290825, -9.89207e-5, -0.0133731, 0.0117738}, // 40
68  {1.18695, -0.0289647, -0.0461693, 0.030231, -0.0121524, -0.00667729, 0.00565286}, // 45
69  };
70 
71 //alpha_lut is the alpha correction lookup table Values are in degrees. Note, the labels in the paper are incorrect
72  const double alpha_lut[20][7] = {
73  // C_0 C_3 S_3 C_6 S_6 C_9 S_9 phi (in degrees)
74  {-10.7681, 1.83694, 8.12521, 1.76476, -0.120656, -0.31818, 1.30896}, //-50
75  {-7.57048, 2.25939, 4.22328, -0.0394204, -0.112215, -0.289935, 1.99387}, //-45
76  {-6.77725, 0.293479, 3.05333, -1.16341, 0.433886, 0.207458, 1.05195}, //-40
77  {-4.12528, 2.24741, 0.286582, -0.936084, 0.205636, -0.399336, 1.57736}, //-35
78  {-2.00728, 3.63124, -0.325198, -0.821254, 0.236536, -0.303478, 0.854497}, //-30
79  {-3.1161, 3.91749, -0.682098, -0.274558, 0.401386, -0.531782, 0.470723}, //-25
80  {-1.73949, 3.5685, -0.253107, 0.0306742, 0.236975, -0.290767, -0.224723}, //-20
81  {-2.59966, 2.7604, -0.425346, 0.0557135, 0.0392047, 0.222439, -0.364683}, //-15
82  {-1.80055, 2.02108, -0.259729, 0.161799, 0.117651, 0.513197, -0.0546757}, //-10
83  {-1.02146, 1.22626, -0.469781, -0.177656, 0.402977, 0.408776, 0.513465}, // -5
84  {0.152354, 0.208574, 0.051986, -0.102825, 0.480597, -0.0710578, 0.354821}, // 0
85  {0.310938, -0.703761, -0.0131663, 0.0877815, 0.546872, -0.342846, 0.176681}, // 5
86  {0.530836, -1.68132, -0.0487515, 0.0553666, 0.524018, -0.426562, -0.0908979}, // 10
87  {1.70881, -2.46858, -0.487399, 0.207364, 0.638065, -0.458377, -0.230826}, // 15
88  {2.38137, -3.37747, 0.026278, 0.0749961, 0.759096, 0.105791, 0.0287425}, // 20
89  {3.81688, -4.13918, -0.690113, 0.170455, 0.474636, 0.424845, 0.232194}, // 25
90  {3.49414, -3.82687, -0.229292, 0.54375, 0.322097, 0.387805, 0.823967}, // 30
91  {4.1365, -3.22485, 0.752425, 0.755442, 0.623119, 0.250988, 1.26713}, // 35
92  {5.04661, -2.53708, 1.23398, 0.623328, 0.653175, -0.359131, 1.43131}, // 40
93  {4.26165, -3.12817, 2.61556, 0.0450348, -0.330568, -0.34354, 0.81789}, // 45
94  };
95  //phi_lut is the phi correction lookup table Values are in degrees. Note, the labels in the paper are incorrect
96  const double phi_lut[20][7] = {
97  // C_0 C_3 S_3 C_6 S_6 C_9 S_9 phi (in degrees)
98  { 5.77441, -2.19044, 0.123475, -0.229181, 0.226335, 0.271943, 0.0434668}, //-50
99  { 3.82023, -1.6847, 0.315654, 0.562738, 0.175507, -0.0552129, -0.110839}, //-45
100  { 2.29783, -1.04802, 0.0261005, 0.239236, 0.125053, -0.310631, 0.388716}, //-40
101  { 1.37922, -1.0435, 0.302416, -0.0112228, 0.333846, -0.459678, 0.172019}, //-35
102  { 0.837231, -0.593247, -0.199916, -0.0591118, 0.19883, -0.307377, 0.182622}, //-30
103  {-0.0588021, -0.0720115, -0.6826, -0.253726, 0.348259, -0.322761, 0.0059973}, //-25
104  {-0.0333721, 0.101664, -1.41617, -0.136743, 0.332169, -0.244186, -0.0612597}, //-20
105  { 0.0423739, 0.0428399, -1.90137, -0.187419, 0.148025, 0.06782, -0.0317571}, //-15
106  { 0.318212, 0.126425, -2.07763, -0.0341571, 0.198621, 0.178598, 0.103543}, //-10
107  { 0.721731, -0.0274247, -2.10221, -0.081822, 0.36773, 0.0848013, 0.184226}, // -5
108  { 1.65254, -0.0582368, -2.18993, -0.0802346, 0.234886, -0.0545883, -0.0092531}, // 0
109  { 2.49129, -0.116475, -2.11283, 0.112364, 0.247405, -0.115218, -0.0682998}, // 5
110  { 2.99839, -0.0867988, -2.04382, 0.219581, 0.207231, -0.0981521, -0.0581594}, // 10
111  { 3.55129, -0.160112, -1.8474, 0.22217, 0.2794, -0.0323565, -0.0951596}, // 15
112  { 3.20977, -0.137282, -0.966014, 0.183032, 0.380154, 0.155093, -0.0557369}, // 20
113  { 3.38556, -0.0596863, -0.898053, 0.20526, 0.39357, 0.421141, -0.00842409}, // 25
114  { 3.18846, 0.266264, -0.0951907, 0.166895, 0.373018, 0.338146, 0.187917}, // 30
115  { 2.60134, 0.442007, 0.211612, -0.114323, 0.359926, 0.224424, 0.209482}, // 35
116  { 2.04655, 1.08915, 0.470385, -0.333096, 0.268349, 0.263547, 0.264963}, // 40
117  { 0.987659, 1.54127, 0.815214, -0.504021, -0.0835985, 0.197387, 0.0819912}, // 45
118  };
119 }; //namespace metek
120 
121 
122 }}} // namespace nidas namespace dynld namespace isff
123 
124 #endif
double array[4]
Definition: metek.h:36
const double phi_lut[20][7]
Definition: metek.h:96
double t
Definition: metek.h:36
void Apply3DCorrect(uvwt &x)
Definition: metek.cc:35
const double Degrees2Rad
Definition: metek.h:44
double w
Definition: metek.h:36
void Remove2DCorrections(uvwt &x)
Definition: metek.cc:23
Definition: metek.h:36
const double mu_lut[20][7]
Definition: metek.h:47
double u
Definition: metek.h:36
const double alpha_lut[20][7]
Definition: metek.h:72
double CalcCorrection(double fourierCoeffs[6], double phi, const double lut[20][7])
Definition: metek.cc:103
double v
Definition: metek.h:36
void CorrectTemperature(uvwt &x)
Definition: metek.cc:12