OB.DAAC Logo
NASA Logo
Ocean Color Science Software

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