OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
DbLutNetcdf.h
Go to the documentation of this file.
1 /******************************************************************************
2  * NAME: DbLutNetcdf.h
3  *
4  * DESCRIPTION: Object class that generates a netCDF4 LUT.
5  *
6  * Created on: April 25, 2017
7  * Author: Sam Anderson
8  *
9  ******************************************************************************/
10 
11 #ifndef DbLutNetcdf_H_
12 #define DbLutNetcdf_H_
13 
14 #include <boost/multi_array.hpp>
15 #include <netcdf>
16 #include <DDProcess.h>
17 
18 using namespace std;
19 using namespace netCDF;
20 using namespace netCDF::exceptions;
21 
22 static const int NDET = 10; // number of detectors per channel
23 static const int NAOI = 6; // number of mirror incidence angles in LUT
24 static const int NSIDE = 2; // number of mirror sides
25 static const int NBANDLUT = 3; // number of bands in LUT (incl. TDI bands)
26 // 11 bands = 8,9,10,11,12,13L,13H,14L,14H,15,16
27 static const int NBANDS = 3; // number of bands in polar. correction from MODIS, band 1,3,8
28 // static const int ntimer = 200; // number of times (~months) for which polarization coeff. were derived(C051), Terra
29 static const int NTIMER = 138; // number of times for which Terra/MODIS polar. coeff. were derived(C006), 20100928
30 static const int NTIMER_AQ = 121; // number of times for which Aqua/MODIS polar. coeff. were derived(C006), 20101012
31 static const int NBANDLUTR = 3; // number of bands in LUT, 9 bands (B08-B16)
32 static const int NCOEFF = 6; // number of polynomial coefficients (3rd order polynomical)
33 
34 extern const int chindx[8]; //{ 1,2,3,4,5,6,10,11 }
35 extern const int bindx[3]; //{ 1,3,8 } DeepBlue targetted bands in MODIS
36 extern const string str_season[NUM_SEASONS];
37 
38 struct dbLUT {
39  short xxyear[NTIMER]; // year and DoY for which the pol. coeff. were derived
40  short xxday[NTIMER];
41  short xxyear_aq[NTIMER_AQ];
42  short xxday_aq[NTIMER_AQ];
43  float angle_of_incident[NAOI];
44  float am12[NAOI];
45  float am13[NSIDE][NAOI][NDET][NBANDLUT];
46  float xxwave[NBANDLUTR]; // wavelengths for ocean bands
47  float xxwave_aq[NBANDLUTR];
48  double sectab[NTIMER]; // reference time for LUT (seconds)
49  double xxrvs[NCOEFF][NDET][NSIDE][NBANDLUTR][NTIMER]; // pol. coeff. for ocn bands
50  double xxam12[NCOEFF][NDET][NSIDE][NBANDLUTR][NTIMER];
51  double xxam13[NCOEFF][NDET][NSIDE][NBANDLUTR][NTIMER];
52  double xxrvs_aq[NCOEFF][NDET][NSIDE][NBANDLUTR][NTIMER_AQ];
53  double sectab_aq[NTIMER_AQ];
54 };
55 
56 static const int ENTRIES_412 = 121;
57 static const int ENTRIES_470 = 104;
58 static const int XCAL_COEF = 6;
59 static const int MODIS_DETECTORS = 10;
60 static const int MIRROR_SIDES = 2;
61 static const int NLATS = 180;
62 static const int NLONS = 360;
63 static const int NSEASONS = 4;
64 static const int NMONTHS = 12;
65 static const int NNDVI = 3;
66 static const int NTERMS = 4;
67 
69  short YEAR_412[ENTRIES_412];
70  short DAY_412[ENTRIES_412];
71  short YEAR_470[ENTRIES_470];
72  short DAY_470[ENTRIES_470];
73  float GAIN_412[ENTRIES_412];
74  float GAIN_470[ENTRIES_470];
75  double XCAL_412_M11[XCAL_COEF][MODIS_DETECTORS][MIRROR_SIDES][ENTRIES_412-1];
76  double XCAL_412_M12[XCAL_COEF][MODIS_DETECTORS][MIRROR_SIDES][ENTRIES_412-1];
77  double XCAL_412_M13[XCAL_COEF][MODIS_DETECTORS][MIRROR_SIDES][ENTRIES_412-1];
78  double XCAL_470_M11[XCAL_COEF][MODIS_DETECTORS][MIRROR_SIDES][ENTRIES_470-1];
79  double XCAL_470_M12[XCAL_COEF][MODIS_DETECTORS][MIRROR_SIDES][ENTRIES_470-1];
80  double XCAL_470_M13[XCAL_COEF][MODIS_DETECTORS][MIRROR_SIDES][ENTRIES_470-1];
81 };
82 
84  float SR412_ALL[NSEASONS][NLATS*10][NLONS*10];
85  float SR412_FWD[NSEASONS][NLATS*10][NLONS*10];
86  float SR470_ALL[NSEASONS][NLATS*10][NLONS*10];
87  float SR470_FWD[NSEASONS][NLATS*10][NLONS*10];
88  float SR650_ALL[NSEASONS][NLATS*10][NLONS*10];
89  float SR650_FWD[NSEASONS][NLATS*10][NLONS*10];
90  float SR865_ALL[NSEASONS][NLATS*10][NLONS*10];
91 };
92 
94  boost::multi_array<float,2> SR412_ALL_L;
95  boost::multi_array<float,2> SR412_FWD_L;
96  boost::multi_array<float,2> SR470_ALL_L;
97  boost::multi_array<float,2> SR470_FWD_L;
98  boost::multi_array<float,2> SR650_ALL_L;
99  boost::multi_array<float,2> SR650_FWD_L;
100  boost::multi_array<float,2> SR865_ALL_L;
101 };
102 
104  float latitude[NLATS*10][NLONS*10];
105  float longitude[NLATS*10][NLONS*10];
106  float coeffs_2130_to_412[NLATS*10][NLONS*10];
107  float coeffs_2130_to_470[NLATS*10][NLONS*10];
108  float min_2130_for_412[NLATS*10][NLONS*10];
109  float max_2130_for_412[NLATS*10][NLONS*10];
110  float min_2130_for_470[NLATS*10][NLONS*10];
111  float max_2130_for_470[NLATS*10][NLONS*10];
112  float data_num_total[NLATS*10][NLONS*10];
113  float data_num_fitting[NLATS*10][NLONS*10];
114  float stderr_412[NLATS*10][NLONS*10];
115  float stderr_470[NLATS*10][NLONS*10];
116 };
117 // Surface Pressure LUT
118 static const int SP_720 = 720;
119 static const int SP_360 = 360;
120 static const int SP_SETS = 6;
121 
123  float PS[SP_720][SP_360];
124  float SURFACE_PRESSURE[SP_SETS * SP_720][SP_SETS * SP_360];
125  float SURFACE_ELEVATION[SP_SETS * SP_720][SP_SETS * SP_360];
126 };
127 
128 // Nvalx LUT
129 static const int NSZAV = 10;
130 static const int NSZA = 12;
131 static const int NVZA = 46;
132 static const int NRAA = 30;
133 static const int NTAU = 10;
134 static const int SSA412 = 8;
135 static const int SSA470 = 4;
136 static const int SSA650 = 1;
137 static const int SR412 = 20;
138 static const int SR470 = 24;
139 static const int SR650 = 24;
140 
141 // Nvalx LUT
142 
143 struct dbNvalxLUT {
144  float NVALX_412[SR412][SSA412][NTAU][NRAA][NVZA][NSZA];
145  float NVALX_470[SR470][SSA470][NTAU][NRAA][NVZA][NSZA];
146  float NVALX_650[SR650][NTAU][NRAA][NVZA][NSZA];
147 };
148 
149 static const int NSTOKES = 3;
150 static const int NRRAA = 31;
151 
153  float RAYL_412[NRRAA][NVZA][NSZA][NSTOKES];
154  float RAYL_470[NRRAA][NVZA][NSZA][NSTOKES];
155  float RAYL_650[NRRAA][NVZA][NSZA][NSTOKES];
156 };
157 
158 
159 // MODIS/SeaWifs LER Tables LUT
160 
161 static const int MTABLE_20800 = 20800;
162 static const int MTABLE_260 = 260;
163 static const int MTABLE_160 = 160;
164 static const int MTABLE_2 = 2;
165 
166 struct dbTablesLUT {
167  float LOGI0[MTABLE_20800];
168  float Z1I0[MTABLE_20800];
169  float Z2I0[MTABLE_20800];
170  float TI0[MTABLE_20800];
171  float SB[MTABLE_260];
172  float LOGI0R[MTABLE_160];
173  float Z1I0R[MTABLE_160];
174  float Z2I0R[MTABLE_160];
175  float TI0R[MTABLE_160];
176  float SBR[MTABLE_2];
177 };
178 
180  float NVALX21_SFC[NSEASONS][NRAA][NVZA][NSZAV];
181  float R0X21_SFC[NSEASONS][NRAA][NVZA][NSZAV];
182  float SX21_SFC[NSEASONS][NRAA][NVZA][NSZAV];
183  float TX21_SFC[NSEASONS][NRAA][NVZA][NSZAV];
184  float NVALX672_SFC[NSEASONS][NRAA][NVZA][NSZAV];
185  float R0X672_SFC[NSEASONS][NRAA][NVZA][NSZAV];
186  float SX672_SFC[NSEASONS][NRAA][NVZA][NSZAV];
187  float TX672_SFC[NSEASONS][NRAA][NVZA][NSZAV];
188  float NVALX865_SFC[NSEASONS][NRAA][NVZA][NSZAV];
189  float R0X865_SFC[NSEASONS][NRAA][NVZA][NSZAV];
190  float SX865_SFC[NSEASONS][NRAA][NVZA][NSZAV];
191  float TX865_SFC[NSEASONS][NRAA][NVZA][NSZAV];
192 };
193 
195  float SR412_ALL[NSEASONS][NLATS*10][NLONS*10];
196  float SR488_ALL[NSEASONS][NLATS*10][NLONS*10];
197  float SR670_ALL[NSEASONS][NLATS*10][NLONS*10];
198  float BRDF_650[NLATS*10][NLONS*10];
199 };
200 
202  boost::multi_array<float,2> SR412_ALL_L;
203  boost::multi_array<float,2> SR488_ALL_L;
204  boost::multi_array<float,2> SR670_ALL_L;
205  boost::multi_array<float,2> BRDF_650_L;
206 };
207 
209  float SC412_ALL[NSEASONS][NNDVI][NTERMS][NLATS*10][NLONS*10];
210  float SC412_FWD[NSEASONS][NNDVI][NTERMS][NLATS*10][NLONS*10];
211  float SC470_ALL[NSEASONS][NNDVI][NTERMS][NLATS*10][NLONS*10];
212  float SC470_FWD[NSEASONS][NNDVI][NTERMS][NLATS*10][NLONS*10];
213  float SC650_ALL[NSEASONS][NNDVI][NTERMS][NLATS*10][NLONS*10];
214  float SC650_FWD[NSEASONS][NNDVI][NTERMS][NLATS*10][NLONS*10];
215 };
216 
218  boost::multi_array<float,4> SC412_ALL_L;
219  boost::multi_array<float,4> SC412_FWD_L;
220  boost::multi_array<float,4> SC470_ALL_L;
221  boost::multi_array<float,4> SC470_FWD_L;
222  boost::multi_array<float,4> SC650_ALL_L;
223  boost::multi_array<float,4> SC650_FWD_L;
224 };
225 
227  int VEGETATION[4*NLATS*10][NLONS*10];
228  short IGBP[NLATS*10][NLONS*10];
229  short REGION_INDEX[NLATS*10][NLONS*10];
230  float DESERTS_FLAG[NLATS*10][NLONS*10];
231 };
232 
233 struct dbGeozoneLUT {
234  float GEOZONE_FLAG[NLATS*10][NLONS*10];
235  float ELEVATION_STDV[NLATS*10][NLONS*10];
236  float BACKGROUND_AOD[4][NLATS][NLONS];
237 };
238 
239 static const int NSCOEF = 3;
240 static const int NSLATS = 3000;
241 static const int NSLONS = 6000;
243  float latitude[NSEASONS][NSLATS][NSLONS];
244  float longitude[NSEASONS][NSLATS][NSLONS];
245  float coeffs_2250_to_412[NSEASONS][NSCOEF][NSLATS][NSLONS];
246  float coeffs_2250_to_488[NSEASONS][NSCOEF][NSLATS][NSLONS];
247  float coeffs_2250_to_670[NSEASONS][NSCOEF][NSLATS][NSLONS];
248  float min_2250_for_412[NSEASONS][NSLATS][NSLONS];
249  float max_2250_for_412[NSEASONS][NSLATS][NSLONS];
250  float min_2250_for_488[NSEASONS][NSLATS][NSLONS];
251  float max_2250_for_488[NSEASONS][NSLATS][NSLONS];
252  float min_2250_for_670[NSEASONS][NSLATS][NSLONS];
253  float max_2250_for_670[NSEASONS][NSLATS][NSLONS];
254  float data_num_total[NSEASONS][NSLATS][NSLONS];
255  float data_num_fitting[NSEASONS][NSLATS][NSLONS];
256  float stderr_412[NSEASONS][NSLATS][NSLONS];
257  float stderr_488[NSEASONS][NSLATS][NSLONS];
258  float stderr_670[NSEASONS][NSLATS][NSLONS];
259 };
260 
261 static const int NVSZA = 22;
262 static const int NVVZA = 20;
263 static const int NVRAA = 21;
264 static const int NAOT1 = 14;
265 static const int NAOT2 = 7;
266 static const int NFMF1 = 7;
267 static const int NFMF2 = 5;
268 static const int NFMF3 = 8;
269 static const int NFMF4 = 4;
270 static const int NWS = 6;
271 static const int NCHL = 4;
272 static const int NDBOWL = 7;
273 static const int NDBMDL = 4;
274 static const int NDBLWL = 3;
275 
277  const static size_t nsza = NVSZA;
278  const static size_t nvza = NVVZA;
279  const static size_t nraa = NVRAA;
280  size_t naot;
281  size_t nfmf;
282  const static size_t nwspd = NWS;
283  const static size_t nchl = NCHL;
284  const static size_t nwave = NDBOWL;
285  boost::multi_array<float,7> m03;
286  boost::multi_array<float,7> m04;
287  boost::multi_array<float,7> m05;
288  boost::multi_array<float,7> m07;
289  boost::multi_array<float,6> m08;
290  boost::multi_array<float,6> m10;
291  boost::multi_array<float,6> m11;
292  boost::multi_array<float,1> sza;
293  boost::multi_array<float,1> vza;
294  boost::multi_array<float,1> raa;
295  boost::multi_array<float,1> aot550;
296  boost::multi_array<float,1> fmf;
297  boost::multi_array<float,1> wspd;
298  boost::multi_array<float,1> chl;
299  boost::multi_array<float,1> wave;
300  boost::multi_array<float,2> ae;
301  boost::multi_array<float,3> aot;
302  boost::multi_array<float,3> fine_aot;
303  boost::multi_array<float,3> coarse_aot;
304  boost::multi_array<float,3> ssa;
305  boost::multi_array<float,3> fine_ssa;
306  boost::multi_array<float,3> coarse_ssa;
307  boost::multi_array<float,3> asy;
308  boost::multi_array<float,3> fine_asy;
309  boost::multi_array<float,3> coarse_asy;
310 };
311 
313  const static size_t nsza = NVSZA;
314  const static size_t nvza = NVVZA;
315  const static size_t nraa = NVRAA;
316  size_t naot;
317  size_t nfmf;
318  const static size_t nwspd = NWS;
319  const static size_t nchl = NCHL;
320  const static size_t nwave = NDBOWL;
321  float m03[NCHL][NWS][NFMF3][NAOT1][NVRAA][NVVZA][NVSZA];
322  float m04[NCHL][NWS][NFMF3][NAOT1][NVRAA][NVVZA][NVSZA];
323  float m05[NCHL][NWS][NFMF3][NAOT1][NVRAA][NVVZA][NVSZA];
324  float m07[NCHL][NWS][NFMF3][NAOT1][NVRAA][NVVZA][NVSZA];
325  float m08[NWS][NFMF3][NAOT1][NVRAA][NVVZA][NVSZA];
326  float m10[NWS][NFMF3][NAOT1][NVRAA][NVVZA][NVSZA];
327  float m11[NWS][NFMF3][NAOT1][NVRAA][NVVZA][NVSZA];
328  float sza[NVSZA];
329  float vza[NVVZA];
330  float raa[NVRAA];
331  float aot550[NAOT1];
332  float fmf[NFMF3];
333  float wspd[NWS];
334  float chl[NCHL];
335  float wave[NDBOWL];
336  float ae[NFMF3][NAOT1];
337  float aot[NDBOWL][NFMF3][NAOT1];
338  float fine_aot[NDBOWL][NFMF3][NAOT1];
339  float coarse_aot[NDBOWL][NFMF3][NAOT1];
340  float ssa[NDBOWL][NFMF3][NAOT1];
341  float fine_ssa[NDBOWL][NFMF3][NAOT1];
342  float coarse_ssa[NDBOWL][NFMF3][NAOT1];
343  float asy[NDBOWL][NFMF3][NAOT1];
344  float fine_asy[NDBOWL][NFMF3][NAOT1];
345  float coarse_asy[NDBOWL][NFMF3][NAOT1];
346 };
347 
348 
350  float SZA412_Nodes[NSZA];
351  float VZA412_Nodes[NVZA];
352  float RAA412_Nodes[NRAA];
353  float AOT412_Nodes[NTAU];
354  float SSA412_Nodes[SSA412];
355  float SR412_Nodes[SR412];
356  float nvalx412[SR412][SSA412][NTAU][NRAA][NVZA][NSZA];
357  float SZA488_Nodes[NSZA];
358  float VZA488_Nodes[NVZA];
359  float RAA488_Nodes[NRAA];
360  float AOT488_Nodes[NTAU];
361  float SSA488_Nodes[SSA470];
362  float SR488_Nodes[SR470];
363  float nvalx488[SR470][SSA470][NTAU][NRAA][NVZA][NSZA];
364  float SZA672_Nodes[NSZA];
365  float VZA672_Nodes[NVZA];
366  float RAA672_Nodes[NRAA];
367  float AOT672_Nodes[NTAU];
368  float SSA672_Nodes[SSA650];
369  float SR672_Nodes[SR650];
370  float nvalx672[SR650][SSA650][NTAU][NRAA][NVZA][NSZA];
371 };
372 
373 static const int NUMX = 21601;
374 static const int NUMY = 10801;
375 
377  double x[NUMX];
378  double y[NUMY];
379  int z[NUMY][NUMX];
380 };
381 
382 struct dbChlLUT {
383  float longitude[NLATS*10][NLONS*10];
384  float latitude[NLATS*10][NLONS*10];
385  double time[NMONTHS];
386  float log_chl[NLATS*10][NLONS*10][NMONTHS];
387 };
388 
389 
390 static const int NDAYS = 95;
391 
392 struct dbXCalLUT {
393 // int GEOZONE[NLATS*10][NLONS*10];
394 };
395 
396 class DbLutNetcdf {
397 
398 public:
399 
400  // file attributes
401  string lut_title_;
403 
404  // global attributes:
405  string sensor_;
407  string Conventions_;
408  string institution_;
409  string license_;
416  string creator_url_;
417  string project_;
424  string history_;
430 
435  DbLutNetcdf();
436 
441  ~DbLutNetcdf();
442 
447  int initialize();
448 
453  int create_db_nc4_lut();
454 
459  int read_tables_lut(dbTablesLUT* lut);
460  int read_surface_pressure_lut(dbSurfacePressureLUT* lut);
461  int read_nvalx_lut(dbNvalxLUT* lut);
462  int read_veg_21sfc_lut(dbVeg_21sfcLUT* lut);
463  int read_swir_lut(dbViirsSwirVsVisLUT* lut);
464  int read_modis_surf_refl_lut(dbModisSurfReflLimited* lut, int* start,
465  int* edge, int& season, int &dateline);
466  int read_viirs_surf_refl_lut(dbViirsSurfReflLimited* lut, int* start,
467  int* edge, int& season, int &dateline);
468  int read_surf_coeff_lut(dbSurfCoeffLimited* lut, int* start,
469  int* edge, int& season, int &dateline);
470  int read_landcover_lut(dbLandcoverLUT* lut);
471  int read_ocean_aero_lut(dbOceanAerosolLUMA* lut, const string sType);
472  int read_land_aero_lut(dbLandAerosolLUT* lut, const string sType);
473  int read_bathymetry_lut(dbBathymetryLUT* lut);
474  int read_chl_lut(dbChlLUT* lut);
475  int read_geozone_lut(dbGeozoneLUT* lut);
477 
483  history_ = history;
484  }
486  return history_;
487  }
488 
489 protected:
490 
495  int read_tables_file(dbTablesLUT* lut);
496  int read_surface_pressure_file(dbSurfacePressureLUT* lut);
497  int read_nvalx_files(dbNvalxLUT* lut);
498  int read_veg_21sfc_files(dbVeg_21sfcLUT* lut);
499  int read_swir_file( dbViirsSwirVsVisLUT* lut );
500  int read_modis_surf_refl_files(dbModisSurfReflLUT* lut);
501  int read_viirs_surf_refl_files(dbViirsSurfReflLUT* lut);
502  int read_surf_coeff_files(dbSurfCoeffLUT* lut);
503  int read_landcover_files(dbLandcoverLUT* lut);
504  int read_ocean_aero_file( dbOceanAerosolLUT* lut, const string strType );
505  int read_land_aero_file( dbLandAerosolLUT* lut, const string strType );
506  int read_bathymetry_files( dbBathymetryLUT* lut );
507  int read_chl_files( dbChlLUT* lut );
508  int read_geozone_files( dbGeozoneLUT* lut );
509  int read_rayleigh_files(dbRayleighLUT* lut);
510 
515  int write_tables_lut(NcFile* nc_output, dbTablesLUT* lut);
516  int write_surface_pressure_lut(NcFile* nc_output,
517  dbSurfacePressureLUT* mt_lut);
518  int write_nvalx_lut(NcFile* nc_output, dbNvalxLUT* lut);
519  int write_veg_21sfc_lut(NcFile* nc_output, dbVeg_21sfcLUT* lut);
520  int write_swir_lut(NcFile* nc_output, dbViirsSwirVsVisLUT* lut);
521  int write_modis_surf_refl_lut(NcFile* nc_output, dbModisSurfReflLUT* lut);
522  int write_viirs_surf_refl_lut(NcFile* nc_output, dbViirsSurfReflLUT* lut);
523  int write_surf_coeff_lut(NcFile* nc_output, dbSurfCoeffLUT* lut);
524  int write_landcover_lut(NcFile* nc_output, dbLandcoverLUT* lut);
525  int write_ocean_aero_lut(NcFile* nc_output, dbOceanAerosolLUT* lut,
526  const string strType);
527  int write_land_aero_lut(NcFile* nc_output, dbLandAerosolLUT* lut,
528  const string strType);
529  int write_bathymetry_lut(NcFile* nc_output, dbBathymetryLUT* lut);
530  int write_chl_lut(NcFile* nc_output, dbChlLUT* lut);
531  int write_geozone_lut(NcFile* nc_output, dbGeozoneLUT* lut);
532  int write_rayleigh_lut(NcFile* nc_output, dbRayleighLUT* lut);
533 
538  int write_global_attributes(NcFile* nc_output);
539 
544  bool isPlatformLittleEndian();
545 
546  // Dimensions
547 
548  NcDim scalar_dim_;
550  NcDim dim_months_;
551  NcDim dim_20800_;
552  NcDim dim_260_;
553  NcDim dim_160_;
554  NcDim dim_2_;
555  NcDim dim_3_;
556  NcDim dim_4_;
557  NcDim dim_720_;
558  NcDim dim_180_;
559  NcDim dim_360_;
560  NcDim dim_4320_;
561  NcDim dim_2160_;
562  NcDim dim_nszav_;
563  NcDim dim_nsza_;
564  NcDim dim_nvza_;
565  NcDim dim_nraa_;
566  NcDim dim_ntau_;
567  NcDim dim_nssa_;
568  NcDim dim_nsr_;
569  NcDim dim_ssa412_;
570  NcDim dim_ssa470_;
571  NcDim dim_sr412_;
572  NcDim dim_sr470_;
573  NcDim dim_sr650_;
574  NcDim dim_ndvi_;
575  NcDim dim_terms_;
576  NcDim dim_3000_;
577  NcDim dim_6000_;
578  NcDim dim_1800_;
579  NcDim dim_3600_;
580  NcDim dim_7200_;
581  NcDim dim_nrraa_;
583  NcDim dim_xcoeff_;
584  NcDim dim_det_;
585  NcDim dim_ms_;
590  NcDim dim_nfmf_;
591  NcDim dim_nws_;
592  NcDim dim_nchl_;
593  NcDim dim_nwl_;
594  NcDim dim_nx_;
595  NcDim dim_ny_;
596  NcDim dim_nz_;
597 
604  template<typename T>
605  static void byteSwap(T& aValue);
606 
607 };
608 
609 //---------------------------------------------------------------------------
610 // Converts the endianness of the parameter by performing the appropriate
611 // byte swapping.
612 //---------------------------------------------------------------------------
613 template<typename T>
614 void DbLutNetcdf::byteSwap(T& aValue) {
615  T tempValue = aValue; // a temporary copy of the value
616 
617  // Pointers to the first byte of both variables
618  unsigned char* aValuePtr = reinterpret_cast<unsigned char*>(&aValue);
619  unsigned char* tempValuePtr = reinterpret_cast<unsigned char*>(&tempValue);
620 
621  // Swap the byte order
622  for (unsigned int byte = 0; byte < sizeof(aValue); ++byte) {
623  aValuePtr[byte] = tempValuePtr[(sizeof(aValue) - 1) - byte];
624  }
625 }
626 
627 #endif /* DtLutNetcdf_H_ */
boost::multi_array< float, 1 > vza
Definition: DbLutNetcdf.h:293
NcDim dim_entries_470_
Definition: DbLutNetcdf.h:587
string publisher_name_
Definition: DbLutNetcdf.h:418
NcDim dim_terms_
Definition: DbLutNetcdf.h:575
string creator_email_
Definition: DbLutNetcdf.h:415
string time_coverage_start_
Definition: DbLutNetcdf.h:426
NcDim scalar_dim_
Definition: DbLutNetcdf.h:548
boost::multi_array< float, 1 > aot550
Definition: DbLutNetcdf.h:295
boost::multi_array< float, 3 > coarse_asy
Definition: DbLutNetcdf.h:309
boost::multi_array< float, 7 > m04
Definition: DbLutNetcdf.h:286
NcDim dim_ny_
Definition: DbLutNetcdf.h:595
string publisher_email_
Definition: DbLutNetcdf.h:420
boost::multi_array< float, 1 > wave
Definition: DbLutNetcdf.h:299
string creator_name_
Definition: DbLutNetcdf.h:414
NcDim dim_months_
Definition: DbLutNetcdf.h:550
int format_version_
Definition: DbLutNetcdf.h:428
NcDim dim_4_
Definition: DbLutNetcdf.h:556
real(single), dimension(:,:), allocatable longitude
NcDim dim_entries_412_
Definition: DbLutNetcdf.h:586
NcDim dim_180_
Definition: DbLutNetcdf.h:558
boost::multi_array< float, 2 > BRDF_650_L
Definition: DbLutNetcdf.h:205
NcDim dim_nchl_
Definition: DbLutNetcdf.h:592
NcDim dim_nstokes_
Definition: DbLutNetcdf.h:582
NcDim dim_360_
Definition: DbLutNetcdf.h:559
NcDim dim_seasons_
Definition: DbLutNetcdf.h:549
real(single), dimension(:,:), allocatable latitude
void initialize(int pixref_flag, int blkref_flag)
Definition: Usds.c:1371
boost::multi_array< float, 1 > chl
Definition: DbLutNetcdf.h:298
boost::multi_array< float, 2 > SR412_FWD_L
Definition: DbLutNetcdf.h:95
NcDim dim_2_
Definition: DbLutNetcdf.h:554
NcDim dim_160_
Definition: DbLutNetcdf.h:553
boost::multi_array< float, 3 > coarse_aot
Definition: DbLutNetcdf.h:303
NcDim dim_ssa470_
Definition: DbLutNetcdf.h:570
NcDim dim_ndvi_
Definition: DbLutNetcdf.h:574
@ string
int instrument_number_
Definition: DbLutNetcdf.h:429
const int chindx[8]
Definition: DbLutNetcdf.cpp:27
string Conventions_
Definition: DbLutNetcdf.h:407
string lut_prod_name_
Definition: DbLutNetcdf.h:402
NcDim dim_nsza_
Definition: DbLutNetcdf.h:563
NcDim dim_nfmf_
Definition: DbLutNetcdf.h:590
string naming_authority_
Definition: DbLutNetcdf.h:410
NcDim dim_xcoeff_
Definition: DbLutNetcdf.h:583
boost::multi_array< float, 1 > raa
Definition: DbLutNetcdf.h:294
boost::multi_array< float, 4 > SC470_FWD_L
Definition: DbLutNetcdf.h:221
boost::multi_array< float, 2 > SR865_ALL_L
Definition: DbLutNetcdf.h:100
string lut_title_
Definition: DbLutNetcdf.h:401
const string str_season[NUM_SEASONS]
Definition: DbLutNetcdf.cpp:29
string history_
Definition: DbLutNetcdf.h:424
string keywords_vocabulary_
Definition: DbLutNetcdf.h:412
const int bindx[3]
Definition: DbLutNetcdf.cpp:28
NcDim dim_sr470_
Definition: DbLutNetcdf.h:572
std::string getHistory()
Definition: DbLutNetcdf.h:485
NcDim dim_entries_470x_
Definition: DbLutNetcdf.h:589
NcDim dim_det_
Definition: DbLutNetcdf.h:584
NcDim dim_sr412_
Definition: DbLutNetcdf.h:571
boost::multi_array< float, 3 > asy
Definition: DbLutNetcdf.h:307
NcDim dim_260_
Definition: DbLutNetcdf.h:552
boost::multi_array< float, 7 > m05
Definition: DbLutNetcdf.h:287
NcDim dim_nx_
Definition: DbLutNetcdf.h:594
NcDim dim_3_
Definition: DbLutNetcdf.h:555
NcDim dim_720_
Definition: DbLutNetcdf.h:557
NcDim dim_nrraa_
Definition: DbLutNetcdf.h:581
NcDim dim_sr650_
Definition: DbLutNetcdf.h:573
NcDim dim_4320_
Definition: DbLutNetcdf.h:560
boost::multi_array< float, 4 > SC650_ALL_L
Definition: DbLutNetcdf.h:222
string publisher_url_
Definition: DbLutNetcdf.h:419
boost::multi_array< float, 1 > wspd
Definition: DbLutNetcdf.h:297
NcDim dim_nwl_
Definition: DbLutNetcdf.h:593
boost::multi_array< float, 7 > m07
Definition: DbLutNetcdf.h:288
#define PS
Definition: proj_define.h:42
NcDim dim_nsr_
Definition: DbLutNetcdf.h:568
boost::multi_array< float, 3 > ssa
Definition: DbLutNetcdf.h:304
NcDim dim_entries_412x_
Definition: DbLutNetcdf.h:588
NcDim dim_ntau_
Definition: DbLutNetcdf.h:566
#define SB
Definition: usrmac.h:191
boost::multi_array< float, 2 > SR650_FWD_L
Definition: DbLutNetcdf.h:99
boost::multi_array< float, 6 > m10
Definition: DbLutNetcdf.h:290
string history
Definition: ncattredit.py:30
string processing_level_
Definition: DbLutNetcdf.h:421
#define NUM_SEASONS
Definition: AfrtConstants.h:32
string cdm_data_type_
Definition: DbLutNetcdf.h:422
boost::multi_array< float, 1 > fmf
Definition: DbLutNetcdf.h:296
boost::multi_array< float, 1 > sza
Definition: DbLutNetcdf.h:292
boost::multi_array< float, 2 > SR412_ALL_L
Definition: DbLutNetcdf.h:202
void read_rayleigh_lut(char *file, int32_t iw, int pol_opt)
Definition: rayleigh.c:69
boost::multi_array< float, 4 > SC650_FWD_L
Definition: DbLutNetcdf.h:223
boost::multi_array< float, 2 > SR488_ALL_L
Definition: DbLutNetcdf.h:203
int orbit_number_
Definition: DbLutNetcdf.h:423
NcDim dim_6000_
Definition: DbLutNetcdf.h:577
NcDim dim_nszav_
Definition: DbLutNetcdf.h:562
NcDim dim_3600_
Definition: DbLutNetcdf.h:579
string processing_version_
Definition: DbLutNetcdf.h:406
boost::multi_array< float, 2 > SR470_ALL_L
Definition: DbLutNetcdf.h:96
string date_created_
Definition: DbLutNetcdf.h:411
NcDim dim_ms_
Definition: DbLutNetcdf.h:585
boost::multi_array< float, 2 > SR650_ALL_L
Definition: DbLutNetcdf.h:98
this program makes no use of any feature of the SDP Toolkit that could generate such a then geolocation is calculated at that and then aggregated up to Resolved feature request Bug by adding three new int8 SDSs for each high resolution offsets between the high resolution geolocation and a bi linear interpolation extrapolation of the positions This can be used to reconstruct the high resolution geolocation Resolved Bug by delaying cumulation of gflags until after validation of derived products Resolved Bug by setting Latitude and Longitude to the correct fill resolving to support Near Real Time because they may be unnecessary if use of entrained ephemeris and attitude data is turned resolving bug report Corrected to filter out Aqua attitude records with missing status helping resolve bug MOD_PR03 will still correctly write scan and pixel data that does not depend upon the start time
Definition: HISTORY.txt:248
boost::multi_array< float, 2 > SR470_FWD_L
Definition: DbLutNetcdf.h:97
NcDim dim_nvza_
Definition: DbLutNetcdf.h:564
boost::multi_array< float, 4 > SC412_FWD_L
Definition: DbLutNetcdf.h:219
NcDim dim_7200_
Definition: DbLutNetcdf.h:580
NcDim dim_20800_
Definition: DbLutNetcdf.h:551
NcDim dim_nws_
Definition: DbLutNetcdf.h:591
string time_coverage_end_
Definition: DbLutNetcdf.h:427
boost::multi_array< float, 4 > SC412_ALL_L
Definition: DbLutNetcdf.h:218
boost::multi_array< float, 3 > fine_asy
Definition: DbLutNetcdf.h:308
boost::multi_array< float, 7 > m03
Definition: DbLutNetcdf.h:285
NcDim dim_nssa_
Definition: DbLutNetcdf.h:567
string institution_
Definition: DbLutNetcdf.h:408
#define NDET
Definition: polcor.c:13
string source_files_
Definition: DbLutNetcdf.h:425
NcDim dim_2160_
Definition: DbLutNetcdf.h:561
boost::multi_array< float, 3 > coarse_ssa
Definition: DbLutNetcdf.h:306
boost::multi_array< float, 6 > m08
Definition: DbLutNetcdf.h:289
boost::multi_array< float, 3 > fine_aot
Definition: DbLutNetcdf.h:302
string stdname_vocabulary_
Definition: DbLutNetcdf.h:413
boost::multi_array< float, 3 > aot
Definition: DbLutNetcdf.h:301
@ NBANDS
Definition: make_L3_v1.1.c:53
string project_
Definition: DbLutNetcdf.h:417
#define byte
Definition: input_s.h:5
void setHistory(std::string history)
Definition: DbLutNetcdf.h:482
NcDim dim_nraa_
Definition: DbLutNetcdf.h:565
string creator_url_
Definition: DbLutNetcdf.h:416
static void byteSwap(T &aValue)
Definition: DbLutNetcdf.h:614
NcDim dim_1800_
Definition: DbLutNetcdf.h:578
NcDim dim_ssa412_
Definition: DbLutNetcdf.h:569
boost::multi_array< float, 2 > SR670_ALL_L
Definition: DbLutNetcdf.h:204
string license_
Definition: DbLutNetcdf.h:409
boost::multi_array< float, 3 > fine_ssa
Definition: DbLutNetcdf.h:305
boost::multi_array< float, 4 > SC470_ALL_L
Definition: DbLutNetcdf.h:220
NcDim dim_3000_
Definition: DbLutNetcdf.h:576
string sensor_
Definition: DbLutNetcdf.h:405
boost::multi_array< float, 2 > SR412_ALL_L
Definition: DbLutNetcdf.h:94
NcDim dim_nz_
Definition: DbLutNetcdf.h:596
boost::multi_array< float, 6 > m11
Definition: DbLutNetcdf.h:291
boost::multi_array< float, 2 > ae
Definition: DbLutNetcdf.h:300