bufr2synop 0.24.0
Functions
bufr2tac_x10.c File Reference

decodes the descriptors with X = 10 (air pressure) More...

#include "bufr2tac.h"
Include dependency graph for bufr2tac_x10.c:

Go to the source code of this file.

Functions

char * pascal_to_ppp (char *target, double P)
 Converts pascal values (variation) into a ppp string. More...
 
char * pascal_to_pnpnpn (char *target, double P)
 
char * pascal_to_PPPP (char *target, double P)
 Converts pascal values into a PPPP string. More...
 
int syn_parse_x10 (struct synop_chunks *syn, struct bufr2tac_subset_state *s)
 Parse a expanded descriptor with X = 10. More...
 
int buoy_parse_x10 (struct buoy_chunks *b, struct bufr2tac_subset_state *s)
 Parse a expanded descriptor with X = 10. More...
 
int climat_parse_x10 (struct climat_chunks *c, struct bufr2tac_subset_state *s)
 Parse a expanded descriptor with X = 10. More...
 
int temp_parse_x10 (struct temp_chunks *t, struct bufr2tac_subset_state *s)
 Parse a expanded descriptor with X = 10. More...
 

Detailed Description

decodes the descriptors with X = 10 (air pressure)

Definition in file bufr2tac_x10.c.

Function Documentation

◆ buoy_parse_x10()

int buoy_parse_x10 ( struct buoy_chunks b,
struct bufr2tac_subset_state s 
)

Parse a expanded descriptor with X = 10.

Parameters
bpointer to a struct buoy_chunks where to set the results
spointer to a struct bufr2tac_subset_state where is stored needed information in sequential analysis

It returns 0 if success, 1 if problems when processing. If a descriptor is not processed returns 0 anyway

Definition at line 161 of file bufr2tac_x10.c.

162{
163 char aux[16];
164
165 if ( s->a->mask & DESCRIPTOR_VALUE_MISSING )
166 {
167 return 0;
168 }
169
170 switch ( s->a->desc.y )
171 {
172
173 case 4: // 0 10 004 . Pressure
174 pascal_to_PPPP ( aux, s->val );
175 strcpy ( b->s1.PoPoPoPo, aux );
176 b->mask |= BUOY_SEC1;
177 break;
178
179 case 51: // 0 10 051 . Pressure reduced to mean sea level
180 pascal_to_PPPP ( aux, s->val );
181 strcpy ( b->s1.PPPP, aux );
182 b->mask |= BUOY_SEC1;
183 break;
184
185 case 63: // 0 10 063 . Characteristic of pressure tendency
186 sprintf ( b->s1.a, "%1d",s->ival );
187 b->mask |= BUOY_SEC1;
188 break;
189
190 case 61: // 0 10 061 . 3-hour pressure change
191 pascal_to_ppp ( aux, s->val );
192 memcpy( b->s1.ppp, aux, 3 );
193 b->s1.ppp[3] = 0;
194 b->mask |= BUOY_SEC1;
195 break;
196
197 default:
198 if ( BUFR2TAC_DEBUG_LEVEL > 1 && (s->a->mask & DESCRIPTOR_VALUE_MISSING) == 0 )
199 bufr2tac_set_error ( s, 0, "buoy_parse_x10()", "Descriptor not parsed" );
200 break;
201 }
202 return 0;
203}
int BUFR2TAC_DEBUG_LEVEL
Definition: bufr2tac.c:31
int bufr2tac_set_error(struct bufr2tac_subset_state *s, int severity, char *origin, char *explanation)
char * pascal_to_ppp(char *target, double P)
Converts pascal values (variation) into a ppp string.
Definition: bufr2tac_x10.c:32
char * pascal_to_PPPP(char *target, double P)
Converts pascal values into a PPPP string.
Definition: bufr2tac_x10.c:69
#define DESCRIPTOR_VALUE_MISSING
Bit mask for a missing value in a struct bufr_atom_data.
Definition: bufrdeco.h:140
#define BUOY_SEC1
mask bit meaning section 1 of buoy is solicited to or parsed with success
Definition: metbuoy.h:38
struct bufr_atom_data * a
Definition: bufr2tac.h:249
uint32_t mask
Definition: bufrdeco.h:437
struct bufr_descriptor desc
Definition: bufrdeco.h:436
int mask
Definition: metbuoy.h:198
struct buoy_sec1 s1
Definition: metbuoy.h:202
char a[2]
Definition: metbuoy.h:103
char PoPoPoPo[6]
Definition: metbuoy.h:101
char ppp[4]
Definition: metbuoy.h:104
char PPPP[6]
Definition: metbuoy.h:102

References bufr2tac_subset_state::a, buoy_sec1::a, BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), BUOY_SEC1, bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, bufr2tac_subset_state::ival, bufr_atom_data::mask, buoy_chunks::mask, pascal_to_ppp(), pascal_to_PPPP(), buoy_sec1::PoPoPoPo, buoy_sec1::ppp, buoy_sec1::PPPP, buoy_chunks::s1, bufr2tac_subset_state::val, and bufr_descriptor::y.

Referenced by parse_subset_as_buoy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ climat_parse_x10()

int climat_parse_x10 ( struct climat_chunks c,
struct bufr2tac_subset_state s 
)

Parse a expanded descriptor with X = 10.

Parameters
cpointer to a struct climat_chunks where to set the results
spointer to a struct bufr2tac_subset_state where is stored needed information in sequential analysis

It returns 0 if success, 1 if problems when processing. If a descriptor is not processed returns 0 anyway

Definition at line 214 of file bufr2tac_x10.c.

215{
216 char aux[16];
217
218 if ( c == NULL || s == NULL )
219 {
220 return 1;
221 }
222
223 if ( s->a->mask & DESCRIPTOR_VALUE_MISSING )
224 {
225 return 0;
226 }
227
228 switch ( s->a->desc.y )
229 {
230 case 4: // 0 10 004 . Pressure
231 if ( s->isq_val == 4 )
232 {
233 pascal_to_PPPP ( aux, s->val );
234 if ( s->is_normal == 0 )
235 {
236 strcpy ( c->s1.PoPoPoPo, aux );
237 c->mask |= CLIMAT_SEC1;
238 }
239 else
240 {
241 strcpy ( c->s2.PoPoPoPo, aux );
242 c->mask |= CLIMAT_SEC2;
243 }
244 }
245 break;
246
247 case 9: // 0 10 009 . Heigh of geopotential
248 if ( s->isq_val == 4 )
249 {
250 if ( s->is_normal == 0 )
251 {
252 sprintf ( c->s1.PPPP, "%04d", s->ival );
253 c->mask |= CLIMAT_SEC1;
254 }
255 else
256 {
257 sprintf ( c->s1.PPPP, "%04d", s->ival );
258 c->mask |= CLIMAT_SEC2;
259 }
260 }
261 break;
262
263 case 51: // 0 10 051 . Pressure reduced to mean sea level
264 if ( s->isq_val == 4 )
265 {
266 pascal_to_PPPP ( aux, s->val );
267 if ( s->is_normal == 0 )
268 {
269 strcpy ( c->s1.PPPP, aux );
270 c->mask |= CLIMAT_SEC1;
271 }
272 else
273 {
274 strcpy ( c->s2.PPPP, aux );
275 c->mask |= CLIMAT_SEC2;
276 }
277 }
278 break;
279
280 default:
281 if ( BUFR2TAC_DEBUG_LEVEL > 1 && (s->a->mask & DESCRIPTOR_VALUE_MISSING) == 0 )
282 bufr2tac_set_error ( s, 0, "climat_parse_x10()", "Descriptor not parsed" );
283 break;
284
285 }
286 return 0;
287}
#define CLIMAT_SEC2
mask bit meaning section 2 of climat is solicited to or parsed with success
Definition: metclimat.h:42
#define CLIMAT_SEC1
mask bit meaning section 1 of climat is solicited to or parsed with success
Definition: metclimat.h:37
struct climat_sec1 s1
Definition: metclimat.h:218
struct climat_sec2 s2
Definition: metclimat.h:219
char PoPoPoPo[8]
Definition: metclimat.h:82
char PPPP[8]
Definition: metclimat.h:83
char PPPP[8]
Definition: metclimat.h:114
char PoPoPoPo[8]
Definition: metclimat.h:113

References bufr2tac_subset_state::a, BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), CLIMAT_SEC1, CLIMAT_SEC2, bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, bufr2tac_subset_state::is_normal, bufr2tac_subset_state::isq_val, bufr2tac_subset_state::ival, bufr_atom_data::mask, climat_chunks::mask, pascal_to_PPPP(), climat_sec1::PoPoPoPo, climat_sec2::PoPoPoPo, climat_sec1::PPPP, climat_sec2::PPPP, climat_chunks::s1, climat_chunks::s2, bufr2tac_subset_state::val, and bufr_descriptor::y.

Referenced by parse_subset_as_climat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pascal_to_pnpnpn()

char * pascal_to_pnpnpn ( char *  target,
double  P 
)

Definition at line 47 of file bufr2tac_x10.c.

48{
49 int ic;
50 if ( P > 10000.0 )
51 {
52 ic = ( int ) ( P * 0.01 + 0.5 );
53 }
54 else
55 {
56 ic = ( int ) ( P * 0.1 + 0.5 );
57 }
58 sprintf ( target, "%03d", ic % 1000 );
59 return target;
60}

Referenced by parse_temp_raw_data().

Here is the caller graph for this function:

◆ pascal_to_ppp()

char * pascal_to_ppp ( char *  target,
double  P 
)

Converts pascal values (variation) into a ppp string.

Parameters
Pthe pressure variation in Pascal units
targetstring with the result

Definition at line 32 of file bufr2tac_x10.c.

33{
34 int ic;
35 if ( P > 0 )
36 {
37 ic = ( int ) ( P * 0.1 );
38 }
39 else
40 {
41 ic = ( int ) ( -P * 0.1 );
42 }
43 sprintf ( target, "%03d", ic % 1000 );
44 return target;
45}

Referenced by buoy_parse_x10(), and syn_parse_x10().

Here is the caller graph for this function:

◆ pascal_to_PPPP()

char * pascal_to_PPPP ( char *  target,
double  P 
)

Converts pascal values into a PPPP string.

Parameters
Pthe pressure variation in Pascal units
targetstring with the result

Definition at line 69 of file bufr2tac_x10.c.

70{
71 int ic;
72 ic = ( int ) ( P * 0.1 );
73 sprintf ( target, "%04d", ic % 10000 );
74 return target;
75}

Referenced by buoy_parse_x10(), climat_parse_x10(), and syn_parse_x10().

Here is the caller graph for this function:

◆ syn_parse_x10()

int syn_parse_x10 ( struct synop_chunks syn,
struct bufr2tac_subset_state s 
)

Parse a expanded descriptor with X = 10.

Parameters
synpointer to a s if ( BUFR2TAC_DEBUG_LEVEL > 0 ) bufr2tac_set_error ( s, 0, "syn_parse_x08()", "Descriptor not parsed" ); truct synop_chunks where to set the results
spointer to a struct bufr2tac_subset_state where is stored needed information in sequential analysis

It returns 0 if success, 1 if problems when processing. If a descriptor is not processed returns 0 anyway

Definition at line 87 of file bufr2tac_x10.c.

88{
89 char aux[16];
90
92 {
93 return 0;
94 }
95
96 switch ( s->a->desc.y )
97 {
98 case 4: // 0 10 004 . Pressure
99 pascal_to_PPPP ( aux, s->val );
100 strcpy ( syn->s1.PoPoPoPo, aux );
101 syn->mask |= SYNOP_SEC1;
102 break;
103
104 case 9: // 0 10 009. Geopotential at standard level
105 sprintf ( syn->s1.hhh, "%03d", abs(s->ival) % 1000 );
106 syn->mask |= SYNOP_SEC1;
107 break;
108
109 case 51: // 0 10 051 . Pressure reduced to mean sea level
110 pascal_to_PPPP ( aux, s->val );
111 memcpy ( syn->s1.PPPP, aux, 4 );
112 syn->s1.PPPP[4] = 0;
113 syn->mask |= SYNOP_SEC1;
114 break;
115
116 case 61: // 0 10 061 . 3-hour pressure change
117 pascal_to_ppp ( aux, s->val );
118 memcpy(syn->s1.ppp, aux, 3);
119 syn->s1.ppp[3] = 0;
120 syn->mask |= SYNOP_SEC1;
121 break;
122
123 case 62: // 0 10 062 . 24-hour pressure change
124 pascal_to_ppp ( aux, s->val );
125 memcpy ( syn->s3.ppp24, aux, 3 );
126 syn->s3.ppp24[3] = 0;
127 if ( s->val >= 0 )
128 {
129 strcpy ( syn->s3.snp24, "8" );
130 }
131 else
132 {
133 strcpy ( syn->s3.snp24, "9" );
134 }
135 syn->mask |= SYNOP_SEC3;
136 break;
137
138 case 63: // 0 10 063 . Characteristic of pressure tendency
139 if ( s->ival > 9 || s->ival < 0)
140 return 1;
141 sprintf ( syn->s1.a, "%1d",s->ival );
142 syn->mask |= SYNOP_SEC1;
143 break;
144
145 default:
146 if ( BUFR2TAC_DEBUG_LEVEL > 1 && (s->a->mask & DESCRIPTOR_VALUE_MISSING) == 0 )
147 bufr2tac_set_error ( s, 0, "syn_parse_x10()", "Descriptor not parsed" );
148 break;
149 }
150 return 0;
151}
#define SYNOP_SEC1
mask bit meaning section 1 or synop is solicited to or parsed with success
Definition: metsynop.h:39
#define SYNOP_SEC3
mask bit meaning section 3 or synop is solicited to or parsed with success
Definition: metsynop.h:49
struct synop_sec1 s1
Definition: metsynop.h:298
struct synop_sec3 s3
Definition: metsynop.h:300
char PoPoPoPo[6]
Definition: metsynop.h:136
char hhh[4]
Definition: metsynop.h:139
char PPPP[6]
Definition: metsynop.h:137
char a[2]
Definition: metsynop.h:140
char ppp[4]
Definition: metsynop.h:141
char snp24[2]
Definition: metsynop.h:253
char ppp24[4]
Definition: metsynop.h:254

References bufr2tac_subset_state::a, synop_sec1::a, BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, synop_sec1::hhh, bufr2tac_subset_state::ival, bufr_atom_data::mask, synop_chunks::mask, pascal_to_ppp(), pascal_to_PPPP(), synop_sec1::PoPoPoPo, synop_sec1::ppp, synop_sec3::ppp24, synop_sec1::PPPP, synop_chunks::s1, synop_chunks::s3, synop_sec3::snp24, SYNOP_SEC1, SYNOP_SEC3, bufr2tac_subset_state::val, and bufr_descriptor::y.

Referenced by parse_subset_as_synop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_parse_x10()

int temp_parse_x10 ( struct temp_chunks t,
struct bufr2tac_subset_state s 
)

Parse a expanded descriptor with X = 10.

Parameters
tpointer to a struct temp_chunks where to set the results
spointer to a struct bufr2tac_subset_state where is stored needed information in sequential analysis

It returns 0 if success, 1 if problems when processing. If a descriptor is not processed returns 0 anyway

Definition at line 297 of file bufr2tac_x10.c.

298{
299 if ( t == NULL || s == NULL )
300 {
301 return 1;
302 }
303
304 if ( s->a->mask & DESCRIPTOR_VALUE_MISSING )
305 {
306 return 0;
307 }
308
309 switch ( s->a->desc.y )
310 {
311 case 9: // 0 10 009. geopotential
312 if ( s->rep > 0 && s->r->n > 0 )
313 {
314 s->r->raw[s->r->n - 1].h = s->val;
315 }
316 break;
317
318 default:
319 if ( BUFR2TAC_DEBUG_LEVEL > 1 && (s->a->mask & DESCRIPTOR_VALUE_MISSING) == 0 )
320 bufr2tac_set_error ( s, 0, "temp_parse_x10()", "Descriptor not parsed" );
321 break;
322 }
323 return 0;
324}
struct temp_raw_data * r
Definition: bufr2tac.h:285
struct temp_raw_point_data raw[TEMP_NMAX_POINTS *4]
Definition: mettemp.h:215
size_t n
Definition: mettemp.h:214

References bufr2tac_subset_state::a, BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, temp_raw_point_data::h, bufr_atom_data::mask, temp_raw_data::n, bufr2tac_subset_state::r, temp_raw_data::raw, bufr2tac_subset_state::rep, bufr2tac_subset_state::val, and bufr_descriptor::y.

Referenced by parse_subset_as_temp().

Here is the call graph for this function:
Here is the caller graph for this function: