-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathbag_c_types.h
More file actions
218 lines (191 loc) · 6.91 KB
/
Copy pathbag_c_types.h
File metadata and controls
218 lines (191 loc) · 6.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#ifndef BAG_C_TYPES_H
#define BAG_C_TYPES_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
//! The bag error.
typedef uint32_t BagError;
//! The types of layers.
enum BAG_LAYER_TYPE
{
Elevation = 0, //!< The mandatory elevation layer.
Uncertainty = 1, //!< The mandatory uncertainty layer.
Hypothesis_Strength = 2, //!< The optional hypothesis strength layer.
Num_Hypotheses = 3, //!< The optional number of hypothesis layer.
Shoal_Elevation = 4, //!< The optional shoal elevation layer.
Std_Dev = 5, //!< The optional standard deviation layer.
Num_Soundings = 6, //!< The optional number of soundings layer.
Average_Elevation = 7, //!< The optional average elevation layer.
Nominal_Elevation = 8, //!< The optional nominal elevation layer.
Surface_Correction = 9, //!< The optional surface correction layer.
Georef_Metadata = 10, //!< The optional georeferenced metadata layer (there can be many; the name must be unique).
VarRes_Metadata = 11, //!< The optional variable resolution metadata layer.
VarRes_Refinement = 12, //!< The optional variable resolution refinement layer.
VarRes_Node = 13, //!< The optional variable resolution node layer.
UNKNOWN_LAYER_TYPE,
};
//! Definitions for file open access modes
enum BAG_OPEN_MODE
{
BAG_OPEN_READONLY = 1, //!< Open the BAG read only. It cannot be written to.
BAG_OPEN_READ_WRITE = 2, //!< Open the BAG for reading and writing.
};
//! The types of data known to BAG.
enum BAG_DATA_TYPE
{
DT_FLOAT32 = 0, //!< A 32 bit floating point value.
DT_UINT32, //!< A 32 bit unsigned integer.
DT_UINT8, //!< An 8 bit unsigned integer.
DT_UINT16, //!< A 16 bit unsigned integer.
DT_UINT64, //!< A 64 bit unsigned integer.
DT_BOOLEAN, //!< A boolean value.
DT_STRING, //!< A string value.
DT_COMPOUND, //!< A compound type of one or more of the above.
DT_UNKNOWN_DATA_TYPE,
};
#define NOAA_OCS_2022_10_METADATA_PROFILE_NAME "NOAA-OCS-2022.10"
#define UNKOWN_METADATA_PROFILE_NAME "Unknown metadata profile"
enum GEOREF_METADATA_PROFILE {
UNKNOWN_METADATA_PROFILE = 0,
NOAA_OCS_2022_10_METADATA_PROFILE
};
//! The type of interleaved group.
enum BAG_GROUP_TYPE
{
NODE = 0, //!< The NODE group type.
ELEVATION, //!< The ELEVATION group type.
UNKNOWN_GROUP_TYPE, //!< Unknown group type.
};
//! An item in the Tracking List.
struct BagTrackingItem
{
//! The row of the node of the BAG that was modified.
uint32_t row;
//! The column of the node of the BAG that was modified.
uint32_t col;
//! The original depth before this change.
float depth;
//! The original uncertainty before this change.
float uncertainty;
//! The reason code indicating why the modification was made.
uint8_t track_code;
//! The index number indicating the item in the metadata that describes the modifications.
uint16_t list_series;
};
//! An item in the variable resolution tracking list.
struct BagVRTrackingItem
{
//! The row of the node of the BAG that was modified.
uint32_t row;
//! The column of the node of the BAG that was modified.
uint32_t col;
//! The row within the refined grid that was modified.
uint32_t sub_row;
//! The column within the refined grid that was modified.
uint32_t sub_col;
//! The original depth before this change.
float depth;
//! The original uncertainty before this change.
float uncertainty;
//! The reason code indicating why the modification was made.
uint8_t track_code;
//! The index number indicating the item in the metadata that describes the modifications.
uint16_t list_series;
};
//! An item in the variable resolution metadata layer.
struct BagVRMetadataItem
{
//! The index.
uint32_t index;
//! Number of nodes in easting
uint32_t dimensions_x;
//! Number of nodes in northing
uint32_t dimensions_y;
//! Node spacing in easting
float resolution_x;
//! Node spacing in northing
float resolution_y;
//! Offset east from SW corner of surrounding low-res cell to SW-most node
float sw_corner_x;
//! Offset north from SW corner of surrounding low-res cell to SW-most node
float sw_corner_y;
};
//! An item in the variable resolution refinements layer.
struct BagVRRefinementsItem
{
//! The depth.
float depth;
//! The uncertainty.
float depth_uncrt;
};
//! An item in the variable resolution node layer.
struct BagVRNodeItem
{
//! Hypotheses strength.
float hyp_strength;
//! Number of hypotheses.
uint32_t num_hypotheses;
//! Number of samples.
uint32_t n_samples;
};
//! The surface topography.
enum BAG_SURFACE_CORRECTION_TOPOGRAPHY {
BAG_SURFACE_UNKNOWN = 0, //!< Unknown
BAG_SURFACE_GRID_EXTENTS, //!< Optional corrector dataset grid coordinates, spanning the required BAG surface extents
BAG_SURFACE_IRREGULARLY_SPACED, //!< Irregularly spaced corrector values in optional corrector dataset
};
#define BAG_SURFACE_CORRECTOR_LIMIT 10 // The maximum number of datum correctors per BagVerticalDatumCorrections
//! An item in a surface corrections layer when the type is BAG_SURFACE_IRREGULARLY_SPACED.
struct BagVerticalDatumCorrections
{
//! The X correction.
double x;
//! The Y correction.
double y;
//! The correctors.
float z[BAG_SURFACE_CORRECTOR_LIMIT];
};
//! An item in a surface corrections layer when the type is BAG_SURFACE_GRID_EXTENTS.
struct BagVerticalDatumCorrectionsGridded
{
//! The correctors.
float z[BAG_SURFACE_CORRECTOR_LIMIT];
};
//! The attributes of a correction surface. Only used in the C interface.
struct BagVerticalCorrectorDef
{
double nodeSpacingX; //! node spacing in x dimension in units defined by coord system
double nodeSpacingY; //! node spacing in y dimension in units defined by coord system
double swCornerX; //! X coordinate of SW corner of vertical corrector surface in BAG_COORDINATES
double swCornerY; //! Y coordinate of SW corner of vertical corrector surface in BAG_COORDINATES
};
//! A structure to hold the definition of a value.
//! ***NOTE: This must be POD per the C++11 definition.
//! see: https://stackoverflow.com/questions/4178175/what-are-aggregates-and-pods-and-how-why-are-they-special/7189821#7189821
struct FieldDefinition
{
//! The name of the definition.
const char* name;
//! The type of the definition; represents a DataType.
uint8_t type;
};
//! The C version of the BAG::CompoundDataType class
typedef union {
float f;
uint32_t ui32;
bool b;
char* c;
} BAG_COMPOUND_DATA_PAYLOAD;
struct BagCompoundDataType
{
BAG_DATA_TYPE type;
BAG_COMPOUND_DATA_PAYLOAD data;
};
#define BAG_NULL_ELEVATION 1000000 // A "null" elevation value.
#define BAG_NULL_GENERIC 1000000 // A "null" generic value.
#define BAG_NULL_UNCERTAINTY 1000000 // A "null" uncertainty value.
#ifdef __cplusplus
} // extern "C"
#endif
#endif //BAG_C_TYPES_H