OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
bin_util.h
Go to the documentation of this file.
1 #ifndef bin_util_h
2 #define bin_util_h
3 
4 #pragma GCC diagnostic ignored "-Wpadded"
5 #ifndef PI
6 #define PI 3.141592653589793
7 #endif
8 
9 #include <sstream>
10 #include <stdio.h>
11 #include <time.h>
12 #include <string.h>
13 #include <math.h>
14 #include <iostream>
15 #include <sstream>
16 
17 #include "hdf5.h"
18 #include "L3Shape.h"
19 
20 #define MAXNPROD 256
21 #define MAXNVDATA MAXNPROD+3
22 
23 #define SWAP_4(x) ( ((x) << 24) | \
24  (((x) << 8) & 0x00ff0000) | \
25  (((x) >> 8) & 0x0000ff00) | \
26  ((x) >> 24) )
27 
28 namespace Hdf {
29 
31  int32_t row_num; // 0-based
32  double vsize;
33  double hsize;
34  int32_t basebin;
35  int32_t beg;
36  int32_t ext;
37  int32_t numbin;
38 };
39 
41  int32_t basebin;
42  int32_t beg;
43  int32_t ext;
44  int32_t numbin;
45 };
46 
48  int64_t basebin;
49  int64_t beg;
50  int32_t ext;
51  int64_t numbin;
52 };
53 
54 struct binListStruct {
55  int32_t bin_num;
56  int16_t nobs;
57  int16_t nscenes;
58  int16_t time_rec;
59  float weights;
60  uint8_t sel_cat;
61  int32_t flags_set;
62  float lat;
63  float lon;
64 };
65 
67  int32_t bin_num;
68  short nobs;
69  short nscenes;
70  float weights;
71  int64_t flags_set;
72 };
73 
75  uint32_t bin_num;
76  short nobs;
77  short nscenes;
78  float weights;
79  float time_rec;
80 };
81 
83  uint64_t bin_num;
84  short nobs;
85  short nscenes;
86  float weights;
87  float time_rec;
88 };
89 
90 int create_vdata(int32_t file_id, int32_t vg_id, int32_t *vdata_id,
91  const char *vdata_name, const char *class_name,
92  int32_t n_flds, char const * const fldname[], int32_t type[],
93  int32_t noext, int32_t *aid);
94 
95 int32_t write_vdata(int vdata_id, int32_t n_recs_to_write, void *data);
96 
97 int read_binList(int n_elem, int32_t vdata_id_binlist, binListStruct* binList, l3::L3Shape *shape);
98 
99 int write_binList(int n_elem, int32_t vdata_id_binlist, binListStruct* binList);
100 
101 int write_prodData(int n_elem, int32_t vdata_id_proddata, float *data,
102  binListStruct* binList);
103 int copy_prodData(int n_elem, int32_t *binsToCopy,
104  char const * const fldname3[],
105  int32_t in_vdata_id_proddata,
106  int32_t out_vdata_id_proddata);
107 int create_compound(hid_t group_id, const char *dataset_name, hid_t *dataset_id,
108  hid_t *type_id, size_t typesize, int32_t n_flds,
109  char const * const fldname[], size_t offset[], hid_t type[],
110  hid_t *filespace, hid_t dataspace);
111 }
112 
113 #endif
Definition: bin_io.cpp:23
int32_t bin_num
Definition: bin_util.h:55
int16_t time_rec
Definition: bin_util.h:58
int create_compound(hid_t group_id, const char *dataset_name, hid_t *dataset_id, hid_t *type_id, size_t typesize, int32_t n_flds, char const *const fldname[], size_t offset[], hid_t type[], hid_t *filespace, hid_t dataspace)
Definition: bin_util.cpp:262
int write_prodData(int n_elem, int32_t vdata_id_proddata, float *data, binListStruct *binList)
Definition: bin_util.cpp:202
int write_binList(int n_elem, int32_t vdata_id_binlist, binListStruct *binList)
Definition: bin_util.cpp:163
uint8_t sel_cat
Definition: bin_util.h:60
int create_vdata(int32_t fileid, int32_t vgid, int32_t *vdata_id, const char *vdata_name, const char *class_name, int32_t n_flds, char const *const fldname[], int32_t type[], int32_t noext, int32_t *aid)
Definition: bin_util.cpp:10
int16_t nscenes
Definition: bin_util.h:57
int32_t write_vdata(int vdata_id, int32_t n_recs_to_write, void *data)
Definition: bin_util.cpp:105
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude data
Definition: HISTORY.txt:356
int read_binList(int n_elem, int32_t vdata_id_binlist, binListStruct *binList, l3::L3Shape *shape)
Definition: bin_util.cpp:118
l2prod offset
int32_t flags_set
Definition: bin_util.h:61
int copy_prodData(int n_elem, int32_t *binsToCopy, char const *const fldname3[], int32_t in_vdata_id_proddata, int32_t out_vdata_id_proddata)
Definition: bin_util.cpp:229