36 strcpy ( target,
"0" );
38 else if ( perc < ( 25.0 - 6.25 ) )
40 strcpy ( target,
"1" );
42 else if ( perc < ( 37.5 - 6.25 ) )
44 strcpy ( target,
"2" );
46 else if ( perc < ( 50.0 - 6.25 ) )
48 strcpy ( target,
"3" );
50 else if ( perc < ( 62.5 -6.25 ) )
52 strcpy ( target,
"4" );
54 else if ( perc < ( 75.0 - 6.25 ) )
56 strcpy ( target,
"5" );
58 else if ( perc < ( 87.5 - 6.25 ) )
60 strcpy ( target,
"6" );
62 else if ( perc < 100.0 )
64 strcpy ( target,
"7" );
66 else if ( perc <= 112.5 )
68 strcpy ( target,
"8" );
70 else if ( perc == 113.0 )
72 strcpy ( target,
"9" );
83char *
m_to_h (
char *target,
double h )
87 strcpy ( target,
"0" );
91 strcpy ( target,
"1" );
95 strcpy ( target,
"2" );
99 strcpy ( target,
"3" );
101 else if ( h < 600.0 )
103 strcpy ( target,
"4" );
105 else if ( h < 1000.0 )
107 strcpy ( target,
"5" );
109 else if ( h < 1500.0 )
111 strcpy ( target,
"6" );
113 else if ( h < 2000.0 )
115 strcpy ( target,
"7" );
117 else if ( h < 2500.0 )
119 strcpy ( target,
"8" );
123 strcpy ( target,
"9" );
139 strcpy ( target,
"90" );
141 else if ( h < 100.0 )
143 strcpy ( target,
"91" );
145 else if ( h < 200.0 )
147 strcpy ( target,
"92" );
149 else if ( h < 300.0 )
151 strcpy ( target,
"93" );
153 else if ( h < 600.0 )
155 strcpy ( target,
"94" );
157 else if ( h < 1000.0 )
159 strcpy ( target,
"95" );
161 else if ( h < 1500.0 )
163 strcpy ( target,
"96" );
165 else if ( h < 2000.0 )
167 strcpy ( target,
"97" );
169 else if ( h < 2500.0 )
171 strcpy ( target,
"98" );
175 strcpy ( target,
"99" );
194 sprintf ( target,
"%02d", ih / 30 );
196 else if ( ih <= 9000 )
200 strcpy ( target,
"50" );
204 sprintf ( target,
"%2d", ( ih / 300 ) + 50 );
207 else if ( ih <= 21000 )
209 sprintf ( target,
"%2d", ( ih / 500 ) + 50 );
213 strcpy ( target,
"89" );
230 strcpy ( target,
"00" );
232 else if ( V <= 5000.0 )
234 sprintf ( target,
"%02d", (
int ) ( V + 0.1 ) / 100 );
236 else if ( V < 6000.0 )
238 sprintf ( target,
"50" );
240 else if ( V <= 30000.0 )
242 sprintf ( target,
"%02d", (
int ) ( V + 0.1 ) / 1000 + 50 );
244 else if ( V <= 70000.0 )
246 sprintf ( target,
"%02d", (
int ) ( V - 30000.0 ) / 5000 + 80 );
250 strcpy ( target,
"89" );
264 ix = ( int ) ( m * 1000.0 + 0.5 );
268 strcpy ( target,
"98" );
270 if ( m > 0.0 && m < 0.00065 )
272 sprintf ( target,
"%02d", (
int ) ( m * 10000.0 + 0.5 ) );
276 sprintf ( target,
"%02d", ix );
278 else if ( ix <= 400 )
280 sprintf ( target,
"%02d", ( ix / 10 ) + 50 );
284 strcpy ( target,
"99" );
330 if ( s->
ival == 100 || s->
ival == 508 )
346 else if ( s->
itval == 0 && s->
jtval == -3600 && syn->
s1.
ww[0] ==
'2' )
378 else if ( s->
ival < 200 )
389 else if ( syn->
s1.
ww[0] && s->
itval == 0 )
408 else if ( s->
ival < 200 )
427 strcpy ( syn->
s1.
ix,
"1" );
429 else if ( s->
type == 1 || s->
type == 2 )
431 strcpy ( syn->
s1.
ix,
"1" );
433 else if ( s->
type == 0 )
435 strcpy ( syn->
s1.
ix,
"4" );
437 sprintf ( syn->
s1.
ww,
"%02d", s->
ival );
440 else if ( s->
ival == 100 )
442 strcpy ( syn->
s1.
ix,
"5" );
446 else if ( s->
ival < 200 )
450 strcpy ( syn->
s1.
ix,
"7" );
452 else if ( s->
type == 0 || s->
type == 2 )
454 strcpy ( syn->
s1.
ix,
"7" );
456 sprintf ( syn->
s1.
ww,
"%02d", s->
ival % 100 );
459 else if ( s->
ival == 508 )
463 strcpy ( syn->
s1.
ix,
"5" );
465 else if ( s->
type == 0 || s->
type == 2 )
467 strcpy ( syn->
s1.
ix,
"5" );
471 else if ( s->
ival == 509 )
475 strcpy ( syn->
s1.
ix,
"6" );
477 else if ( s->
type == 0 || s->
type == 2 )
479 strcpy ( syn->
s1.
ix,
"6" );
501 strcpy ( syn->
s1.
ix,
"1" );
503 else if ( syn->
s1.
ix[0] ==
'/' )
507 strcpy ( syn->
s1.
ix,
"1" );
509 else if ( s->
type == 0 )
511 strcpy ( syn->
s1.
ix,
"4" );
514 sprintf ( syn->
s1.
W1,
"%d", s->
ival );
517 else if ( s->
ival == 10 )
523 strcpy ( syn->
s1.
ix,
"2" );
525 else if ( s->
type == 0 )
527 strcpy ( syn->
s1.
ix,
"5" );
536 strcpy ( syn->
s1.
ix,
"7" );
538 else if ( s->
type == 0 || s->
type == 2 )
540 strcpy ( syn->
s1.
ix,
"7" );
542 sprintf ( syn->
s1.
W1,
"%d", abs ( s->
ival ) % 10 );
557 strcpy ( syn->
s1.
ix,
"1" );
559 else if ( syn->
s1.
ix[0] ==
'/' )
563 strcpy ( syn->
s1.
ix,
"1" );
565 else if ( s->
type == 0 )
567 strcpy ( syn->
s1.
ix,
"4" );
570 sprintf ( syn->
s1.
W2,
"%d", s->
ival );
573 else if ( s->
ival == 10 )
579 strcpy ( syn->
s1.
ix,
"2" );
581 else if ( s->
type == 0 )
583 strcpy ( syn->
s1.
ix,
"5" );
592 strcpy ( syn->
s1.
ix,
"7" );
594 else if ( s->
type == 0 || s->
type == 2 )
596 strcpy ( syn->
s1.
ix,
"7" );
598 sprintf ( syn->
s1.
W2,
"%d", abs ( s->
ival ) % 10 );
620 sprintf ( syn->
s1.
Nh,
"%1d", abs(s->
ival) % 10 );
622 else if ( s->
ival <= 10 )
624 sprintf ( syn->
s1.
Nh,
"9" );
626 else if ( s->
ival == 15 )
628 sprintf ( syn->
s1.
Nh,
"/" );
636 sprintf ( syn->
s4.
N1,
"%1d", abs(s->
ival) % 10 );
638 else if ( s->
ival <= 10 )
640 sprintf ( syn->
s4.
N1,
"9" );
642 else if ( s->
ival == 15 )
644 sprintf ( syn->
s4.
N1,
"/" );
654 else if ( s->
ival <= 10 )
658 else if ( s->
ival == 15 )
675 sprintf ( syn->
s3.
C,
"%d", abs(s->
ival) % 10 );
678 else if ( s->
ival >= 10 && s->
ival < 20 )
680 sprintf ( syn->
s1.
Ch,
"%1d", s->
ival % 10 );
683 else if ( s->
ival >= 20 && s->
ival < 30 )
685 sprintf ( syn->
s1.
Cm,
"%1d", s->
ival % 10 );
688 else if ( s->
ival >= 30 && s->
ival < 40 )
690 sprintf ( syn->
s1.
Cl,
"%1d", s->
ival % 10 );
693 else if ( s->
ival == 59 )
695 sprintf ( syn->
s1.
Nh,
"/" );
698 else if ( s->
ival == 60 )
700 sprintf ( syn->
s1.
Ch,
"/" );
703 else if ( s->
ival == 61 )
705 sprintf ( syn->
s1.
Cm,
"/" );
708 else if ( s->
ival == 62 )
710 sprintf ( syn->
s1.
Cl,
"/" );
723 sprintf ( syn->
s4.
C1,
"/" );
726 else if ( s->
ival < 10 )
728 sprintf ( syn->
s4.
C1,
"%1d", abs (s->
ival) % 10 );
739 if ( s->
ival == 59 || s->
ival >= 10 )
793 sprintf ( syn->
s4.
Ct,
"%d", abs(s->
ival) % 10 );
804 if ( syn->
s0.
A1[0] ==
'6' )
807 if ( s->
ival & ( 1 << ( 30 - 15 ) ) &&
808 ( s->
ival & ( 1 << ( 30 - 16 ) ) ) == 0 &&
809 ( s->
ival & ( 1 << ( 30 - 20 ) ) ) == 0
818 else if ( s->
ival & ( 1 << ( 30 - 16 ) ) &&
819 ( s->
ival & ( 1 << ( 30 - 15 ) ) ) == 0 &&
820 ( s->
ival & ( 1 << ( 30 - 20 ) ) ) == 0
829 else if ( s->
ival & ( 1 << ( 30 - 20 ) ) &&
830 ( s->
ival & ( 1 << ( 30 - 15 ) ) ) == 0 &&
831 ( s->
ival & ( 1 << ( 30 - 16 ) ) ) == 0
840 else if ( s->
ival & ( 1 << ( 30 - 15 ) ) ||
841 s->
ival & ( 1 << ( 30 - 16 ) ) ||
842 s->
ival & ( 1 << ( 30 - 20 ) ) )
859 if ( syn->
s0.
A1[0] ==
'6' )
862 if ( s->
ival & ( 1 << ( 18 - 1 ) ) )
872 else if ( ( s->
ival & ( 1 << ( 18 - 9 ) ) ) ||
873 ( s->
ival & ( 1 << ( 18 - 10 ) ) )
884 else if ( s->
ival & ( 1 << ( 18 - 12 ) ) )
893 else if ( s->
ival & ( 1 << ( 18 - 2 ) ) )
910 if ( syn->
s0.
A1[0] ==
'6' )
912 if ( s->
SnSn == 919 )
920 else if ( s->
ival == 3 || s->
ival == 4 )
935 if ( syn->
s0.
A1[0] ==
'6' )
938 if ( s->
ival & ( 1 << ( 21 - 1 ) ) )
956 if ( syn->
s0.
A1[0] ==
'6' )
958 if ( s->
SnSn == 929 )
971 if ( syn->
s0.
A1[0] ==
'6' )
974 if ( s->
SnSn == 919 || s->
SnSn == 918 )
981 if ( syn->
s0.
A1[0] ==
'6' )
984 if ( s->
SnSn == 919 || s->
SnSn == 918 )
986 if ( ( s->
ival & ( 1 << ( 9 - 3 ) ) ) == 0 )
999 if ( syn->
s0.
A1[0] ==
'6' )
1001 if ( s->
SnSn == 929 )
1003 sprintf ( aux,
"%d", s->
ival % 10 );
1014 if ( syn->
s0.
A1[0] ==
'6' )
1017 if ( s->
SnSn == 919 || s->
SnSn == 918 )
1021 else if ( s->
clayer == 7 )
1025 else if ( s->
clayer == 8 )
1029 else if ( s->
clayer == 9 )
1035 else if ( syn->
s0.
A1[0] ==
'4' )
1042 else if ( s->
clayer == 8 )
1046 else if ( s->
clayer == 9 )
1058 else if ( s->
clayer == 8 )
1062 else if ( s->
clayer == 9 )
1075 if ( strcmp ( syn->
s0.
A1,
"4" ) == 0 )
1080 sprintf ( aux,
"%d", s->
ival );
1088 if ( syn->
s3.
Dl[0] )
1092 if ( syn->
s3.
Dm[0] )
1096 if ( syn->
s3.
Dh[0] )
1109 if ( strcmp ( syn->
s0.
A1,
"2" ) == 0 )
1114 sprintf ( aux,
"%d", s->
ival );
1115 sprintf ( syn->
s3.
E,
"%d", s->
ival );
1118 else if ( s->
ival < 20 )
1121 sprintf ( syn->
s3.
E1,
"%d", s->
ival % 10 );
1136 sprintf ( syn->
s3.
E,
"%d", abs(s->
ival) % 10 );
1138 else if ( s->
ival < 20 )
1140 sprintf ( syn->
s3.
E1,
"%d", s->
ival % 10 );
1151 if ( strcmp ( syn->
s0.
A1,
"1" ) == 0 )
1166 if ( strcmp ( syn->
s0.
A1,
"1" ) == 0 )
1177 if ( strcmp ( syn->
s0.
A1,
"1" ) == 0 )
1181 sprintf ( aux,
"%d", s->
ival );
1182 syn->
s3.
R8[0][0] = aux[0];
1193 if ( strcmp ( syn->
s0.
A1,
"1" ) == 0 )
1197 sprintf ( aux,
"%d", s->
ival );
1198 syn->
s3.
R8[0][1] = aux[0];
1209 if ( strcmp ( syn->
s0.
A1,
"1" ) == 0 )
1213 sprintf ( aux,
"%d", s->
ival );
1214 syn->
s3.
R8[0][2] = aux[0];
1225 if ( strcmp ( syn->
s0.
A1,
"1" ) == 0 )
1229 sprintf ( aux,
"%d", s->
ival );
1230 syn->
s3.
R8[0][3] = aux[0];
1242 if ( strcmp ( syn->
s0.
A1,
"1" ) == 0 )
1246 sprintf ( aux,
"%d", s->
ival );
1247 syn->
s3.
R8[1][0] = aux[0];
1258 if ( strcmp ( syn->
s0.
A1,
"1" ) == 0 )
1262 sprintf ( aux,
"%d", s->
ival );
1263 syn->
s3.
R8[1][1] = aux[0];
1274 if ( strcmp ( syn->
s0.
A1,
"1" ) == 0 )
1278 sprintf ( aux,
"%d", s->
ival );
1279 syn->
s3.
R8[1][1] = aux[0];
1290 if ( strcmp ( syn->
s0.
A1,
"1" ) == 0 )
1294 sprintf ( aux,
"%d", s->
ival );
1295 syn->
s3.
R8[1][1] = aux[0];
1308 if ( syn->
s1.
h[0] ==
'/' && syn->
s1.
N[0] ==
'0' )
1366 sprintf ( t->
b.
s8.
Nh,
"%1d", abs(s->
ival) % 10 );
1368 else if ( s->
ival <= 10 )
1370 sprintf ( t->
b.
s8.
Nh,
"9" );
1372 else if ( s->
ival == 15 )
1374 sprintf ( t->
b.
s8.
Nh,
"/" );
1384 if ( s->
ival >= 10 && s->
ival < 20 )
1386 sprintf ( t->
b.
s8.
Ch,
"%1d", s->
ival % 10 );
1388 else if ( s->
ival >= 20 && s->
ival < 30 )
1390 sprintf ( t->
b.
s8.
Cm,
"%1d", s->
ival % 10 );
1392 else if ( s->
ival >= 30 && s->
ival < 40 )
1394 sprintf ( t->
b.
s8.
Cl,
"%1d", s->
ival % 10 );
1396 else if ( s->
ival == 59 )
1398 sprintf ( t->
b.
s8.
Nh,
"/" );
1400 else if ( s->
ival == 60 )
1402 sprintf ( t->
b.
s8.
Ch,
"/" );
1404 else if ( s->
ival == 61 )
1406 sprintf ( t->
b.
s8.
Cm,
"/" );
1408 else if ( s->
ival == 62 )
1410 sprintf ( t->
b.
s8.
Cl,
"/" );
Include header file for binary bufr2tac.
int bufr2tac_set_error(struct bufr2tac_subset_state *s, int severity, char *origin, char *explanation)
#define SUBSET_MASK_HAVE_NO_SIGNIFICANT_WW
Bit mask to mark a struct bufr_subset_sequence_data without WW information.
char * grad_to_D(char *D, double grad)
Converts true direction in grads to D (code table 0700)
char * secs_to_tt(char *tt, int secs)
get tt code from seconds
#define SUBSET_MASK_HAVE_TYPE_STATION
Bit mask to mark a struct bufr_subset_sequence_data having type station information.
#define SUBSET_MASK_HAVE_NO_SIGNIFICANT_W1
Bit mask to mark a struct bufr_subset_sequence_data without W1 information.
#define SUBSET_MASK_HAVE_NO_SIGNIFICANT_W2
Bit mask to mark a struct bufr_subset_sequence_data without W1 information.
char * m_to_9h(char *target, double h)
converts the altitude of cloud layer into 9h string code
int syn_parse_x20(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 20.
char * percent_to_okta(char *target, double perc)
Converts percent cloud cover into okta.
char * vism_to_VV(char *target, double V)
Convert horizontal visibilty in meters to a VV string.
int temp_parse_x20(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 20.
char * m_to_hh(char *target, double h)
converts the altitude of cloud layer into hh string code
char * m_to_RR(char *target, double m)
Convert distance (m) in RR code (3570)
char * m_to_h(char *target, double h)
converts the altitude of cloud layer into h string code
int buoy_parse_x20(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 20.
#define DESCRIPTOR_VALUE_MISSING
Bit mask for a missing value in a struct bufr_atom_data.
#define SYNOP_SEC3_8
mask bit meaning optional/regional 8 part, section 3 for synop is solicited to or parsed with success
#define SYNOP_NMISC
number of misc3 struct to store the parsed results of 9SpSpspsp groups
#define SYNOP_SEC1
mask bit meaning section 1 or synop is solicited to or parsed with success
#define SYNOP_SEC3
mask bit meaning section 3 or synop is solicited to or parsed with success
#define SYNOP_SEC4
mask bit meaning section 4 or synop is solicited to or parsed with success
#define TEMP_SEC_8
mask bit meaning sec 8 of a part of TEMP report parsed with success
stores information needed to parse a sequential list of expanded descriptors for a subset
struct bufr_atom_data * a
struct bufr_descriptor desc
contains all possible substrings from a synop report is parsed with success
struct misc3 misc[SYNOP_NMISC]
contains all possible substrings from a synop report is parsed with success
struct nub3 nub[SYNOP_NNUB]
Store the whole TEMP report.