bufr2synop 0.24.0
Functions
bufr2tac_print_synop.c File Reference
#include "bufr2tac.h"
Include dependency graph for bufr2tac_print_synop.c:

Go to the source code of this file.

Functions

size_t print_synop_sec0 (char **sec0, size_t lmax, struct synop_chunks *syn)
 Prints the synop section 0 (header) More...
 
size_t print_synop_sec1 (char **sec1, size_t lmax, struct synop_chunks *syn)
 Prints the synop section 1. More...
 
size_t print_synop_sec2 (char **sec2, size_t lmax, struct synop_chunks *syn)
 Prints the synop section 2. More...
 
size_t print_synop_sec3 (char **sec3, size_t lmax, struct synop_chunks *syn)
 Prints the synop section 3. More...
 
size_t print_synop_sec4 (char **sec4, size_t lmax, struct synop_chunks *syn)
 Prints the synop section 4. More...
 
size_t print_synop_sec5 (char **sec5, size_t lmax, struct synop_chunks *syn)
 Prints the synop section 5. More...
 
int print_synop_report (struct metreport *m)
 prints a synop into a string More...
 

Function Documentation

◆ print_synop_report()

int print_synop_report ( struct metreport m)

prints a synop into a string

Parameters
mpointer to struct metreport where are both target and source

If OK returns 0, otherwise 1

Definition at line 825 of file bufr2tac_print_synop.c.

826{
827 char *c = &(m->alphanum[0]);
828 size_t used = 0;
829 size_t lmax = sizeof(m->alphanum);
830 struct synop_chunks *syn = &m->synop;
831
832 // Needs time extension
833 if ( syn->e.YYYY[0] == 0 || syn->e.YYYY[0] == '0' )
834 {
835 return 1;
836 }
837
839 {
840 used += print_wigos_id ( &c, lmax, m );
841 }
842 else
843 {
844 // Do not print a synop if no IIiii identifier when mode = 0
845 if ( ( strcmp(syn->s0.MiMi, "AA") == 0 && strcmp(syn->s0.MjMj, "XX") == 0) &&
846 ( syn->s0.II[0] == '\0' || syn->s0.iii[0] == '\0' || strcmp ( syn->s0.II, "00" ) == 0 ))
847 return 1;
848 }
849
850 if ( m->print_mask & PRINT_BITMASK_GEO )
851 {
852 used += print_geo ( &c, lmax, m );
853 }
854
855 used += print_synop_sec0 ( &c, lmax - used, syn );
856
857 if ( syn->mask & ( SYNOP_SEC1 | SYNOP_SEC2 | SYNOP_SEC3 | SYNOP_SEC4 | SYNOP_SEC5 ) )
858 {
859 used += print_synop_sec1 ( &c, lmax - used, syn );
860
861 used += print_synop_sec2 ( &c, lmax - used, syn );
862
863 used += print_synop_sec3 ( &c, lmax - used, syn );
864
865 used += print_synop_sec4 ( &c, lmax - used, syn );
866
867 used += print_synop_sec5 ( &c, lmax - used, syn );
868 }
869 else
870 {
871 c += snprintf ( c, lmax - used, " NIL" );
872 }
873 snprintf ( c, lmax - used - 1, "=" );
874
875 return 0;
876}
size_t print_wigos_id(char **wid, size_t lmax, struct metreport *m)
#define PRINT_BITMASK_WIGOS
Bit mask to member print_mask in struct metreport to print WIGOS Identifier.
Definition: bufr2tac.h:208
size_t print_geo(char **geo, size_t lmax, struct metreport *m)
#define PRINT_BITMASK_GEO
Bit mask to member print_mask in struct metreport to print geographic position.
Definition: bufr2tac.h:214
size_t print_synop_sec0(char **sec0, size_t lmax, struct synop_chunks *syn)
Prints the synop section 0 (header)
size_t print_synop_sec2(char **sec2, size_t lmax, struct synop_chunks *syn)
Prints the synop section 2.
size_t print_synop_sec1(char **sec1, size_t lmax, struct synop_chunks *syn)
Prints the synop section 1.
size_t print_synop_sec5(char **sec5, size_t lmax, struct synop_chunks *syn)
Prints the synop section 5.
size_t print_synop_sec3(char **sec3, size_t lmax, struct synop_chunks *syn)
Prints the synop section 3.
size_t print_synop_sec4(char **sec4, size_t lmax, struct synop_chunks *syn)
Prints the synop section 4.
#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
#define SYNOP_SEC5
mask bit meaning section 5 or synop is solicited to or parsed with success
Definition: metsynop.h:59
#define SYNOP_SEC4
mask bit meaning section 4 or synop is solicited to or parsed with success
Definition: metsynop.h:54
#define SYNOP_SEC2
mask bit meaning section 2 or synop is solicited to or parsed with success
Definition: metsynop.h:44
char alphanum[REPORT_LENGTH]
Definition: bufr2tac.h:321
struct synop_chunks synop
Definition: bufr2tac.h:316
int print_mask
Definition: bufr2tac.h:312
char YYYY[6]
Definition: metcommon.h:33
contains all possible substrings from a synop report is parsed with success
Definition: metsynop.h:293
struct report_date_ext e
Definition: metsynop.h:295
struct synop_sec0 s0
Definition: metsynop.h:297
char iii[4]
Definition: metsynop.h:102
char II[4]
Definition: metsynop.h:101
char MiMi[4]
Definition: metsynop.h:92
char MjMj[4]
Definition: metsynop.h:93

References metreport::alphanum, synop_chunks::e, synop_sec0::II, synop_sec0::iii, synop_chunks::mask, synop_sec0::MiMi, synop_sec0::MjMj, PRINT_BITMASK_GEO, PRINT_BITMASK_WIGOS, print_geo(), metreport::print_mask, print_synop_sec0(), print_synop_sec1(), print_synop_sec2(), print_synop_sec3(), print_synop_sec4(), print_synop_sec5(), print_wigos_id(), synop_chunks::s0, metreport::synop, SYNOP_SEC1, SYNOP_SEC2, SYNOP_SEC3, SYNOP_SEC4, SYNOP_SEC5, and report_date_ext::YYYY.

Referenced by parse_subset_sequence().

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

◆ print_synop_sec0()

size_t print_synop_sec0 ( char **  sec0,
size_t  lmax,
struct synop_chunks syn 
)

Prints the synop section 0 (header)

Parameters
sec0the pointer where to print section
lmaxmax length permited
synpointer to s atruct synop_chunks where the parse results are set
Returns
Used bytes

Definition at line 34 of file bufr2tac_print_synop.c.

35{
36 char *c = *sec0;
37 size_t used = 0;
38
39 used += snprintf ( c + used, lmax - used, "%s%s%s%s%s", syn->e.YYYY, syn->e.MM, syn->e.DD, syn->e.HH, syn->e.mm );
40
41 // Print type
42 used += snprintf ( c + used, lmax - used, " %s%s", syn->s0.MiMi, syn->s0.MjMj );
43
44 if ( syn->s0.D_D[0] )
45 {
46 used += snprintf ( c + used, lmax - used, " %s", syn->s0.D_D );
47 }
48 else if ( syn->s0.A1[0] && syn->s0.bw[0] && syn->s0.nbnbnb[0] )
49 {
50 used += snprintf ( c + used, lmax - used, " %s%s%s", syn->s0.A1, syn->s0.bw, syn->s0.nbnbnb );
51 }
52
53
54 // print YYGGiw
55 used += snprintf ( c + used, lmax - used, " %s%s%s", syn->s0.YY, syn->s0.GG, syn->s0.iw );
56
57 // print IIiii
58 if ( syn->s0.II[0] )
59 {
60 used += snprintf ( c + used, lmax - used, " %s%s", syn->s0.II, syn->s0.iii );
61 }
62 else
63 {
64 if ( syn->s0.LaLaLa[0] )
65 {
66 used += snprintf ( c + used, lmax - used, " 99%s", syn->s0.LaLaLa );
67 }
68 else
69 {
70 used += snprintf ( c + used, lmax - used, " 99///" );
71 }
72
73 if ( syn->s0.Qc[0] && syn->s0.LoLoLoLo[0] )
74 {
75 used += snprintf ( c + used, lmax - used, " %s%s", syn->s0.Qc, syn->s0.LoLoLoLo );
76 }
77 else
78 {
79 used += snprintf ( c + used, lmax - used, " /////" );
80 }
81 }
82
83 if ( strcmp ( syn->s0.MiMi, "OO" ) == 0 )
84 {
85 if ( syn->s0.MMM[0] && syn->s0.Ula[0] && syn->s0.Ulo[0] )
86 {
87 used += snprintf ( c + used, lmax - used, " %s%s%s", syn->s0.MMM, syn->s0.Ula, syn->s0.Ulo );
88 }
89 if ( syn->s0.h0h0h0h0[0] )
90 {
91 used += snprintf ( c + used, lmax - used, " %s%s", syn->s0.h0h0h0h0, syn->s0.im );
92 }
93
94 }
95
96 *sec0 = c + used;
97 return used;
98}
char mm[4]
Definition: metcommon.h:37
char HH[4]
Definition: metcommon.h:36
char DD[4]
Definition: metcommon.h:35
char MM[4]
Definition: metcommon.h:34
char D_D[10]
Definition: metsynop.h:97
char iw[2]
Definition: metsynop.h:100
char nbnbnb[4]
Definition: metsynop.h:96
char LaLaLa[4]
Definition: metsynop.h:105
char Qc[2]
Definition: metsynop.h:106
char A1[2]
Definition: metsynop.h:94
char h0h0h0h0[6]
Definition: metsynop.h:111
char GG[4]
Definition: metsynop.h:99
char LoLoLoLo[6]
Definition: metsynop.h:107
char im[2]
Definition: metsynop.h:112
char YY[4]
Definition: metsynop.h:98
char bw[2]
Definition: metsynop.h:95
char Ulo[2]
Definition: metsynop.h:110
char Ula[2]
Definition: metsynop.h:109
char MMM[4]
Definition: metsynop.h:108

References synop_sec0::A1, synop_sec0::bw, synop_sec0::D_D, report_date_ext::DD, synop_chunks::e, synop_sec0::GG, synop_sec0::h0h0h0h0, report_date_ext::HH, synop_sec0::II, synop_sec0::iii, synop_sec0::im, synop_sec0::iw, synop_sec0::LaLaLa, synop_sec0::LoLoLoLo, synop_sec0::MiMi, synop_sec0::MjMj, report_date_ext::MM, report_date_ext::mm, synop_sec0::MMM, synop_sec0::nbnbnb, synop_sec0::Qc, synop_chunks::s0, synop_sec0::Ula, synop_sec0::Ulo, synop_sec0::YY, and report_date_ext::YYYY.

Referenced by print_synop_report().

Here is the caller graph for this function:

◆ print_synop_sec1()

size_t print_synop_sec1 ( char **  sec1,
size_t  lmax,
struct synop_chunks syn 
)

Prints the synop section 1.

Parameters
sec1the pointer where to print section
lmaxmax length permited
synpointer to s atruct synop_chunks where the parse results are set
Returns
Used bytes

Definition at line 108 of file bufr2tac_print_synop.c.

109{
110 char *c = *sec1;
111 size_t used = 0;
112
113 if ( syn->mask & SYNOP_SEC1 )
114 {
115 // printf irixhVV
116 used += snprintf ( c + used, lmax - used, " %s%s%s%s", syn->s1.ir, syn->s1.ix, syn->s1.h, syn->s1.VV );
117
118
119 // printf Nddff
120 used += snprintf ( c + used, lmax - used, " %s%s%s", syn->s1.N, syn->s1.dd, syn->s1.ff );
121 if ( strlen ( syn->s1.fff ) )
122 {
123 used += snprintf ( c + used, lmax - used, " 00%s", syn->s1.fff );
124 }
125
126 // printf 1snTTT
127
128 if ( syn->s1.TTT[0] )
129 {
130 used += snprintf ( c + used, lmax - used, " 1%s%s", syn->s1.sn1, syn->s1.TTT );
131 }
132
133 // printf 2snTdTdTd or 29UUU
134 if ( syn->s1.TdTdTd[0] )
135 {
136 used += snprintf ( c + used, lmax - used, " 2%s%s", syn->s1.sn2, syn->s1.TdTdTd );
137 }
138 else if ( syn->s1.UUU[0] )
139 {
140 used += snprintf ( c + used, lmax - used, " 29%s", syn->s1.UUU );
141 }
142
143 // printf 3PoPoPoPo
144 if ( syn->s1.PoPoPoPo[0] )
145 {
146 used += snprintf ( c + used, lmax - used, " 3%s", syn->s1.PoPoPoPo );
147 }
148
149 // printf 4PPPP or 4a3hhh
150 if ( syn->s1.PPPP[0] )
151 {
152 used += snprintf ( c + used, lmax - used, " 4%s", syn->s1.PPPP );
153 }
154 else if ( syn->s1.hhh[0] )
155 {
156 if ( syn->s1.a3[0] == 0 )
157 {
158 syn->s1.a3[0] = '/';
159 }
160 used += snprintf ( c + used, lmax - used, " 4%s%s", syn->s1.a3, syn->s1.hhh );
161 }
162
163 // printf 5appp
164 if ( syn->s1.a[0] || syn->s1.ppp[0] )
165 {
166 if ( syn->s1.a[0] == 0 )
167 {
168 syn->s1.a[0] = '/';
169 }
170 if ( syn->s1.ppp[0] == 0 )
171 {
172 strcpy ( syn->s1.ppp, "///" );
173 }
174 used += snprintf ( c + used, lmax - used, " 5%s%s", syn->s1.a, syn->s1.ppp );
175 }
176
177 // printf 6RRRtr
178 if ( syn->s1.tr[0] || syn->s1.RRR[0] )
179 {
180 if ( syn->s1.tr[0] == 0 )
181 {
182 syn->s1.tr[0] = '/';
183 }
184 if ( syn->s1.RRR[0] == 0 )
185 {
186 strcpy ( syn->s1.RRR, "///" );
187 }
188 used += snprintf ( c + used, lmax - used, " 6%s%s", syn->s1.RRR, syn->s1.tr );
189 }
190
191 if ( syn->s1.ww[0] || syn->s1.W1[0] || syn->s1.W2[0] )
192 {
193 if ( syn->s1.ww[0] == 0 )
194 {
195 strcpy ( syn->s1.ww, "//" );
196 }
197 if ( syn->s1.W1[0] == 0 )
198 {
199 strcpy ( syn->s1.W1, "/" );
200 }
201 if ( syn->s1.W2[0] == 0 )
202 {
203 strcpy ( syn->s1.W2, "/" );
204 }
205 used += snprintf ( c + used, lmax - used, " 7%s%s%s", syn->s1.ww, syn->s1.W1, syn->s1.W2 );
206 }
207
208 if ( ( syn->s1.Nh[0] && syn->s1.Nh[0] != '0' && syn->s1.Nh[0] != '/' ) ||
209 ( syn->s1.Cl[0] && syn->s1.Cl[0] != '0' && syn->s1.Cl[0] != '/' ) ||
210 ( syn->s1.Cm[0] && syn->s1.Cm[0] != '0' && syn->s1.Cm[0] != '/' ) ||
211 ( syn->s1.Ch[0] && syn->s1.Ch[0] != '0' && syn->s1.Ch[0] != '/' ) )
212 {
213 if ( syn->s1.Nh[0] == 0 )
214 {
215 strcpy ( syn->s1.Nh, "/" );
216 }
217 if ( syn->s1.Cl[0] == 0 )
218 {
219 strcpy ( syn->s1.Cl, "/" );
220 }
221 if ( syn->s1.Cm[0] == 0 )
222 {
223 strcpy ( syn->s1.Cm, "/" );
224 }
225 if ( syn->s1.Ch[0] == 0 )
226 {
227 strcpy ( syn->s1.Ch, "/" );
228 }
229 used += snprintf ( c + used, lmax - used, " 8%s%s%s%s", syn->s1.Nh, syn->s1.Cl, syn->s1.Cm, syn->s1.Ch );
230 }
231
232 if ( syn->s1.GG[0] )
233 {
234 used += snprintf ( c + used, lmax - used, " 9%s%s", syn->s1.GG, syn->s1.gg );
235 }
236 }
237 *sec1 = c + used;
238 return used;
239}
struct synop_sec1 s1
Definition: metsynop.h:298
char Cl[2]
Definition: metsynop.h:149
char ix[2]
Definition: metsynop.h:124
char UUU[4]
Definition: metsynop.h:135
char ff[4]
Definition: metsynop.h:129
char Ch[2]
Definition: metsynop.h:151
char PoPoPoPo[6]
Definition: metsynop.h:136
char fff[4]
Definition: metsynop.h:130
char ir[2]
Definition: metsynop.h:123
char hhh[4]
Definition: metsynop.h:139
char h[2]
Definition: metsynop.h:125
char sn1[2]
Definition: metsynop.h:131
char PPPP[6]
Definition: metsynop.h:137
char tr[2]
Definition: metsynop.h:143
char N[2]
Definition: metsynop.h:127
char a[2]
Definition: metsynop.h:140
char VV[4]
Definition: metsynop.h:126
char Cm[2]
Definition: metsynop.h:150
char sn2[2]
Definition: metsynop.h:133
char ppp[4]
Definition: metsynop.h:141
char GG[4]
Definition: metsynop.h:152
char ww[4]
Definition: metsynop.h:144
char Nh[2]
Definition: metsynop.h:148
char TdTdTd[4]
Definition: metsynop.h:134
char gg[4]
Definition: metsynop.h:153
char RRR[4]
Definition: metsynop.h:142
char a3[2]
Definition: metsynop.h:138
char W1[2]
Definition: metsynop.h:146
char dd[4]
Definition: metsynop.h:128
char TTT[4]
Definition: metsynop.h:132
char W2[2]
Definition: metsynop.h:147

References synop_sec1::a, synop_sec1::a3, synop_sec1::Ch, synop_sec1::Cl, synop_sec1::Cm, synop_sec1::dd, synop_sec1::ff, synop_sec1::fff, synop_sec1::GG, synop_sec1::gg, synop_sec1::h, synop_sec1::hhh, synop_sec1::ir, synop_sec1::ix, synop_chunks::mask, synop_sec1::N, synop_sec1::Nh, synop_sec1::PoPoPoPo, synop_sec1::ppp, synop_sec1::PPPP, synop_sec1::RRR, synop_chunks::s1, synop_sec1::sn1, synop_sec1::sn2, SYNOP_SEC1, synop_sec1::TdTdTd, synop_sec1::tr, synop_sec1::TTT, synop_sec1::UUU, synop_sec1::VV, synop_sec1::W1, synop_sec1::W2, and synop_sec1::ww.

Referenced by print_synop_report().

Here is the caller graph for this function:

◆ print_synop_sec2()

size_t print_synop_sec2 ( char **  sec2,
size_t  lmax,
struct synop_chunks syn 
)

Prints the synop section 2.

Parameters
sec2the pointer where to print section
lmaxmax length permited
synpointer to s atruct synop_chunks where the parse results are set
Returns
Used bytes

Definition at line 250 of file bufr2tac_print_synop.c.

251{
252 char *c = *sec2;
253 size_t used = 0;
254
255 if ( syn->mask & SYNOP_SEC2 )
256 {
257 // 222Dsvs
258 used += snprintf ( c + used, lmax - used, " 222" );
259 if ( syn->s2.Ds[0] )
260 {
261 used += snprintf ( c + used, lmax - used, "%s", syn->s2.Ds );
262 }
263 else
264 {
265 used += snprintf ( c + used, lmax - used, "/" );
266 }
267
268 if ( syn->s2.vs[0] )
269 {
270 used += snprintf ( c + used, lmax - used, "%s", syn->s2.vs );
271 }
272 else
273 {
274 used += snprintf ( c + used, lmax - used, "/" );
275 }
276
277 // printf 0ssTwTwTw
278 if ( syn->s2.TwTwTw[0] )
279 {
280 used += snprintf ( c + used, lmax - used, " 0%s%s", syn->s2.ss, syn->s2.TwTwTw );
281 }
282
283 if ( syn->s2.PwaPwa[0] || syn->s2.HwaHwa[0] )
284 {
285 if ( syn->s2.PwaPwa[0] )
286 {
287 used += snprintf ( c + used, lmax - used, " 1%s", syn->s2.PwaPwa );
288 }
289 else
290 {
291 used += snprintf ( c + used, lmax - used, " 1//" );
292 }
293
294 if ( syn->s2.HwaHwa[0] )
295 {
296 used += snprintf ( c + used, lmax - used, "%s", syn->s2.HwaHwa );
297 }
298 else
299 {
300 used += snprintf ( c + used, lmax - used, "//" );
301 }
302 }
303
304 if ( syn->s2.PwPw[0] || syn->s2.HwHw[0] )
305 {
306 if ( syn->s2.PwPw[0] )
307 {
308 used += snprintf ( c + used, lmax - used, " 2%s", syn->s2.PwPw );
309 }
310 else
311 {
312 used += snprintf ( c + used, lmax - used, " 2//" );
313 }
314
315 if ( syn->s2.HwHw[0] )
316 {
317 used += snprintf ( c + used, lmax - used, "%s", syn->s2.HwHw );
318 }
319 else
320 {
321 used += snprintf ( c + used, lmax - used, "//" );
322 }
323 }
324
325 if ( syn->s2.dw1dw1[0] || syn->s2.dw2dw2[0] )
326 {
327 if ( syn->s2.dw1dw1[0] )
328 {
329 used += snprintf ( c + used, lmax - used, " 3%s", syn->s2.dw1dw1 );
330 }
331 else
332 {
333 used += snprintf ( c + used, lmax - used, " 3//" );
334 }
335
336 if ( syn->s2.dw2dw2[0] )
337 {
338 used += snprintf ( c + used, lmax - used, "%s", syn->s2.dw2dw2 );
339 }
340 else
341 {
342 used += snprintf ( c + used, lmax - used, "//" );
343 }
344 }
345
346 if ( syn->s2.Pw1Pw1[0] || syn->s2.Hw1Hw1[0] )
347 {
348 if ( syn->s2.Pw1Pw1[0] )
349 {
350 used += snprintf ( c + used, lmax - used, " 4%s", syn->s2.Pw1Pw1 );
351 }
352 else
353 {
354 used += snprintf ( c + used, lmax - used, " 4//" );
355 }
356
357 if ( syn->s2.Hw1Hw1[0] )
358 {
359 used += snprintf ( c + used, lmax - used, "%s", syn->s2.Hw1Hw1 );
360 }
361 else
362 {
363 used += snprintf ( c + used, lmax - used, "//" );
364 }
365 }
366
367
368 if ( syn->s2.Pw2Pw2[0] || syn->s2.Hw2Hw2[0] )
369 {
370 if ( syn->s2.Pw2Pw2[0] )
371 {
372 used += snprintf ( c + used, lmax - used, " 5%s", syn->s2.Pw2Pw2 );
373 }
374 else
375 {
376 used += snprintf ( c + used, lmax - used, " 5//" );
377 }
378
379 if ( syn->s2.Hw2Hw2[0] )
380 {
381 used += snprintf ( c + used, lmax - used, "%s", syn->s2.Hw2Hw2 );
382 }
383 else
384 {
385 used += snprintf ( c + used, lmax - used, "//" );
386 }
387 }
388
389 if ( syn->s2.HwaHwaHwa[0] )
390 {
391 used += snprintf ( c + used, lmax - used, " 70%s", syn->s2.HwaHwaHwa );
392 }
393
394
395 if ( syn->s2.TbTbTb[0] )
396 {
397 used += snprintf ( c + used, lmax - used, " 8%s%s", syn->s2.sw, syn->s2.TbTbTb );
398 }
399
400 }
401 *sec2 = c + used;
402 return used;
403}
struct synop_sec2 s2
Definition: metsynop.h:299
char TwTwTw[6]
Definition: metsynop.h:168
char HwaHwaHwa[6]
Definition: metsynop.h:180
char Hw1Hw1[4]
Definition: metsynop.h:176
char Pw2Pw2[4]
Definition: metsynop.h:177
char PwaPwa[4]
Definition: metsynop.h:169
char dw2dw2[4]
Definition: metsynop.h:174
char vs[2]
Definition: metsynop.h:166
char HwHw[4]
Definition: metsynop.h:172
char TbTbTb[6]
Definition: metsynop.h:182
char HwaHwa[4]
Definition: metsynop.h:170
char dw1dw1[4]
Definition: metsynop.h:173
char ss[2]
Definition: metsynop.h:167
char sw[2]
Definition: metsynop.h:181
char Ds[2]
Definition: metsynop.h:165
char PwPw[4]
Definition: metsynop.h:171
char Hw2Hw2[4]
Definition: metsynop.h:178
char Pw1Pw1[4]
Definition: metsynop.h:175

References synop_sec2::Ds, synop_sec2::dw1dw1, synop_sec2::dw2dw2, synop_sec2::Hw1Hw1, synop_sec2::Hw2Hw2, synop_sec2::HwaHwa, synop_sec2::HwaHwaHwa, synop_sec2::HwHw, synop_chunks::mask, synop_sec2::Pw1Pw1, synop_sec2::Pw2Pw2, synop_sec2::PwaPwa, synop_sec2::PwPw, synop_chunks::s2, synop_sec2::ss, synop_sec2::sw, SYNOP_SEC2, synop_sec2::TbTbTb, synop_sec2::TwTwTw, and synop_sec2::vs.

Referenced by print_synop_report().

Here is the caller graph for this function:

◆ print_synop_sec3()

size_t print_synop_sec3 ( char **  sec3,
size_t  lmax,
struct synop_chunks syn 
)

Prints the synop section 3.

Parameters
sec3the pointer where to print section
lmaxmax length permited
synpointer to s atruct synop_chunks where the parse results are set
Returns
Used bytes

Definition at line 413 of file bufr2tac_print_synop.c.

414{
415 size_t i;
416 char *c = *sec3;
417 size_t used = 0, used0;
418
419 if ( syn->mask & SYNOP_SEC3 )
420 {
421 used += snprintf ( c + used, lmax - used, " 333" );
422
423 // init point to write info.
424 // in case we finally write nothing in this section
425 used0 = used;
426
427 // printf 0XoXoXoXo
428 if ( syn->s3.XoXoXoXo[0] && ( strstr ( syn->s3.XoXoXoXo,"///" ) == NULL ) )
429 {
430 if ( syn->s3.XoXoXoXo[0] == 0 )
431 {
432 syn->s3.XoXoXoXo[0] = '/';
433 }
434 if ( syn->s3.XoXoXoXo[1] == 0 )
435 {
436 syn->s3.XoXoXoXo[1] = '/';
437 }
438 if ( syn->s3.XoXoXoXo[2] == 0 )
439 {
440 syn->s3.XoXoXoXo[2] = '/';
441 }
442 if ( syn->s3.XoXoXoXo[3] == 0 )
443 {
444 syn->s3.XoXoXoXo[3] = '/';
445 }
446 used += snprintf ( c + used, lmax - used, " 0%s", syn->s3.XoXoXoXo );
447 }
448
449 // printf 1snxTxTxTx
450 if ( syn->s3.snx[0] )
451 {
452 used += snprintf ( c + used, lmax - used, " 1%s%s", syn->s3.snx, syn->s3.TxTxTx );
453 }
454
455 // printf 1snnTnTnTn
456 if ( syn->s3.snn[0] )
457 {
458 used += snprintf ( c + used, lmax - used, " 2%s%s", syn->s3.snn, syn->s3.TnTnTn );
459 }
460
461 // printf 3Ejjj
462 if ( syn->s3.E[0] || syn->s3.jjj[0] )
463 {
464 if ( syn->s3.E[0] == 0 )
465 {
466 syn->s3.E[0] = '/';
467 }
468 if ( syn->s3.jjj[0] == 0 )
469 {
470 strcpy ( syn->s3.jjj, "///" );
471 }
472 used += snprintf ( c + used, lmax - used, " 3%s%s", syn->s3.E, syn->s3.jjj );
473 }
474
475 // printf 4E1sss
476 if ( syn->s3.E1[0] || syn->s3.sss[0] )
477 {
478 if ( syn->s3.E1[0] == 0 )
479 {
480 syn->s3.E1[0] = '/';
481 }
482 if ( syn->s3.sss[0] == 0 )
483 {
484 strcpy ( syn->s3.sss, "///" );
485 }
486 if ( syn->s3.E1[0] != '/' || strcmp ( syn->s3.sss, "999" ) )
487 {
488 used += snprintf ( c + used, lmax - used, " 4%s%s", syn->s3.E1, syn->s3.sss );
489 }
490 }
491
492 /**** Radiation Sunshine gropus ***/
493
494 // print 55SSS
495 if ( syn->s3.SSS[0] )
496 {
497 if ( strcmp ( syn->s3.SSS, "///" ) )
498 {
499 used += snprintf ( c + used, lmax - used, " 55%s", syn->s3.SSS );
500 }
501 else if ( syn->s3.j524[0][0] || syn->s3.j524[1][0] ||
502 syn->s3.j524[2][0] || syn->s3.j524[3][0] ||
503 syn->s3.j524[4][0] || syn->s3.j524[5][0] ||
504 syn->s3.j524[6][0] )
505 {
506 used += snprintf ( c + used, lmax - used, " 55%s", syn->s3.SSS );
507 }
508
509 for ( i = 0; i < 7; i++ )
510 {
511 if ( syn->s3.j524[i][0] )
512 {
513 used += snprintf ( c + used, lmax - used, " %s%s", syn->s3.j524[i], syn->s3.FFFF24[i] );
514 }
515 }
516 }
517
518 // print 553SS
519 if ( syn->s3.SS[0] )
520 {
521 if ( strcmp ( syn->s3.SS, "//" ) )
522 {
523 used += snprintf ( c + used, lmax - used, " 553%s", syn->s3.SS );
524 }
525 else if ( syn->s3.j5[0][0] || syn->s3.j5[1][0] ||
526 syn->s3.j5[2][0] || syn->s3.j5[3][0] ||
527 syn->s3.j5[4][0] || syn->s3.j5[5][0] ||
528 syn->s3.j5[6][0] )
529 {
530 used += snprintf ( c + used, lmax - used, " 553%s", syn->s3.SS );
531 }
532
533 for ( i = 0; i < 7; i++ )
534 {
535 if ( syn->s3.j5[i][0] )
536 {
537 used += snprintf ( c + used, lmax - used, " %s%s", syn->s3.j5[i], syn->s3.FFFF[i] );
538 }
539 }
540 }
541
542 // print 55407
543 if ( syn->s3.FFFF407[0] )
544 {
545 used += snprintf ( c + used, lmax - used, " 55407 4%s", syn->s3.FFFF407 );
546 }
547
548 // print 55408
549 if ( syn->s3.FFFF408[0] )
550 {
551 used += snprintf ( c + used, lmax - used, " 55408 4%s", syn->s3.FFFF408 );
552 }
553
554 // print 55507
555 if ( syn->s3.FFFF507[0] )
556 {
557 used += snprintf ( c + used, lmax - used, " 55507 4%s", syn->s3.FFFF507 );
558 }
559
560 // print 55507
561 if ( syn->s3.FFFF508[0] )
562 {
563 used += snprintf ( c + used, lmax - used, " 55508 4%s", syn->s3.FFFF508 );
564 }
565
566 // print 56DlDmDh
567 if ( syn->s3.Dl[0] || syn->s3.Dm[0] || syn->s3.Dh[0] )
568 {
569 if ( syn->s3.Dl[0] == 0 )
570 {
571 syn->s3.Dl[0] = '/';
572 }
573 if ( syn->s3.Dm[0] == 0 )
574 {
575 syn->s3.Dm[0] = '/';
576 }
577 if ( syn->s3.Dh[0] == 0 )
578 {
579 syn->s3.Dh[0] = '/';
580 }
581
582 used += snprintf ( c + used, lmax - used, " 56%s%s%s", syn->s3.Dl, syn->s3.Dm, syn->s3.Dh );
583 }
584
585 // print 57CDeec
586 if ( syn->s3.Da[0] || syn->s3.ec[0] )
587 {
588 if ( syn->s3.Da[0] == 0 )
589 {
590 syn->s3.Da[0] = '/';
591 }
592 if ( syn->s3.ec[0] == 0 )
593 {
594 syn->s3.ec[0] = '/';
595 }
596
597 used += snprintf ( c + used, lmax - used, " 57%s%s%s", syn->s3.C, syn->s3.Da, syn->s3.ec );
598 }
599
600 // print 58ppp24 or 59ppo24
601 if ( syn->s3.ppp24[0] )
602 {
603 used += snprintf ( c + used, lmax - used, " 5%s%s", syn->s3.snp24, syn->s3.ppp24 );
604 }
605
606 // printf 6RRRtr
607 if ( syn->s3.tr[0] || syn->s3.RRR[0] )
608 {
609 if ( syn->s3.tr[0] == 0 )
610 {
611 syn->s3.tr[0] = '/';
612 }
613 if ( syn->s3.RRR[0] == 0 )
614 {
615 strcpy ( syn->s3.RRR, "///" );
616 }
617 used += snprintf ( c + used, lmax - used, " 6%s%s", syn->s3.RRR,syn->s3.tr );
618 }
619
620 if ( syn->s3.RRRR24[0] )
621 {
622 used += snprintf ( c + used, lmax - used, " 7%s", syn->s3.RRRR24 );
623 }
624
625 // additional cloud layers
626 for ( i = 0; i < 4 ; i++ )
627 {
628 if ( syn->s3.nub[i].hshs[0] )
629 {
630 if ( syn->s3.nub[i].Ns[0] == 0 && syn->s3.nub[i].C[0] == 0 )
631 {
632 used += snprintf ( c + used, lmax - used, " 8//%s", syn->s3.nub[i].hshs ); // Detected cloud but no anymore info
633 }
634 else
635 {
636 used += snprintf ( c + used, lmax - used, " 8" );
637 if ( syn->s3.nub[i].Ns[0] )
638 {
639 used += snprintf ( c + used, lmax - used, "%s", syn->s3.nub[i].Ns );
640 }
641 else
642 {
643 used += snprintf ( c + used, lmax - used, "/" );
644 }
645
646 if ( syn->s3.nub[i].C[0] )
647 {
648 used += snprintf ( c + used, lmax - used, "%s", syn->s3.nub[i].C );
649 }
650 else
651 {
652 used += snprintf ( c + used, lmax - used, "/" );
653 }
654
655 used += snprintf ( c + used, lmax - used, "%s", syn->s3.nub[i].hshs );
656
657 }
658 }
659 }
660
661 // additional info
662 for ( i = 0; i < syn->s3.d9.n && i < SYNOP_NMISC ; i++ )
663 {
664 if ( syn->s3.d9.misc[i].SpSp[0] && syn->s3.d9.misc[i].spsp[0] )
665 {
666 used += snprintf ( c + used, lmax - used, " %s%s", syn->s3.d9.misc[i].SpSp, syn->s3.d9.misc[i].spsp );
667 }
668 }
669
670
671 // aditional regional info
672 if ( syn->mask & SYNOP_SEC3_8 )
673 {
674 used += snprintf ( c + used, lmax - used, " 80000" );
675 for ( i = 0; i < SYNOP_NMISC; i++ )
676 {
677 if ( syn->s3.R8[i][0] || syn->s3.R8[i][0] || syn->s3.R8[i][0] || syn->s3.R8[i][0] )
678 {
679 if ( syn->s3.R8[i][0] == 0 )
680 {
681 syn->s3.R8[i][0] = '/';
682 }
683 if ( syn->s3.R8[i][1] == 0 )
684 {
685 syn->s3.R8[i][1] = '/';
686 }
687 if ( syn->s3.R8[i][2] == 0 )
688 {
689 syn->s3.R8[i][2] = '/';
690 }
691 if ( syn->s3.R8[i][3] == 0 )
692 {
693 syn->s3.R8[i][3] = '/';
694 }
695 used += snprintf ( c + used, lmax - used, " %ld%s", i, syn->s3.R8[i] );
696 }
697 }
698 }
699
700 if ( used != used0 )
701 {
702 *sec3 = c + used;
703 }
704 else
705 used = 0;
706
707 }
708 return used;
709}
#define SYNOP_SEC3_8
mask bit meaning optional/regional 8 part, section 3 for synop is solicited to or parsed with success
Definition: metsynop.h:69
#define SYNOP_NMISC
number of misc3 struct to store the parsed results of 9SpSpspsp groups
Definition: metsynop.h:84
struct misc3 misc[SYNOP_NMISC]
Definition: metsynop.h:210
size_t n
Definition: metsynop.h:209
char spsp[4]
Definition: metsynop.h:204
char SpSp[4]
Definition: metsynop.h:203
char hshs[4]
Definition: metsynop.h:194
char Ns[2]
Definition: metsynop.h:192
char C[2]
Definition: metsynop.h:193
struct synop_sec3 s3
Definition: metsynop.h:300
char Dh[2]
Definition: metsynop.h:249
char TnTnTn[4]
Definition: metsynop.h:226
char E[2]
Definition: metsynop.h:227
char Da[2]
Definition: metsynop.h:251
char FFFF408[6]
Definition: metsynop.h:240
char RRRR24[6]
Definition: metsynop.h:257
char SSS[4]
Definition: metsynop.h:237
char snp24[2]
Definition: metsynop.h:253
char j5[7][2]
Definition: metsynop.h:243
char XoXoXoXo[6]
Definition: metsynop.h:222
char tr[2]
Definition: metsynop.h:256
char RRR[4]
Definition: metsynop.h:255
char SS[4]
Definition: metsynop.h:238
char ec[2]
Definition: metsynop.h:252
char TxTxTx[4]
Definition: metsynop.h:224
char Dl[2]
Definition: metsynop.h:247
char FFFF[7][6]
Definition: metsynop.h:244
char FFFF507[6]
Definition: metsynop.h:241
char R8[SYNOP_NMISC][6]
Definition: metsynop.h:258
struct nub3 nub[SYNOP_NNUB]
Definition: metsynop.h:259
char sss[4]
Definition: metsynop.h:230
struct data9 d9
Definition: metsynop.h:260
char C[2]
Definition: metsynop.h:250
char FFFF407[6]
Definition: metsynop.h:239
char Dm[2]
Definition: metsynop.h:248
char ppp24[4]
Definition: metsynop.h:254
char snn[2]
Definition: metsynop.h:225
char E1[2]
Definition: metsynop.h:229
char j524[7][2]
Definition: metsynop.h:245
char FFFF24[7][6]
Definition: metsynop.h:246
char snx[2]
Definition: metsynop.h:223
char FFFF508[6]
Definition: metsynop.h:242
char jjj[4]
Definition: metsynop.h:228

References nub3::C, synop_sec3::C, synop_sec3::d9, synop_sec3::Da, synop_sec3::Dh, synop_sec3::Dl, synop_sec3::Dm, synop_sec3::E, synop_sec3::E1, synop_sec3::ec, synop_sec3::FFFF, synop_sec3::FFFF24, synop_sec3::FFFF407, synop_sec3::FFFF408, synop_sec3::FFFF507, synop_sec3::FFFF508, nub3::hshs, synop_sec3::j5, synop_sec3::j524, synop_sec3::jjj, synop_chunks::mask, data9::misc, data9::n, nub3::Ns, synop_sec3::nub, synop_sec3::ppp24, synop_sec3::R8, synop_sec3::RRR, synop_sec3::RRRR24, synop_chunks::s3, synop_sec3::snn, synop_sec3::snp24, synop_sec3::snx, misc3::SpSp, misc3::spsp, synop_sec3::SS, synop_sec3::sss, synop_sec3::SSS, SYNOP_NMISC, SYNOP_SEC3, SYNOP_SEC3_8, synop_sec3::TnTnTn, synop_sec3::tr, synop_sec3::TxTxTx, and synop_sec3::XoXoXoXo.

Referenced by print_synop_report().

Here is the caller graph for this function:

◆ print_synop_sec4()

size_t print_synop_sec4 ( char **  sec4,
size_t  lmax,
struct synop_chunks syn 
)

Prints the synop section 4.

Parameters
sec4the pointer where to print section
lmaxmax length permited
synpointer to s atruct synop_chunks where the parse results are set
Returns
Used bytes

Definition at line 719 of file bufr2tac_print_synop.c.

720{
721 char *c = *sec4;
722 size_t used = 0, used0;
723
724 if ( syn->mask & SYNOP_SEC5 )
725 {
726 used += snprintf ( c + used, lmax - used, " 444" );
727
728 // init point to write info.
729 // in case we finally write nothing in this section
730 used0 = used;
731
732 // printf N1C1H1H1Ct
733 if ( syn->s4.N1[0] || syn->s4.C1[0] || syn->s4.H1H1[0] || syn->s4.Ct[0] )
734 {
735 if ( syn->s4.N1[0] == 0 )
736 {
737 syn->s4.N1[0] = '/';
738 }
739 if ( syn->s4.C1[0] == 0 )
740 {
741 syn->s4.C1[0] = '/';
742 }
743 if ( syn->s4.Ct[0] == 0 )
744 {
745 syn->s4.Ct[0] = '/';
746 }
747 if ( syn->s4.H1H1[0] == 0 )
748 {
749 strcpy ( syn->s4.H1H1, "//" );
750 }
751 used += snprintf ( c + used, lmax - used, " %s%s%s%s", syn->s4.N1, syn->s4.C1, syn->s4.H1H1, syn->s4.Ct );
752 }
753
754 if ( used != used0 )
755 {
756 *sec4 = c + used;
757 }
758 else
759 used = 0;
760 }
761 return used;
762}
struct synop_sec4 s4
Definition: metsynop.h:301
char Ct[2]
Definition: metsynop.h:272
char H1H1[4]
Definition: metsynop.h:271
char C1[2]
Definition: metsynop.h:270
char N1[2]
Definition: metsynop.h:269

References synop_sec4::C1, synop_sec4::Ct, synop_sec4::H1H1, synop_chunks::mask, synop_sec4::N1, synop_chunks::s4, and SYNOP_SEC5.

Referenced by print_synop_report().

Here is the caller graph for this function:

◆ print_synop_sec5()

size_t print_synop_sec5 ( char **  sec5,
size_t  lmax,
struct synop_chunks syn 
)

Prints the synop section 5.

Parameters
sec5the pointer where to print section
lmaxmax length permited
synpointer to s atruct synop_chunks where the parse results are set
Returns
Used bytes

Definition at line 773 of file bufr2tac_print_synop.c.

774{
775 size_t i;
776 char *c = *sec5;
777 size_t used = 0, used0;
778
779 if ( syn->mask & SYNOP_SEC5 )
780 {
781 used += snprintf ( c + used, lmax - used, " 555" );
782
783 // init point to write info.
784 // in case we finally write nothing in this section
785 used0 = used;
786
787 // printf 6RRRtr
788 if ( syn->s5.tr[0] || syn->s5.RRR[0] )
789 {
790 if ( syn->s5.tr[0] == 0 )
791 {
792 syn->s5.tr[0] = '/';
793 }
794 if ( syn->s5.RRR[0] == 0 )
795 {
796 strcpy ( syn->s5.RRR, "///" );
797 }
798 used += snprintf ( c + used, lmax - used, " 6%s%s", syn->s5.RRR,syn->s5.tr );
799 }
800
801 // additional info
802 for ( i = 0; i < syn->s5.d9.n ; i++ )
803 {
804 used += snprintf ( c + used, lmax - used, " %s%s", syn->s5.d9.misc[i].SpSp, syn->s5.d9.misc[i].spsp );
805 }
806
807 if ( used != used0 )
808 {
809 *sec5 = c + used;
810 }
811 else
812 used = 0;
813 }
814 return used;
815}
struct synop_sec5 s5
Definition: metsynop.h:302
struct data9 d9
Definition: metsynop.h:286
char RRR[4]
Definition: metsynop.h:284
char tr[2]
Definition: metsynop.h:285

References synop_sec5::d9, synop_chunks::mask, data9::misc, data9::n, synop_sec5::RRR, synop_chunks::s5, misc3::SpSp, misc3::spsp, SYNOP_SEC5, and synop_sec5::tr.

Referenced by print_synop_report().

Here is the caller graph for this function: