OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
TmConstants.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * NAME: TmConstants.h
4  *
5  * DESCRIPTION: Defines constants
6  *
7  *****************************************************************************/
8 
9 #ifndef TmConstants_h
10 #define TmConstants_h
11 
12 #include <math.h>
13 #include <boost/multi_array.hpp>
14 
15 #define BOOST_DISABLE_ASSERTS
16 typedef boost::multi_array<double, 1> double_1darray;
17 typedef boost::multi_array<float, 1> float_1darray;
18 typedef boost::multi_array<short, 1> short_1darray;
19 typedef boost::multi_array<double, 2> double_2darray;
20 typedef boost::multi_array<float, 2> float_2darray;
21 typedef boost::multi_array<short, 2> short_2darray;
22 typedef boost::multi_array<double, 3> double_3darray;
23 typedef boost::multi_array<float, 3> float_3darray;
24 typedef boost::multi_array<short, 3> short_3darray;
25 typedef boost::multi_array<double, 4> double_4darray;
26 typedef boost::multi_array<float, 4> float_4darray;
27 typedef boost::multi_array<short, 4> short_4darray;
28 typedef boost::multi_array<double, 5> double_5darray;
29 typedef boost::multi_array<float, 5> float_5darray;
30 typedef boost::multi_array<short, 5> short_5darray;
31 typedef boost::multi_array<double, 6> double_6darray;
32 typedef boost::multi_array<float, 6> float_6darray;
33 typedef boost::multi_array<short, 6> short_6darray;
34 typedef boost::multi_array<double, 7> double_7darray;
35 typedef boost::multi_array<float, 7> float_7darray;
36 typedef boost::multi_array<short, 7> short_7darray;
37 typedef boost::multi_array<double, 8> double_8darray;
38 typedef boost::multi_array<float, 8> float_8darray;
39 typedef boost::multi_array<short, 8> short_8darray;
40 
41 static const float floatfill = -999.9;
42 static const short shortfill = -999;
43 static const short filltest = -990;
44 
45 #define NUM_SEASONS 4
46 
47 const int TM_SUCCESS = 0;
48 const int TM_FAIL = 1;
49 
50 // Compression
51 
52 const bool bShuffleFilter = true;
53 const bool bDeflateFilter = true;
54 const int deflateLevel = 5;
55 
56 // Enumerations
57 
59 {
65 };
66 
68 {
73 };
74 
75 // numeric constants
76 static const long long MSECPERDAY = 86400000000ll; //24*60*60=86400 million
77 static const double TAI93_TAI58_SEC = 1104537627.0;
78 static const double PlancksConstant = 6.6260755e-34;
79 static const double SpeedOfLight = 2.9979246e+8;
80 static const double BoltzConstant = 1.380658e-23;
81 static const double Wav2 = 11.0;
82 
83 
84 const double PIO2 = M_PI_2; // pi/2
85 const double PIO4 = M_PI_4; // pi/4
86 const double TREPIO2 = 3.0L*M_PI/2.0L; // 3*pi/2
87 const double TWOPI = 2.0L*M_PI; // 2*pi
88 
89 // used to convert degrees to radians
90 const double DEG2RAD = M_PI/180.0L; // (pi/180)
91 
92 // used to convert radians to degrees
93 const double RAD2DEG = 180.0L/M_PI; // (180/pi)
94 
95 // used to convert degrees to arcsec
96 const double DEG2ARCSEC = 3600.0L; // seconds in a degree
97 
98 // Universal Gas Constant - used to compute virtual temp. J/(kg*K)
99 const float DRYGAS = 287.05;
100 
101 // Average Atmospheric Pressure at Sea Level
102 const double AVG_PRESS_SEALVL = 1013.25e0;
103 
104 // Gravity (m/s^2)
105 const double GRAVITY = 9.80665;
106 
107 // Radius of the Area Weighting Reference Sphere (m)
108 // This is NOT the radius of the earth and should not be used for any
109 // calculations other than by Area Weighting to determine if a pixel
110 // is near the pole.
111 const double EARTH_RADIUS_METERS = 6371007.181;
112 
113 // The following constant definitions are the WGS84 Earth Ellipsoid
114 // constants. The main reference for the WGS84 ellipsoid is
115 // NIMA Physical Geodesy web page: 164.214.2.59/GandG/wgs-84/egm96.htm
116 // See the updated page with the link to the NIMA TR8350.2 document:
117 // http://earth-info.nga.mil/GandG/publications/tr8350.2/tr8350_2.html
118 // The Flattening Factor(f) is computed from f = 1/298.257223563.
119 const double EQUAT_RAD = 6.37813700000000e+6; // Equatoral rad., meters WGS84
120 const double POLAR_RAD = 6.35675231424518e+6; // Polar radius, meters WGS84
121 const double ECCEN_SQ = 6.69437999014132e-3; // Eccentricity Squared WGS84
122 const double FLATFAC = 3.35281066474748071e-3; // Flattening Factor WGS84
123 
124 // Earth Gravitational Parameter mu (G*M) in m^3 per s^2 from WGS84.
125 // The central term in the Earth's gravitational field (GM) is known with
126 // much greater accuracy than either 'G', the universal gravitational
127 // constant, or 'M', the mass of the Earth. The refined value accounting
128 // for the mass of the atmosphere is (3986004.418 +/- 0.008) e+8 m^3/s^2.
129 // GPS OCS applications take advantage of the improved value, however,
130 // Section 3.2.3.2 and the ICD-GPS-200 recommends the original WGS 84 GM
131 // value to avoid introduction of error to the GPS user.
132 const double EARTH_GRAV_mu = 3.986005000e+14;
133 
134 // USAF Orbit Analyst Manuals, circa 1978. 1 - eccen_sqr
135 const double DETIC2CENTRIC = 9.93305620009859e-1;
136 const double CENTRIC2DETIC = 1.00673949674228e+0;
137 
138 // The following constant definitions are for time conversions
139 
140 const double TAI2IET = 1.0e+06; // Conversion factor
141 const double MIN_IN_HOUR = 60.0e+0; // Number of minutes in an hour
142 const double SEC_IN_HOUR = 3600.0e+0; // Number of seconds in an hour
143 const double MJD_CONV_FAC = 2.4000005e+6; // Factor to convert AJD to MJD
144 const double SEC_IN_DAY = 8.64e+04; // Number of seconds in a day
145 const double UJD58 = 2.43620450e+06; // Jan 1 1958 UJD format
146 const double JAN012030 = 2.272147232e+09; // Jan 1 2030 TAI format
147 const double TJD_CONV_FAC = 32.184e+0; // Factor to convert TAI to TJD
148 const double DEG_IN_HOUR = 15.0e+0; // Number of degrees in an hour
149 
150 // The following constant definitions are for polarstereographic dataset
151 const double MINUS30 = -0.523598775598299e0; // -30 degrees in radians
152 const double PLUS30 = 0.523598775598299e0; // 30 degrees in radians
153 
154 // The following constant definitions are for nwp ancillary granulation
155 // declare constant for calculation of water vapor mixing ratio (r)
156 const double GAS = 621.97; //-- ratio of the molecular weight
157 //-- of water vapor to dry air
158 //-- in units of grams/kilogram
159 
160 // declare just a few of the more popular of the twenty SI prefixes
161 const double MICRO = 0.000001; //-- scale by 1/1000000th
162 const double MILLI = 0.001; //-- scale by 1/1000th
163 const double CENTI = 0.01; //-- scale by 1/100th
164 const double DECI = 0.1; //-- scale by 1/10th
165 const double DEKA = 10.0; //-- scale by 10x
166 const double HECTO = 100.0; //-- scale by 100x
167 
168 // Kelvin/Celsius conversion factor
169 const double TCOEFF=273.15;
170 
171 // Constant used to generate surface reflectance
172 // multiplier to convert pascal to atmospheres (1 atm = 101325 pascal)
173 const float PRESS_CONV = 1.0 / 101325.0;
174 
175 // Standard Atmosphere Surface Pressure
176 const double STDPSL=1013.0;
177 
178 // Moist air adiabatic lapse rate is 6.5 K/Km (equivalent to 6.5 C/Km)
179 // Converted value would be .0065 C/m
180 const double MOIST_AIR_LAPSE_RATE = 6.5/1000;
181 
182 #endif
const double MJD_CONV_FAC
Definition: TmConstants.h:143
const int TM_FAIL
Definition: TmConstants.h:48
@ WINTER
Definition: TmConstants.h:60
boost::multi_array< float, 2 > float_2darray
Definition: TmConstants.h:20
const double DETIC2CENTRIC
Definition: TmConstants.h:135
const double TJD_CONV_FAC
Definition: TmConstants.h:147
boost::multi_array< short, 7 > short_7darray
Definition: TmConstants.h:36
const bool bDeflateFilter
Definition: TmConstants.h:53
const double UJD58
Definition: TmConstants.h:145
const float DRYGAS
Definition: TmConstants.h:99
const double EARTH_RADIUS_METERS
Definition: TmConstants.h:111
const double DEG_IN_HOUR
Definition: TmConstants.h:148
@ NOTHING
Definition: TmConstants.h:72
const double PIO4
Definition: TmConstants.h:85
boost::multi_array< double, 6 > double_6darray
Definition: TmConstants.h:31
const double RAD2DEG
Definition: TmConstants.h:93
const double MILLI
Definition: TmConstants.h:162
const int TM_SUCCESS
Definition: TmConstants.h:47
const double TAI93_TAI58_SEC
boost::multi_array< short, 2 > short_2darray
Definition: TmConstants.h:21
const double POLAR_RAD
Definition: TmConstants.h:120
boost::multi_array< float, 5 > float_5darray
Definition: TmConstants.h:29
boost::multi_array< float, 1 > float_1darray
Definition: TmConstants.h:17
const double DEG2ARCSEC
Definition: TmConstants.h:96
const double TREPIO2
Definition: TmConstants.h:86
@ FALL
Definition: TmConstants.h:63
const double PLUS30
Definition: TmConstants.h:152
const double CENTI
Definition: TmConstants.h:163
boost::multi_array< short, 1 > short_1darray
Definition: TmConstants.h:18
@ PACE
Definition: TmConstants.h:71
boost::multi_array< float, 3 > float_3darray
Definition: TmConstants.h:23
const double MOIST_AIR_LAPSE_RATE
Definition: TmConstants.h:180
const double EQUAT_RAD
Definition: TmConstants.h:119
boost::multi_array< short, 4 > short_4darray
Definition: TmConstants.h:27
const double STDPSL
Definition: TmConstants.h:176
const double FLATFAC
Definition: TmConstants.h:122
const double TCOEFF
Definition: TmConstants.h:169
const double MICRO
Definition: TmConstants.h:161
@ VIIRS
Definition: TmConstants.h:70
const double JAN012030
Definition: TmConstants.h:146
boost::multi_array< double, 4 > double_4darray
Definition: TmConstants.h:25
boost::multi_array< double, 7 > double_7darray
Definition: TmConstants.h:34
boost::multi_array< double, 2 > double_2darray
Definition: TmConstants.h:19
const double MIN_IN_HOUR
Definition: TmConstants.h:141
boost::multi_array< short, 3 > short_3darray
Definition: TmConstants.h:24
const double DEG2RAD
Definition: TmConstants.h:90
boost::multi_array< double, 3 > double_3darray
Definition: TmConstants.h:22
boost::multi_array< float, 7 > float_7darray
Definition: TmConstants.h:35
boost::multi_array< double, 5 > double_5darray
Definition: TmConstants.h:28
boost::multi_array< short, 8 > short_8darray
Definition: TmConstants.h:39
#define M_PI
Definition: pml_iop.h:15
SEASON_ENUM
Definition: AfrtConstants.h:45
const double TAI2IET
Definition: TmConstants.h:140
const double GAS
Definition: TmConstants.h:156
const double MINUS30
Definition: TmConstants.h:151
PROJECT_ENUM
Definition: AfrtConstants.h:63
boost::multi_array< short, 6 > short_6darray
Definition: TmConstants.h:33
const double HECTO
Definition: TmConstants.h:166
const double TWOPI
Definition: TmConstants.h:87
@ MODIS
Definition: TmConstants.h:69
const double ECCEN_SQ
Definition: TmConstants.h:121
const bool bShuffleFilter
Definition: TmConstants.h:52
@ NEVER
Definition: TmConstants.h:64
const double DEKA
Definition: TmConstants.h:165
const double AVG_PRESS_SEALVL
Definition: TmConstants.h:102
boost::multi_array< short, 5 > short_5darray
Definition: TmConstants.h:30
const int deflateLevel
Definition: TmConstants.h:54
const double GRAVITY
Definition: TmConstants.h:105
boost::multi_array< float, 8 > float_8darray
Definition: TmConstants.h:38
boost::multi_array< float, 4 > float_4darray
Definition: TmConstants.h:26
const double PIO2
Definition: TmConstants.h:84
@ SPRING
Definition: TmConstants.h:61
const double SEC_IN_HOUR
Definition: TmConstants.h:142
const double CENTRIC2DETIC
Definition: TmConstants.h:136
const double SEC_IN_DAY
Definition: TmConstants.h:144
@ SUMMER
Definition: TmConstants.h:62
const double EARTH_GRAV_mu
Definition: TmConstants.h:132
boost::multi_array< float, 6 > float_6darray
Definition: TmConstants.h:32
boost::multi_array< double, 8 > double_8darray
Definition: TmConstants.h:37
const double DECI
Definition: TmConstants.h:164
boost::multi_array< double, 1 > double_1darray
Definition: TmConstants.h:16
const float PRESS_CONV
Definition: TmConstants.h:173