bufr2synop 0.24.0
Functions
bufr2tac_x01.c File Reference

decodes the descriptors with X = 01 (station index, name and country) More...

#include "bufr2tac.h"
#include <ctype.h>
Include dependency graph for bufr2tac_x01.c:

Go to the source code of this file.

Functions

int check_wigos_local_id (char *local_id)
 
int syn_parse_x01 (struct synop_chunks *syn, struct bufr2tac_subset_state *s)
 Parse a expanded descriptor with X = 01. More...
 
int buoy_parse_x01 (struct buoy_chunks *b, struct bufr2tac_subset_state *s)
 Parse a expanded descriptor with X = 01. More...
 
int climat_parse_x01 (struct climat_chunks *c, struct bufr2tac_subset_state *s)
 Parse a expanded descriptor with X = 01. More...
 
int temp_parse_x01 (struct temp_chunks *t, struct bufr2tac_subset_state *s)
 Parse a expanded descriptor with X = 01. More...
 

Detailed Description

decodes the descriptors with X = 01 (station index, name and country)

Definition in file bufr2tac_x01.c.

Function Documentation

◆ buoy_parse_x01()

int buoy_parse_x01 ( struct buoy_chunks b,
struct bufr2tac_subset_state s 
)

Parse a expanded descriptor with X = 01.

Parameters
bpointer to a struct 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 205 of file bufr2tac_x01.c.

206{
207 char aux[80];
208
209 if ( s->a->mask & DESCRIPTOR_VALUE_MISSING )
210 return 0;
211
212 switch ( s->a->desc.y )
213 {
214 case 3: // 0 01 003
215 if ( s->ival > 0 )
216 sprintf ( b->s0.A1, "%d", s->ival % 10 );
217 else if ( s->ival == 0 )
218 sprintf ( b->s0.A1, "7" );
219 break;
220
221 case 4: // 0 01 004
222 case 20: // 0 01 004
223 sprintf ( b->s0.bw, "%d", s->ival );
224 break;
225
226 case 5: // 0 01 005
227 if ( s->ival < 1000 )
228 sprintf ( b->s0.nbnbnb, "%03d", s->ival % 1000 );
229 else
230 sprintf ( b->s0.nbnbnb, "%05d", s->ival % 100000 ); // note this is a nnnnn extension
231 break;
232
233 case 15: // 0 01 015. Station or site name
234 if ( strlen ( s->a->cval ) <= 80 )
235 {
236 strcpy ( aux, s->a->cval );
237 adjust_string ( aux );
238 strcpy ( s->name, aux );
240 }
241 else if ( BUFR2TAC_DEBUG_LEVEL > 0 )
242 {
243 bufr2tac_set_error ( s, 1, "buoy_parse_x01()", "Station or site name length > 80. Cannot set s->name" );
244 }
245 break;
246
247 case 87: // 0 01 087. WMO marine observing platform extended identifier
248 // See https://community.wmo.int/rules-allocating-wmo-numbers
249 // A1bwnnn is equivalent to A1Bwnnnnn when nnnnn < 1000
250 if ( s->a->val < 100000000 )
251 {
252 sprintf ( aux, "%07.0lf", s->a->val );
253 b->s0.A1[0] = aux[0];
254 b->s0.A1[1] = 0;
255 b->s0.bw[0] = aux[1];
256 b->s0.bw[1] = 0;
257 if ( ( ( int ) ( s->a->val ) % 100000 ) < 1000 )
258 strcpy ( b->s0.nbnbnb, & aux[4] );
259 else
260 strcpy ( b->s0.nbnbnb, & aux[2] );
261 }
262 else if ( BUFR2TAC_DEBUG_LEVEL > 0 )
263 {
264 bufr2tac_set_error ( s, 1, "buoy_parse_x01()",
265 "WMO marine observing platform extended identifier >= 100000000. Cannot set s0.A1, s0.bw, s0.nbnbnb" );
266 }
267 break;
268
269 case 101: // 0 01 101 . State identifier
270 if ( strlen ( s->a->ctable ) <= 256 )
271 {
272 strcpy ( aux, s->a->ctable );
273 adjust_string ( aux );
274 strcpy ( s->country, aux );
276 }
277 else if ( BUFR2TAC_DEBUG_LEVEL > 0 )
278 {
279 bufr2tac_set_error ( s, 1, "buoy_parse_x01()", "State identifier length > 256. Cannot set s->country" );
280 }
281 break;
282
283 case 125: // 0 01 125 . WIGOS identifier series
284 b->wid.series = ( uint8_t ) s->ival;
285 break;
286
287 case 126: // 0 01 126 . WIGOS issuer of identifier
288 b->wid.issuer = ( uint16_t ) s->ival;
289 break;
290
291 case 127: // 0 01 127 , WIGOS issue number
292 b->wid.issue = ( uint16_t ) s->ival;
293 break;
294
295 case 128: // 0 01 128 . WIGOS local identifier (character)
296 if ( strlen ( s->a->cval ) <= 16 )
297 {
298 adjust_string ( s->a->cval );
299 if ( check_wigos_local_id ( s->a->cval ) )
300 {
301 bufr2tac_set_error ( s, 1, "buoy_parse_x01()","Bad WIGOS Local identifier" );
302 }
303 strcpy ( b->wid.local_id, s->a->cval );
305 }
306 break;
307
308 default:
309 if ( BUFR2TAC_DEBUG_LEVEL > 1 && ( s->a->mask & DESCRIPTOR_VALUE_MISSING ) == 0 )
310 bufr2tac_set_error ( s, 0, "buoy_parse_x01()", "Descriptor not parsed" );
311 break;
312 }
313 return 0;
314}
int BUFR2TAC_DEBUG_LEVEL
Definition: bufr2tac.c:31
#define SUBSET_MASK_HAVE_COUNTRY
Bit mask to mark a struct bufr_subset_sequence_data having country name.
Definition: bufr2tac.h:134
int bufr2tac_set_error(struct bufr2tac_subset_state *s, int severity, char *origin, char *explanation)
#define SUBSET_MASK_HAVE_NAME
Bit mask to mark a struct bufr_subset_sequence_data having station name.
Definition: bufr2tac.h:128
#define SUBSET_MASK_HAVE_WIGOS_ID
Bit mask to mark if a subset has a WIGOS ID.
Definition: bufr2tac.h:188
char * adjust_string(char *s)
Supress trailing blanks of a string.
int check_wigos_local_id(char *local_id)
Definition: bufr2tac_x01.c:27
#define DESCRIPTOR_VALUE_MISSING
Bit mask for a missing value in a struct bufr_atom_data.
Definition: bufrdeco.h:140
struct bufr_atom_data * a
Definition: bufr2tac.h:249
uint32_t mask
Definition: bufrdeco.h:437
char ctable[BUFR_EXPLAINED_LENGTH]
Definition: bufrdeco.h:444
struct bufr_descriptor desc
Definition: bufrdeco.h:436
double val
Definition: bufrdeco.h:440
char cval[BUFR_CVAL_LENGTH]
Definition: bufrdeco.h:443
struct wigos_id wid
Definition: metbuoy.h:200
struct buoy_sec0 s0
Definition: metbuoy.h:201
char nbnbnb[8]
Definition: metbuoy.h:70
char A1[2]
Definition: metbuoy.h:68
char bw[2]
Definition: metbuoy.h:69
uint16_t issue
Definition: metcommon.h:49
uint16_t issuer
Definition: metcommon.h:48
uint8_t series
Definition: metcommon.h:47
char local_id[24]
Definition: metcommon.h:50

References bufr2tac_subset_state::a, buoy_sec0::A1, adjust_string(), BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), buoy_sec0::bw, check_wigos_local_id(), bufr2tac_subset_state::country, bufr_atom_data::ctable, bufr_atom_data::cval, bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, wigos_id::issue, wigos_id::issuer, bufr2tac_subset_state::ival, wigos_id::local_id, bufr_atom_data::mask, bufr2tac_subset_state::mask, bufr2tac_subset_state::name, buoy_sec0::nbnbnb, buoy_chunks::s0, wigos_id::series, SUBSET_MASK_HAVE_COUNTRY, SUBSET_MASK_HAVE_NAME, SUBSET_MASK_HAVE_WIGOS_ID, bufr_atom_data::val, buoy_chunks::wid, 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:

◆ check_wigos_local_id()

int check_wigos_local_id ( char *  local_id)

Definition at line 27 of file bufr2tac_x01.c.

28{
29 char *c = local_id;
30
31 // first char cannot be blank
32 if ( ! ( isalpha ( *c ) ) && ! ( isdigit ( *c ) ) )
33 return 1;
34 c++;
35
36 while ( *c )
37 {
38 if ( ! ( isalpha ( *c ) ) && ! ( isdigit ( *c ) ) && ! ( isblank ( *c ) ) )
39 return 1;
40 c++;
41 }
42
43 return 0;
44}

Referenced by buoy_parse_x01(), climat_parse_x01(), syn_parse_x01(), and temp_parse_x01().

Here is the caller graph for this function:

◆ climat_parse_x01()

int climat_parse_x01 ( struct climat_chunks c,
struct bufr2tac_subset_state s 
)

Parse a expanded descriptor with X = 01.

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 324 of file bufr2tac_x01.c.

325{
326 char aux[80];
327
328 if ( s->a->mask & DESCRIPTOR_VALUE_MISSING )
329 return 0;
330
331 switch ( s->a->desc.y )
332 {
333
334 case 1: // 0 01 001 . WMO block number
335 sprintf ( c->s0.II, "%02d", s->ival );
336 break;
337
338 case 2: // 0 01 002 . WMO station number
339 sprintf ( c->s0.iii, "%03d", s->ival );
340 break;
341
342 case 3: // 0 01 003 . WMO Region
343 if ( s->ival == 1 )
344 strcpy ( c->s0.Reg, "I" );
345 else if ( s->ival == 2 )
346 strcpy ( c->s0.Reg, "II" );
347 else if ( s->ival == 3 )
348 strcpy ( c->s0.Reg, "III" );
349 else if ( s->ival == 4 )
350 strcpy ( c->s0.Reg, "IV" );
351 else if ( s->ival == 5 )
352 strcpy ( c->s0.Reg, "V" );
353 else if ( s->ival == 6 )
354 strcpy ( c->s0.Reg, "VI" );
355 break;
356
357 case 15: // 0 01 015 . Station or site name
358 case 18: // 0 01 018 . Short station or site name
359 case 19: // 0 01 019 . Long station or site name
360 if ( strlen ( s->a->cval ) <= 80 )
361 {
362 strcpy ( aux, s->a->cval );
363 adjust_string ( aux );
364 strcpy ( s->name, aux );
366 }
367 else if ( BUFR2TAC_DEBUG_LEVEL > 0 )
368 {
369 bufr2tac_set_error ( s, 1, "climat_parse_x01()", "Station or site name length > 80. Cannot set s->name" );
370 }
371 break;
372
373 case 125: // 0 01 125 . WIGOS identifier series
374 c->wid.series = ( uint8_t ) s->ival;
375 break;
376
377 case 126: // 0 01 126 . WIGOS issuer of identifier
378 c->wid.issuer = ( uint16_t ) s->ival;
379 break;
380
381 case 127: // 0 01 127 , WIGOS issue number
382 c->wid.issue = ( uint16_t ) s->ival;
383 break;
384
385 case 128: // 0 01 128 . WIGOS local identifier (character)
386 if ( strlen ( s->a->cval ) <= 16 )
387 {
388 strcpy ( c->wid.local_id, s->a->cval );
389 if ( check_wigos_local_id ( s->a->cval ) )
390 {
391 bufr2tac_set_error ( s, 1, "climat_parse_x01()","Bad WIGOS Local identifier" );
392 }
394 }
395 break;
396
397
398
399 default:
400 if ( BUFR2TAC_DEBUG_LEVEL > 1 && ( s->a->mask & DESCRIPTOR_VALUE_MISSING ) == 0 )
401 bufr2tac_set_error ( s, 0, "climat_parse_x01()", "Descriptor not parsed" );
402 break;
403 }
404 return 0;
405}
struct climat_sec0 s0
Definition: metclimat.h:217
struct wigos_id wid
Definition: metclimat.h:216
char iii[4]
Definition: metclimat.h:73
char II[4]
Definition: metclimat.h:72
char Reg[4]
Definition: metclimat.h:74

References bufr2tac_subset_state::a, adjust_string(), BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), check_wigos_local_id(), bufr_atom_data::cval, bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, climat_sec0::II, climat_sec0::iii, wigos_id::issue, wigos_id::issuer, bufr2tac_subset_state::ival, wigos_id::local_id, bufr_atom_data::mask, bufr2tac_subset_state::mask, bufr2tac_subset_state::name, climat_sec0::Reg, climat_chunks::s0, wigos_id::series, SUBSET_MASK_HAVE_NAME, SUBSET_MASK_HAVE_WIGOS_ID, climat_chunks::wid, 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:

◆ syn_parse_x01()

int syn_parse_x01 ( struct synop_chunks syn,
struct bufr2tac_subset_state s 
)

Parse a expanded descriptor with X = 01.

Parameters
synpointer to a struct 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 54 of file bufr2tac_x01.c.

55{
56 char aux[80];
57
59 return 0;
60
61 switch ( s->a->desc.y )
62 {
63 case 1: // 0 01 001 . WMO block number
64 sprintf ( syn->s0.II, "%02d", s->ival );
65 break;
66
67 case 2: // 0 01 002 . WMO station number
68 sprintf ( syn->s0.iii, "%03d", s->ival );
69 break;
70
71 case 3: // 0 01 003 . WMO Region
72 sprintf ( syn->s0.A1, "%d", s->ival );
73 if ( strcmp ( syn->s0.A1, "1" ) == 0 )
74 strcpy ( syn->s0.Reg, "I" );
75 else if ( strcmp ( syn->s0.A1, "2" ) == 0 )
76 strcpy ( syn->s0.Reg, "II" );
77 else if ( strcmp ( syn->s0.A1, "3" ) == 0 )
78 strcpy ( syn->s0.Reg, "III" );
79 else if ( strcmp ( syn->s0.A1, "4" ) == 0 )
80 strcpy ( syn->s0.Reg, "IV" );
81 else if ( strcmp ( syn->s0.A1, "5" ) == 0 )
82 strcpy ( syn->s0.Reg, "V" );
83 else if ( strcmp ( syn->s0.A1, "6" ) == 0 )
84 strcpy ( syn->s0.Reg, "VI" );
85 break;
86
87 case 4: // 0 01 004 . WMO Subarea
88 case 20: // 0 01 020 . WMO region subarea
89 sprintf ( syn->s0.bw, "%d", s->ival );
90 break;
91
92 case 10: // 0 01 010. Stationary buoy platform identifier
93 if ( strlen ( s->a->cval ) < 16 )
94 {
95 strcpy ( aux, s->a->cval );
96 adjust_string ( aux );
97 if ( aux[0] == '\xff' )
98 break;
99 if ( strlen ( aux ) < 10 )
100 strcpy ( syn->s0.D_D, aux );
101 else
102 bufr2tac_set_error ( s, 1, "syn_parse_x01()", "Ship or mobile land station index length >= 10. Cannot set s0.D_D" );
103 }
104 else if ( BUFR2TAC_DEBUG_LEVEL > 0 )
105 {
106 bufr2tac_set_error ( s, 1, "syn_parse_x01()", "Ship or mobile land station index length >= 16" );
107 }
108 break;
109
110 case 11: // 0 01 011. Ship or mobile land station index
111 if ( strlen ( s->a->cval ) < 16 )
112 {
113 strcpy ( aux, s->a->cval );
114 adjust_string ( aux );
115 if ( aux[0] == '\xff' )
116 break;
117 if ( strlen ( aux ) < 10 )
118 strcpy ( syn->s0.D_D, aux );
119 else
120 bufr2tac_set_error ( s, 1, "syn_parse_x01()", "Ship or mobile land station index length >= 10. Cannot set s0.D_D" );
121 }
122 else if ( BUFR2TAC_DEBUG_LEVEL > 0 )
123 {
124 bufr2tac_set_error ( s, 1, "syn_parse_x01()", "Ship or mobile land station index length >= 16" );
125 }
126 break;
127
128 case 15: // 0 01 015 . Station or site name
129 case 18: // 0 01 018 . Short station or site name
130 case 19: // 0 01 019 . Long station or site name
131 if ( strlen ( s->a->cval ) <= 80 )
132 {
133 strcpy ( aux, s->a->cval );
134 adjust_string ( aux );
135 strcpy ( s->name, aux );
137 }
138 else if ( BUFR2TAC_DEBUG_LEVEL > 0 )
139 {
140 bufr2tac_set_error ( s, 1, "syn_parse_x01()", "Station or site name length > 80. Cannot set s->name" );
141 }
142 break;
143
144 case 101: // 0 01 101 . State identifier
145 if ( strlen ( s->a->ctable ) <= 256 )
146 {
147 strcpy ( aux, s->a->ctable );
148 adjust_string ( aux );
149 strcpy ( s->country, aux );
151 }
152 else if ( BUFR2TAC_DEBUG_LEVEL > 0 )
153 {
154 bufr2tac_set_error ( s, 1, "syn_parse_x01()", "State identifier length > 256. Cannot set s->country" );
155 }
156 break;
157
158 case 125: // 0 01 125 . WIGOS identifier series
159 syn->wid.series = ( uint8_t ) s->ival;
160 break;
161
162 case 126: // 0 01 126 . WIGOS issuer of identifier
163 syn->wid.issuer = ( uint16_t ) s->ival;
164 break;
165
166 case 127: // 0 01 127 , WIGOS issue number
167 syn->wid.issue = ( uint16_t ) s->ival;
168 break;
169
170 case 128: // 0 01 128 . WIGOS local identifier (character)
171 if ( strlen ( s->a->cval ) <= 16 )
172 {
173 adjust_string ( s->a->cval );
174 if ( check_wigos_local_id ( s->a->cval ) )
175 {
176 bufr2tac_set_error ( s, 1, "synop_parse_x01()","Bad WIGOS Local identifier" );
177 }
178 strcpy ( syn->wid.local_id, s->a->cval );
180 }
181 break;
182
183 default:
184 if ( BUFR2TAC_DEBUG_LEVEL > 1 && ( s->a->mask & DESCRIPTOR_VALUE_MISSING ) == 0 )
185 bufr2tac_set_error ( s, 0, "syn_parse_x01()", "Descriptor not parsed" );
186 break;
187 }
188
189 //set WMO region if we know II and iii and still no set A1
190 if ( ( syn->s0.A1[0] == 0 ) && syn->s0.II[0] && syn->s0.iii[0] )
191 {
192 guess_WMO_region ( syn->s0.A1, syn->s0.Reg, syn->s0.II, syn->s0.iii );
193 }
194 return 0;
195}
char * guess_WMO_region(char *A1, char *Reg, const char *II, const char *iii)
get WMO region A1 and Reg items from II and iii (WMO index)
struct wigos_id wid
Definition: metsynop.h:296
struct synop_sec0 s0
Definition: metsynop.h:297
char D_D[10]
Definition: metsynop.h:97
char iii[4]
Definition: metsynop.h:102
char Reg[4]
Definition: metsynop.h:103
char II[4]
Definition: metsynop.h:101
char A1[2]
Definition: metsynop.h:94
char bw[2]
Definition: metsynop.h:95

References bufr2tac_subset_state::a, synop_sec0::A1, adjust_string(), BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), synop_sec0::bw, check_wigos_local_id(), bufr2tac_subset_state::country, bufr_atom_data::ctable, bufr_atom_data::cval, synop_sec0::D_D, bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, guess_WMO_region(), synop_sec0::II, synop_sec0::iii, wigos_id::issue, wigos_id::issuer, bufr2tac_subset_state::ival, wigos_id::local_id, bufr_atom_data::mask, bufr2tac_subset_state::mask, bufr2tac_subset_state::name, synop_sec0::Reg, synop_chunks::s0, wigos_id::series, SUBSET_MASK_HAVE_COUNTRY, SUBSET_MASK_HAVE_NAME, SUBSET_MASK_HAVE_WIGOS_ID, synop_chunks::wid, 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_x01()

int temp_parse_x01 ( struct temp_chunks t,
struct bufr2tac_subset_state s 
)

Parse a expanded descriptor with X = 01.

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 415 of file bufr2tac_x01.c.

416{
417 char aux[80];
418
419 if ( s->a->mask & DESCRIPTOR_VALUE_MISSING )
420 return 0;
421
422 switch ( s->a->desc.y )
423 {
424 case 1: // 0 01 001 . WMO block number
425 sprintf ( t->a.s1.II, "%02d", s->ival );
426 sprintf ( t->b.s1.II, "%02d", s->ival );
427 sprintf ( t->c.s1.II, "%02d", s->ival );
428 sprintf ( t->d.s1.II, "%02d", s->ival );
429 break;
430
431 case 2: // 0 01 002 . WMO station number
432 sprintf ( t->a.s1.iii, "%03d", s->ival );
433 sprintf ( t->b.s1.iii, "%03d", s->ival );
434 sprintf ( t->c.s1.iii, "%03d", s->ival );
435 sprintf ( t->d.s1.iii, "%03d", s->ival );
436 break;
437
438 case 3: // 0 01 003 . WMO Region
439 sprintf ( t->a.s1.A1, "%d", s->ival );
440 sprintf ( t->b.s1.A1, "%d", s->ival );
441 sprintf ( t->c.s1.A1, "%d", s->ival );
442 sprintf ( t->d.s1.A1, "%d", s->ival );
443 if ( strcmp ( t->a.s1.A1, "1" ) == 0 )
444 {
445 strcpy ( t->a.s1.Reg, "I" );
446 strcpy ( t->b.s1.Reg, "I" );
447 strcpy ( t->c.s1.Reg, "I" );
448 strcpy ( t->d.s1.Reg, "I" );
449 }
450 else if ( strcmp ( t->a.s1.A1, "2" ) == 0 )
451 {
452 strcpy ( t->a.s1.Reg, "II" );
453 strcpy ( t->b.s1.Reg, "II" );
454 strcpy ( t->c.s1.Reg, "II" );
455 strcpy ( t->d.s1.Reg, "II" );
456 }
457 else if ( strcmp ( t->a.s1.A1, "3" ) == 0 )
458 {
459 strcpy ( t->a.s1.Reg, "III" );
460 strcpy ( t->b.s1.Reg, "III" );
461 strcpy ( t->c.s1.Reg, "III" );
462 strcpy ( t->d.s1.Reg, "III" );
463 }
464 else if ( strcmp ( t->a.s1.A1, "4" ) == 0 )
465 {
466 strcpy ( t->a.s1.Reg, "IV" );
467 strcpy ( t->b.s1.Reg, "IV" );
468 strcpy ( t->c.s1.Reg, "IV" );
469 strcpy ( t->d.s1.Reg, "IV" );
470 }
471 else if ( strcmp ( t->a.s1.A1, "5" ) == 0 )
472 {
473 strcpy ( t->a.s1.Reg, "V" );
474 strcpy ( t->b.s1.Reg, "V" );
475 strcpy ( t->c.s1.Reg, "V" );
476 strcpy ( t->d.s1.Reg, "V" );
477 }
478 else if ( strcmp ( t->a.s1.A1, "6" ) == 0 )
479 {
480 strcpy ( t->a.s1.Reg, "VI" );
481 strcpy ( t->b.s1.Reg, "VI" );
482 strcpy ( t->c.s1.Reg, "VI" );
483 strcpy ( t->d.s1.Reg, "VI" );
484 }
485 break;
486
487 case 4: // 0 01 004 . WMO Subarea
488 case 20: // 0 01 020 . WMO region subarea
489 sprintf ( t->a.s1.bw, "%d", s->ival );
490 sprintf ( t->b.s1.bw, "%d", s->ival );
491 sprintf ( t->c.s1.bw, "%d", s->ival );
492 sprintf ( t->d.s1.bw, "%d", s->ival );
493 break;
494
495 case 11: // 0 01 011. Ship or mobile land station index
496 if ( strlen ( s->a->cval ) < 16 )
497 {
498 strcpy ( aux, s->a->cval );
499 adjust_string ( aux );
500 if ( aux[0] == '\xff' )
501 break;
502
503 if ( strlen ( aux ) < 10 )
504 {
505 strcpy ( t->a.s1.D_D, aux );
506 strcpy ( t->b.s1.D_D, aux );
507 strcpy ( t->c.s1.D_D, aux );
508 strcpy ( t->d.s1.D_D, aux );
509 }
510 }
511 break;
512
513 case 15: // 0 01 015 . Station or site name
514 case 18: // 0 01 018 . Short station or site name
515 case 19: // 0 01 019 . Long station or site name
516 if ( strlen ( s->a->cval ) <= 80 )
517 {
518 strcpy ( aux, s->a->cval );
519 adjust_string ( aux );
520 strcpy ( s->name, aux );
522 }
523 else if ( BUFR2TAC_DEBUG_LEVEL > 0 )
524 {
525 bufr2tac_set_error ( s, 1, "temp_parse_x01()", "Station or site name length > 80. Cannot set s->name" );
526 }
527 break;
528
529 case 101: // 0 01 101 . State identifier
530 if ( strlen ( s->a->ctable ) <= 256 )
531 {
532 strcpy ( aux, s->a->ctable );
533 adjust_string ( aux );
534 strcpy ( s->country, aux );
536 }
537 else if ( BUFR2TAC_DEBUG_LEVEL > 0 )
538 {
539 bufr2tac_set_error ( s, 1, "temp_parse_x01()", "State identifier length > 256. Cannot set s->country" );
540 }
541 break;
542
543 case 125: // 0 01 125 . WIGOS identifier series
544 t->wid.series = ( uint8_t ) s->ival;
545 break;
546
547 case 126: // 0 01 126 . WIGOS issuer of identifier
548 t->wid.issuer = ( uint16_t ) s->ival;
549 break;
550
551 case 127: // 0 01 127 , WIGOS issue number
552 t->wid.issue = ( uint16_t ) s->ival;
553 break;
554
555 case 128: // 0 01 128 . WIGOS local identifier (character)
556 if ( strlen ( s->a->cval ) <= 16 )
557 {
558 strcpy ( t->wid.local_id, s->a->cval );
559 if ( check_wigos_local_id ( s->a->cval ) )
560 {
561 bufr2tac_set_error ( s, 1, "temp_parse_x01()","Bad WIGOS Local identifier" );
562 }
564 }
565 break;
566
567 default:
568 if ( BUFR2TAC_DEBUG_LEVEL > 1 && ( s->a->mask & DESCRIPTOR_VALUE_MISSING ) == 0 )
569 bufr2tac_set_error ( s, 0, "temp_parse_x01()", "Descriptor not parsed" );
570 break;
571 }
572 return 0;
573}
struct temp_acd_sec1 s1
Definition: mettemp.h:455
char Reg[4]
Definition: mettemp.h:319
char A1[2]
Definition: mettemp.h:312
char bw[2]
Definition: mettemp.h:313
char II[4]
Definition: mettemp.h:317
char D_D[10]
Definition: mettemp.h:314
char iii[4]
Definition: mettemp.h:318
char Reg[4]
Definition: mettemp.h:346
char II[4]
Definition: mettemp.h:344
char D_D[10]
Definition: mettemp.h:341
char A1[2]
Definition: mettemp.h:339
char iii[4]
Definition: mettemp.h:345
char bw[2]
Definition: mettemp.h:340
struct temp_b_sec1 s1
Definition: mettemp.h:470
struct temp_acd_sec1 s1
Definition: mettemp.h:485
struct temp_c c
Definition: mettemp.h:517
struct temp_d d
Definition: mettemp.h:518
struct temp_b b
Definition: mettemp.h:516
struct wigos_id wid
Definition: mettemp.h:514
struct temp_a a
Definition: mettemp.h:515
struct temp_acd_sec1 s1
Definition: mettemp.h:500

References bufr2tac_subset_state::a, temp_chunks::a, temp_acd_sec1::A1, temp_b_sec1::A1, adjust_string(), temp_chunks::b, BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), temp_acd_sec1::bw, temp_b_sec1::bw, temp_chunks::c, check_wigos_local_id(), bufr2tac_subset_state::country, bufr_atom_data::ctable, bufr_atom_data::cval, temp_chunks::d, temp_acd_sec1::D_D, temp_b_sec1::D_D, bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, temp_acd_sec1::II, temp_b_sec1::II, temp_acd_sec1::iii, temp_b_sec1::iii, wigos_id::issue, wigos_id::issuer, bufr2tac_subset_state::ival, wigos_id::local_id, bufr_atom_data::mask, bufr2tac_subset_state::mask, bufr2tac_subset_state::name, temp_acd_sec1::Reg, temp_b_sec1::Reg, temp_a::s1, temp_b::s1, temp_c::s1, temp_d::s1, wigos_id::series, SUBSET_MASK_HAVE_COUNTRY, SUBSET_MASK_HAVE_NAME, SUBSET_MASK_HAVE_WIGOS_ID, temp_chunks::wid, 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: