32 if ( ! ( isalpha ( *c ) ) && ! ( isdigit ( *c ) ) )
38 if ( ! ( isalpha ( *c ) ) && ! ( isdigit ( *c ) ) && ! ( isblank ( *c ) ) )
64 sprintf ( syn->
s0.
II,
"%02d", s->
ival );
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" );
89 sprintf ( syn->
s0.
bw,
"%d", s->
ival );
93 if ( strlen ( s->
a->
cval ) < 16 )
95 strcpy ( aux, s->
a->
cval );
97 if ( aux[0] ==
'\xff' )
99 if ( strlen ( aux ) < 10 )
100 strcpy ( syn->
s0.
D_D, aux );
102 bufr2tac_set_error ( s, 1,
"syn_parse_x01()",
"Ship or mobile land station index length >= 10. Cannot set s0.D_D" );
106 bufr2tac_set_error ( s, 1,
"syn_parse_x01()",
"Ship or mobile land station index length >= 16" );
111 if ( strlen ( s->
a->
cval ) < 16 )
113 strcpy ( aux, s->
a->
cval );
115 if ( aux[0] ==
'\xff' )
117 if ( strlen ( aux ) < 10 )
118 strcpy ( syn->
s0.
D_D, aux );
120 bufr2tac_set_error ( s, 1,
"syn_parse_x01()",
"Ship or mobile land station index length >= 10. Cannot set s0.D_D" );
124 bufr2tac_set_error ( s, 1,
"syn_parse_x01()",
"Ship or mobile land station index length >= 16" );
131 if ( strlen ( s->
a->
cval ) <= 80 )
133 strcpy ( aux, s->
a->
cval );
135 strcpy ( s->
name, aux );
140 bufr2tac_set_error ( s, 1,
"syn_parse_x01()",
"Station or site name length > 80. Cannot set s->name" );
145 if ( strlen ( s->
a->
ctable ) <= 256 )
154 bufr2tac_set_error ( s, 1,
"syn_parse_x01()",
"State identifier length > 256. Cannot set s->country" );
171 if ( strlen ( s->
a->
cval ) <= 16 )
190 if ( ( syn->
s0.
A1[0] == 0 ) && syn->
s0.
II[0] && syn->
s0.
iii[0] )
216 sprintf ( b->
s0.
A1,
"%d", s->
ival % 10 );
217 else if ( s->
ival == 0 )
218 sprintf ( b->
s0.
A1,
"7" );
223 sprintf ( b->
s0.
bw,
"%d", s->
ival );
227 if ( s->
ival < 1000 )
234 if ( strlen ( s->
a->
cval ) <= 80 )
236 strcpy ( aux, s->
a->
cval );
238 strcpy ( s->
name, aux );
243 bufr2tac_set_error ( s, 1,
"buoy_parse_x01()",
"Station or site name length > 80. Cannot set s->name" );
250 if ( s->
a->
val < 100000000 )
252 sprintf ( aux,
"%07.0lf", s->
a->
val );
253 b->
s0.
A1[0] = aux[0];
255 b->
s0.
bw[0] = aux[1];
257 if ( ( (
int ) ( s->
a->
val ) % 100000 ) < 1000 )
265 "WMO marine observing platform extended identifier >= 100000000. Cannot set s0.A1, s0.bw, s0.nbnbnb" );
270 if ( strlen ( s->
a->
ctable ) <= 256 )
279 bufr2tac_set_error ( s, 1,
"buoy_parse_x01()",
"State identifier length > 256. Cannot set s->country" );
296 if ( strlen ( s->
a->
cval ) <= 16 )
335 sprintf ( c->
s0.
II,
"%02d", s->
ival );
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" );
360 if ( strlen ( s->
a->
cval ) <= 80 )
362 strcpy ( aux, s->
a->
cval );
364 strcpy ( s->
name, aux );
369 bufr2tac_set_error ( s, 1,
"climat_parse_x01()",
"Station or site name length > 80. Cannot set s->name" );
386 if ( strlen ( s->
a->
cval ) <= 16 )
443 if ( strcmp ( t->
a.
s1.
A1,
"1" ) == 0 )
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" );
450 else if ( strcmp ( t->
a.
s1.
A1,
"2" ) == 0 )
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" );
457 else if ( strcmp ( t->
a.
s1.
A1,
"3" ) == 0 )
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" );
464 else if ( strcmp ( t->
a.
s1.
A1,
"4" ) == 0 )
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" );
471 else if ( strcmp ( t->
a.
s1.
A1,
"5" ) == 0 )
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" );
478 else if ( strcmp ( t->
a.
s1.
A1,
"6" ) == 0 )
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" );
496 if ( strlen ( s->
a->
cval ) < 16 )
498 strcpy ( aux, s->
a->
cval );
500 if ( aux[0] ==
'\xff' )
503 if ( strlen ( aux ) < 10 )
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 );
516 if ( strlen ( s->
a->
cval ) <= 80 )
518 strcpy ( aux, s->
a->
cval );
520 strcpy ( s->
name, aux );
525 bufr2tac_set_error ( s, 1,
"temp_parse_x01()",
"Station or site name length > 80. Cannot set s->name" );
530 if ( strlen ( s->
a->
ctable ) <= 256 )
539 bufr2tac_set_error ( s, 1,
"temp_parse_x01()",
"State identifier length > 256. Cannot set s->country" );
556 if ( strlen ( s->
a->
cval ) <= 16 )
Include header file for binary bufr2tac.
#define SUBSET_MASK_HAVE_COUNTRY
Bit mask to mark a struct bufr_subset_sequence_data having country name.
int bufr2tac_set_error(struct bufr2tac_subset_state *s, int severity, char *origin, char *explanation)
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)
#define SUBSET_MASK_HAVE_NAME
Bit mask to mark a struct bufr_subset_sequence_data having station name.
#define SUBSET_MASK_HAVE_WIGOS_ID
Bit mask to mark if a subset has a WIGOS ID.
char * adjust_string(char *s)
Supress trailing blanks of a string.
int buoy_parse_x01(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
int syn_parse_x01(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
int temp_parse_x01(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
int check_wigos_local_id(char *local_id)
int climat_parse_x01(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
#define DESCRIPTOR_VALUE_MISSING
Bit mask for a missing value in a struct bufr_atom_data.
stores information needed to parse a sequential list of expanded descriptors for a subset
struct bufr_atom_data * a
char ctable[BUFR_EXPLAINED_LENGTH]
struct bufr_descriptor desc
char cval[BUFR_CVAL_LENGTH]
contains all possible substrings from a synop report is parsed with success
contains all possible substrings from a synop report is parsed with success
contains all possible substrings from a synop report is parsed with success
Store the whole TEMP report.