bufr2synop 0.24.0
bufrdeco_print.c
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2013-2022 by Guillermo Ballester Valor *
3 * gbv@ogimet.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20/*!
21 \file bufrdeco_print.c
22 \brief file with the code to print data or any output from library decobufr
23 */
24#include "bufrdeco.h"
25
26/*!
27 \fn int sprint_sec0_info( char *target, size_t lmax, struct bufrdeco *b )
28 \brief Prints info from sec0
29 \param target string target
30 \param lmax available size in target
31 \param b pointer to the source struct \ref bufrdeco
32 \return If succeeded return 0, otherwise 1
33
34*/
35int sprint_sec0_info ( char *target, size_t lmax, struct bufrdeco *b )
36{
37 size_t used = 0;
38
39 bufrdeco_assert ( b != NULL );
40
41 if ( lmax == 0 || target == NULL )
42 {
43 snprintf ( b->error, sizeof ( b->error ), "%s(): Unspected NULL argument(s)\n", __func__ );
44 return 1;
45 }
46
47 if ( b->mask & BUFRDECO_OUTPUT_HTML )
48 return sprint_sec0_info_html ( target, lmax, b );
49
50 used += snprintf ( target + used, lmax - used, "#### SEC 0 INFO ###\n" );
51 used += snprintf ( target + used, lmax - used, "Bufr length: %5u\n", b->sec0.bufr_length );
52 used += snprintf ( target + used, lmax - used, "Bufr edition: %5u\n", b->sec0.edition );
53 return 0;
54}
55
56/*!
57 \fn int print_sec0_info(struct bufrdeco *b)
58 \brief Prints info from sec0
59 \param b pointer to the source struct \ref bufrdeco
60 \return If succeeded return 0
61*/
62int print_sec0_info ( struct bufrdeco *b )
63{
64 char caux[512];
65
66 bufrdeco_assert ( b != NULL );
67
68 caux[0] = 0;
69 sprint_sec0_info ( caux, 512, b );
70 printf ( "%s", caux );
71 return 0;
72}
73
74
75/*!
76 \fn int_bits sprint_sec1_info( char *target, size_t lmax, struct bufrdeco *b )
77 \brief Prints info from sec1
78 \param target string target
79 \param lmax available size in target
80 \param b pointer to the source struct \ref bufrdeco
81 \return If succeeded return 0, 1 otherwise
82*/
83int sprint_sec1_info ( char *target, size_t lmax, struct bufrdeco *b )
84{
85 size_t used = 0;
86
87 bufrdeco_assert ( b != NULL );
88
89 if ( lmax == 0 || target == NULL )
90 {
91 snprintf ( b->error, sizeof ( b->error ), "%s(): Unspected NULL argument(s)\n", __func__ );
92 return 1;
93 }
94
95 if ( b->mask & BUFRDECO_OUTPUT_HTML )
96 return sprint_sec1_info_html ( target, lmax, b );
97
98 used += snprintf ( target + used, lmax - used, "\n#### SEC 1 INFO ###\n" );
99 used += snprintf ( target + used, lmax - used, "Sec1 length: %5u\n", b->sec1.length );
100 used += snprintf ( target + used, lmax - used, "Bufr master table: %5u\n", b->sec1.master );
101 used += snprintf ( target + used, lmax - used, "Centre: %5u\n", b->sec1.centre );
102 used += snprintf ( target + used, lmax - used, "Sub-Centre: %5u\n", b->sec1.subcentre );
103 used += snprintf ( target + used, lmax - used, "Update sequence: %5u\n", b->sec1.update );
104 used += snprintf ( target + used, lmax - used, "Options: %5x\n", b->sec1.options );
105 used += snprintf ( target + used, lmax - used, "Category: %5u\n", b->sec1.category );
106 used += snprintf ( target + used, lmax - used, "Subcategory: %5u\n", b->sec1.subcategory );
107 used += snprintf ( target + used, lmax - used, "Sub-category local: %5u\n", b->sec1.subcategory_local );
108 used += snprintf ( target + used, lmax - used, "Master table version: %5u\n", b->sec1.master_version );
109 used += snprintf ( target + used, lmax - used, "Master table local: %5u\n", b->sec1.master_local );
110 used += snprintf ( target + used, lmax - used, "Year: %5u\n", b->sec1.year );
111 used += snprintf ( target + used, lmax - used, "Month: %5u\n", b->sec1.month );
112 used += snprintf ( target + used, lmax - used, "Day: %5u\n", b->sec1.day );
113 used += snprintf ( target + used, lmax - used, "Hour: %5u\n", b->sec1.hour );
114 used += snprintf ( target + used, lmax - used, "Minute: %5u\n", b->sec1.minute );
115 used += snprintf ( target + used, lmax - used, "Second: %5u\n", b->sec1.second );
116 if ( b->sec0.edition == 3 )
117 used += snprintf ( target + used, lmax - used, "Aditional space: %5u\n", b->sec1.length - 17 );
118 else
119 used += snprintf ( target + used, lmax - used, "Aditional space: %5u\n", b->sec1.length - 22 );
120 if ( b->tables->b.path[0] )
121 {
122 used += snprintf ( target + used, lmax - used, "Tables used: '%s'\n", b->tables->b.path );
123 used += snprintf ( target + used, lmax - used, " '%s'\n", b->tables->c.path );
124 used += snprintf ( target + used, lmax - used, " '%s'\n", b->tables->d.path );
125 }
126 return 0;
127}
128
129/*!
130 \fn int print_sec1_info(struct bufrdeco *b)
131 \brief Prints info from sec1
132 \param b pointer to the source struct \ref bufrdeco
133 \return If succeeded return 0, 1 otherwise
134*/
135int print_sec1_info ( struct bufrdeco *b )
136{
137 char caux[2048];
138
139 bufrdeco_assert ( b != NULL );
140
141 caux[0] = 0;
142 sprint_sec1_info ( caux, 2048, b );
143 printf ( "%s", caux );
144 return 0;
145}
146
147/*!
148 \fn int sprint_sec3_info( char *target, size_t lmax, struct bufrdeco *b )
149 \brief Prints info from sec3
150 \param target string target
151 \param lmax available size in target
152 \param b pointer to the source struct \ref bufrdeco
153 \return If succeeded return 0, 1 otherwise
154*/
155int sprint_sec3_info ( char *target, size_t lmax, struct bufrdeco *b )
156{
157 size_t i;
158 size_t used = 0;
159
160 bufrdeco_assert ( b != NULL );
161
162 if ( lmax == 0 || target == NULL)
163 {
164 snprintf ( b->error, sizeof ( b->error ), "%s(): Unspected NULL argument(s)\n", __func__ );
165 return 1;
166 }
167
168 if ( b->mask & BUFRDECO_OUTPUT_HTML )
169 return sprint_sec3_info_html ( target, lmax, b );
170
171 used += snprintf ( target + used, lmax - used, "\n#### SEC 3 INFO ###\n" );
172 used += snprintf ( target + used, lmax - used, "Sec3 length: %5u\n", b->sec3.length );
173 used += snprintf ( target + used, lmax - used, "Subsets: %5u\n", b->sec3.subsets );
174 used += snprintf ( target + used, lmax - used, "Observed: %5u\n", b->sec3.observed );
175 used += snprintf ( target + used, lmax - used, "Compressed: %5u\n", b->sec3.compressed );
176 used += snprintf ( target + used, lmax - used, "Unexpanded descriptors %5u\n", b->sec3.ndesc );
177
178 for ( i = 0; i < b->sec3.ndesc; i++ )
179 {
180 used += snprintf ( target + used, lmax - used, " %3lu: %u %02u %03u\n", i, b->sec3.unexpanded[i].f,
181 b->sec3.unexpanded[i].x, b->sec3.unexpanded[i].y );
182 }
183 return 0;
184}
185
186/*!
187 \fn int print_sec3_info(struct bufrdeco *b)
188 \brief Prints info from sec3
189 \param b pointer to the source struct \ref bufrdeco
190 \return If succeeded return 0
191*/
192int print_sec3_info ( struct bufrdeco *b )
193{
194 char caux[8192];
195
196 bufrdeco_assert ( b != NULL );
197
198 caux[0] = 0;
199 sprint_sec3_info ( caux, 8192, b );
200 printf ( "%s", caux );
201 return 0;
202}
203
204
205/*!
206 \fn int sprint_sec4_info( char *target, size_t lmax, struct bufrdeco *b )
207 \brief Prints info from sec4
208 \param target string target
209 \param lmax available size in target
210 \param b pointer to the source struct \ref bufrdeco
211 \return If succeeded return 0, 1 otherwise
212*/
213int sprint_sec4_info ( char *target, size_t lmax, struct bufrdeco *b )
214{
215 size_t used = 0;
216
217 bufrdeco_assert ( b != NULL );
218
219 if ( lmax == 0 || target == NULL )
220 {
221 snprintf ( b->error, sizeof ( b->error ), "%s(): Unspected NULL argument(s)\n", __func__ );
222 return 1;
223 }
224
225 if ( b->mask & BUFRDECO_OUTPUT_HTML )
226 return sprint_sec4_info_html ( target, lmax, b );
227
228 used += snprintf ( target + used, lmax - used, "\n#### SEC 4 INFO ###\n" );
229 used += snprintf ( target + used, lmax - used, "Sec4 length: %5u\n\n", b->sec4.length );
230 return 0;
231}
232
233/*!
234 \fn int print_sec4_info(struct bufrdeco *b)
235 \brief Prints info from sec3
236 \param b pointer to the source struct \ref bufrdeco
237 \return If succeeded return 0
238*/
239int print_sec4_info ( struct bufrdeco *b )
240{
241 char caux[8192];
242
243 bufrdeco_assert ( b != NULL );
244
245 caux[0] = 0;
246 sprint_sec4_info ( caux, 8192, b );
247 printf ( "%s", caux );
248 return 0;
249}
250
251/*!
252 \fn int bufrdeco_fprint_tree_recursive ( FILE *f, struct bufrdeco *b, struct bufr_sequence *seq )
253 \brief Print a tree of descriptors to a file in a recursive way
254 \param f Pointer to file opened by caller
255 \param b pointer to the basic container struct \ref bufrdeco
256 \param seq pointer to the struct \ref bufr_sequence to print
257 \return If succeded return 0, else return 1
258*/
259int bufrdeco_fprint_tree_recursive ( FILE *f, struct bufrdeco *b, struct bufr_sequence *seq )
260{
261 buf_t i, j, k;
262 struct bufr_sequence *l;
263 char explanation[256];
264
265 bufrdeco_assert ( f != NULL && b != NULL );
266
267 if ( seq == NULL )
268 {
269 l = & ( b->tree->seq[0] );
270 }
271 else
272 {
273 l = seq;
274 }
275
276 for ( i = 0; i < l->ndesc; i++ )
277 {
278 // we search for descriptors with f == 3
279
280 for ( j = 0; j < l->level; j++ )
281 {
282 fprintf ( f, " |" );
283 }
284 fprintf ( f, "%u %02u %03u", l->lseq[i].f, l->lseq[i].x,l->lseq[i].y );
285
286 if ( l->lseq[i].f != 3 )
287 {
288 if ( l->lseq[i].f == 0 )
289 {
290 if ( bufr_find_tableB_index ( &k, & ( b->tables->b ), l->lseq[i].c ) )
291 fprintf ( f, "\n" );
292 else
293 {
294 fprintf ( f, ":" );
295 if ( l->replicated[i] )
296 {
297 //fprintf ( f, " " );
298 for ( j = 0; j < l->replicated[i] ; j++ )
299 fprintf ( f, "*" );
300 }
301 if ( is_a_delayed_descriptor ( & l->lseq[i] ) ||
303 fprintf ( f, "* %s\n", b->tables->b.item[k].name );
304 else
305 fprintf ( f, " %s\n", b->tables->b.item[k].name );
306 }
307 }
308 else if ( l->lseq[i].f == 2 )
309 {
310 fprintf ( f, ": %s\n", bufrdeco_get_f2_descriptor_explanation ( explanation, sizeof ( explanation ), & ( l->lseq[i] ) ) );
311 }
312 else if ( l->lseq[i].f == 1 )
313 {
314 if ( l->lseq[i].y == 0 )
315 {
316 if ( l->lseq[i].x == 1 )
317 fprintf ( f, ":* Replicator for %d descriptor after next delayed descriptor which set the number of replications.\n", l->lseq[i].x );
318 else
319 fprintf ( f, ":* Replicator for %d descriptors after next delayed descriptor which set the number of replications.\n", l->lseq[i].x );
320 }
321 else
322 {
323 if ( l->lseq[i].x == 1 )
324 fprintf ( f, ":* Replicator for next descriptor %d times\n", l->lseq[i].y );
325 else
326 fprintf ( f, ":* Replicator for next %d descriptors %d times\n", l->lseq[i].x, l->lseq[i].y );
327 }
328 }
329 else
330 fprintf ( f, "\n" );
331 continue;
332 }
333
334 // we then recursively parse the son
335 if ( l->replicated[i] )
336 {
337 fprintf ( f, ":" );
338 for ( j = 0; j < l->replicated[i] ; j++ )
339 fprintf ( f, "*" );
340 }
341
342 fprintf ( f, "-> %s\n", l->sons[i]->name );
343 if ( bufrdeco_fprint_tree_recursive ( f, b, l->sons[i] ) )
344 {
345 return 1;
346 }
347
348 }
349
350 return 0;
351}
352
353/*!
354 \fn int bufrdeco_fprint_tree ( FILE *f, struct bufrdeco *b )
355 \brief Print a tree of descriptors
356 \param f Pointer to file opened by caller
357 \param b pointer to a basic container struct \ref bufrdeco
358 \return If succeeded return 0
359*/
360int bufrdeco_fprint_tree ( FILE *f, struct bufrdeco *b )
361{
362 bufrdeco_assert ( f != NULL && b != NULL );
363
364 if ( b->mask & BUFRDECO_OUTPUT_HTML )
365 fprintf ( f, "<pre>\n" );
366 bufrdeco_fprint_tree_recursive ( f, b, NULL );
367 if ( b->mask & BUFRDECO_OUTPUT_HTML )
368 fprintf ( f, "</pre>\n" );
369 else
370 fprintf ( f, "\n" );
371 return 0;
372};
373
374
375/*!
376 \fn int bufrdeco_print_tree ( struct bufrdeco *b )
377 \brief Print a tree of descriptors
378 \param b pointer to a basic container struct \ref bufrdeco
379 \return If succeeded return 0
380*/
382{
383 bufrdeco_assert ( b != NULL );
384
385 if ( b->mask & BUFRDECO_OUTPUT_HTML )
386 printf ( "<pre>\n" );
387 bufrdeco_fprint_tree_recursive ( stdout, b, NULL );
388 if ( b->mask & BUFRDECO_OUTPUT_HTML )
389 printf ( "</pre>\n" );
390 else
391 printf ( "\n" );
392 return 0;
393};
394
395
396/*!
397 \fn int bufrdeco_print_atom_data_file ( FILE *f, struct bufr_atom_data *a )
398 \brief print the data in a struct \ref bufr_atom_data to a file already open by caller
399 \param f Pointer to file opened by caller
400 \param a pointer to struct ref \ref bufr_atom_data with data to print
401 \return If succeeded return 0
402*/
404{
405 char aux[1024];
406 bufrdeco_assert ( f != NULL && a != NULL );
407
408 bufrdeco_print_atom_data ( aux, sizeof ( aux ), a );
409 fprintf ( f, "%s\n",aux );
410 return 0;
411}
412
413/*!
414 \fn int bufrdeco_print_atom_data_stdout ( struct bufr_atom_data *a )
415 \brief print the data in a struct \ref bufr_atom_data to stdout
416 \param a pointer to struct ref \ref bufr_atom_data with data to print
417 \return If succeeded return 0
418*/
420{
421 return bufrdeco_print_atom_data_file ( stdout, a );
422}
423
424/*!
425 \fn char * bufrdeco_print_atom_data ( char *target, size_t lmax, struct bufr_atom_data *a )
426 \brief print the data in a struct \ref bufr_atom_data to a string
427 \param target string where to print the result
428 \param lmax size of allocated string \a target
429 \param a pointer to struct ref \ref bufr_atom_data with data to print
430
431 \return a pointer to result string
432*/
433char * bufrdeco_print_atom_data ( char *target, size_t lmax, struct bufr_atom_data *a )
434{
435 char aux[256];
436 size_t used = 0;
437 size_t nlimit, climit;
438
439 bufrdeco_assert ( a != NULL && target != NULL );
440
441 used += snprintf ( target + used, lmax - used, "%u %02u %03u ", a->desc.f, a->desc.x, a->desc.y );
442 strcpy_safe ( aux, a->name );
443 aux[64] = '\0';
444 used += snprintf ( target + used, lmax - used, "%-64s ", aux );
445 strcpy_safe ( aux, a->unit );
446 aux[20] = '\0';
447 used += snprintf ( target + used, lmax - used, "%-20s", aux );
449 {
450 used += snprintf ( target + used, lmax - used, "%17s", "MISSING" );
451 }
452 else
453 {
455 {
456 strcpy_safe ( aux, a->cval );
457 aux[64] = '\0';
458 used += snprintf ( target + used, lmax - used, " " );
459 used += snprintf ( target + used, lmax - used, "%s", aux );
460 }
462 || strstr ( a->unit, "CODE TABLE" ) == a->unit
463 || strstr ( a->unit, "Code table" ) == a->unit )
464 {
465 strcpy_safe ( aux, a->ctable );
466 aux[64] = '\0';
467 used += snprintf ( target + used, lmax - used, "%17u ", ( uint32_t ) a->val );
468 used += snprintf ( target + used, lmax - used, "%s", aux );
469 }
471 {
472 strcpy_safe ( aux, a->ctable );
473 aux[64] = '\0';
474 used += snprintf ( target + used, lmax - used, " 0x%08X ", ( uint32_t ) a->val );
475 used += snprintf ( target + used, lmax - used, "%s", aux );
476 }
477 else
478 {
479 used += snprintf ( target + used, lmax - used, "%s ", get_formatted_value_from_escale ( aux, sizeof ( aux ), a->escale, a->val ) );
480 }
481
482 }
483
484 // Now print remaining chars in a->name or a->ctable
485 nlimit = 64;
486 climit = 64;
487 while ( ( strlen ( a->name ) > nlimit && nlimit < BUFR_TABLEB_NAME_LENGTH ) ||
488 ( strlen ( a->ctable ) > climit && climit < BUFR_EXPLAINED_LENGTH ) )
489 {
490 aux[0] = 0;
491 if ( strlen ( a->name ) > nlimit && nlimit < BUFR_TABLEB_NAME_LENGTH )
492 strncpy ( aux, a->name + nlimit, 64 );
493 used += snprintf ( target + used, lmax - used, "\n %-64s", aux );
494 aux[0] = 0;
495 if ( strlen ( a->ctable ) > climit && climit < BUFR_EXPLAINED_LENGTH )
496 strncpy ( aux, a->ctable + climit, 64 );
497 used += snprintf ( target + used, lmax - used, " %s", aux );
498 nlimit += 64;
499 climit += 64;
500 }
501
502 if ( a->is_bitmaped_by != 0 )
503 used += snprintf ( target + used, lmax - used, " *IS BITMAPED BY #%u*", a->is_bitmaped_by );
504
505 if ( a->bitmap_to != 0 )
506 used += snprintf ( target + used, lmax - used, " *BITMAP TO #%u*", a->bitmap_to );
507
508 if ( a->related_to != 0 )
509 used += snprintf ( target + used, lmax - used, " *RELATED TO #%u*", a->related_to );
510
511 return target;
512}
513
514/*!
515 \fn int bufrdeco_fprint_subset_sequence_data ( struct bufrdeco_subset_sequence_data *s )
516 \brief Prints a struct \ref bufrdeco_subset_sequence_data
517 \param s pointer to the struct to print
518 \return If succeeded return 0
519*/
521{
522 size_t i;
523 char aux[1024];
524
525 bufrdeco_assert ( f != NULL && s != NULL);
526
527 for ( i = 0; i < s->nd ; i++ )
528 {
529 if ( i && s->sequence[i].seq != s->sequence[i - 1].seq )
530 fprintf ( f, "\n" );
531
532 fprintf ( f, "%5lu: %s\n", i, bufrdeco_print_atom_data ( aux, sizeof ( aux ), &s->sequence[i] ) );
533 }
534 return 0;
535
536}
537
538
539/*!
540 \fn int bufrdeco_print_subset_sequence_data ( struct bufrdeco_subset_sequence_data *s )
541 \brief Prints a struct \ref bufrdeco_subset_sequence_data
542 \param s pointer to the struct to print
543 \return If succeeded return 0
544*/
546{
547 bufrdeco_assert ( s != NULL );
548 return bufrdeco_fprint_subset_sequence_data ( stdout, s );
549}
550
551/*!
552 \fn int fprint_bufrdeco_compressed_ref ( FILE *f, struct bufrdeco_compressed_ref *r )
553 \brief prints a struct bufrdeco_compressed_ref
554 \param f pointer to a file opened by caller
555 \param r pointer to the struct to print
556 \return If succeeded return 0
557*/
559{
560 bufrdeco_assert ( f != NULL && r != NULL );
561
563 return 0;
564
565 fprintf ( f, "%s -> A=%u, D=%u, ",r->desc->c,r->is_associated,r->has_data );
566 if ( r->cref0[0] == '\0' )
567 {
568 fprintf ( f, "bits=%2u, ref=%10d, escale=%3d,", r->bits, r->ref, r->escale );
569 fprintf ( f, " bit0=%10u, ref0=%10u, inc_bits=%2u ", r->bit0, r->ref0, r->inc_bits );
570 fprintf ( f, "%s %s\n",r->name, r->unit );
571 }
572 else
573 {
574 fprintf ( f, "'%s', chars=%3u\n", r->cref0, r->inc_bits );
575 }
576 return 0;
577}
578
579/*!
580 \fn int print_bufrdeco_compressed_ref ( struct bufrdeco_compressed_ref *r )
581 \brief prints a struct bufrdeco_compressed_ref
582 \param r pointer to the struct to print
583 \return If succeeded return 0
584*/
586{
587 bufrdeco_assert ( r != NULL );
588
589 return fprint_bufrdeco_compressed_ref ( stdout, r );
590}
591
592/*!
593 \fn int print_bufrdeco_compressed_data_references ( struct bufrdeco_compressed_data_references *r )
594 \brief prints a struct bufrdeco_compressed_references
595 \param r pointer to the struct to print
596 \return If succeeded return 0, 1 otherwise
597
598 It is used mainly in debug stage
599*/
601{
602 size_t i;
603 bufrdeco_assert ( r != NULL );
604
605 for ( i = 0; i < r->nd; i++ )
607
608 return 0;
609}
610
611/*!
612 \fn int fprint_bufrdeco_compressed_data_references ( struct bufrdeco_compressed_data_references *r )
613 \brief prints a struct bufrdeco_compressed_references
614 \param r pointer to the struct to print
615 \return If succeeded return 0, 1 otherwise
616
617 It is used mainly in debug stage
618*/
620{
621 size_t i;
622
623 bufrdeco_assert ( f != NULL && r != NULL);
624
625 for ( i = 0; i < r->nd; i++ )
627
628 return 0;
629}
Include header file for bufrdeco library.
uint32_t buf_t
Type to set offsets and dimension of arrays or counters used in bufrdeco.
Definition: bufrdeco.h:346
#define bufrdeco_assert(__my_expr__)
Check a expression and exit if it fails.
Definition: bufrdeco.h:374
#define BUFR_EXPLAINED_LENGTH
Maximum length for a explained descriptor string.
Definition: bufrdeco.h:122
#define strcpy_safe(_target_, _src_)
Macro to make safely a strcpy when we know in calling function the size of string target with sizeof(...
Definition: bufrdeco.h:358
int bufr_find_tableB_index(buf_t *index, struct bufr_tableB *tb, const char *key)
found a descriptor index in a struct bufr_tableB
#define DESCRIPTOR_HAVE_FLAG_TABLE_STRING
Bit mask for a flag table string in a struct bufr_atom_data.
Definition: bufrdeco.h:170
int sprint_sec0_info_html(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec0 in html format.
int sprint_sec1_info_html(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec1.
#define BUFRDECO_COMPRESSED_REF_DATA_DESCRIPTOR_BITMASK
Bitmask for struct bufrdeco_compressed_ref which marks a data descriptor.
Definition: bufrdeco.h:611
#define DESCRIPTOR_HAVE_STRING_VALUE
Bit mask for a string in a struct bufr_atom_data.
Definition: bufrdeco.h:152
#define BUFRDECO_OUTPUT_HTML
Bit mask to the member mask for struct bufrdeco to format output as html for SECs 0 to 3.
Definition: bufrdeco.h:256
char * get_formatted_value_from_escale(char *fmt, size_t dim, int32_t escale, double val)
gets a string with formatted value depending of scale
int sprint_sec4_info_html(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec4.
int is_a_delayed_descriptor(struct bufr_descriptor *d)
check if a descriptor is a delayed descriptor
#define DESCRIPTOR_VALUE_MISSING
Bit mask for a missing value in a struct bufr_atom_data.
Definition: bufrdeco.h:140
int sprint_sec3_info_html(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec3 formatted as html.
#define BUFR_TABLEB_NAME_LENGTH
Max length (in chars) reserved for a name of variable in table B.
int is_a_short_delayed_descriptor(struct bufr_descriptor *d)
check if a descriptor is a short delayed descriptor
char * bufrdeco_get_f2_descriptor_explanation(char *e, size_t dim, struct bufr_descriptor *d)
Definition: bufrdeco_f2.c:773
#define DESCRIPTOR_HAVE_CODE_TABLE_STRING
Bit mask for a code table string in a struct bufr_atom_data.
Definition: bufrdeco.h:164
int bufrdeco_fprint_subset_sequence_data(FILE *f, struct bufrdeco_subset_sequence_data *s)
int fprint_bufrdeco_compressed_ref(FILE *f, struct bufrdeco_compressed_ref *r)
prints a struct bufrdeco_compressed_ref
int bufrdeco_print_subset_sequence_data(struct bufrdeco_subset_sequence_data *s)
Prints a struct bufrdeco_subset_sequence_data.
int sprint_sec4_info(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec4.
int sprint_sec3_info(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec3.
int fprint_bufrdeco_compressed_data_references(FILE *f, struct bufrdeco_compressed_data_references *r)
int print_bufrdeco_compressed_ref(struct bufrdeco_compressed_ref *r)
prints a struct bufrdeco_compressed_ref
int sprint_sec1_info(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec1.
int print_sec0_info(struct bufrdeco *b)
Prints info from sec0.
int bufrdeco_print_atom_data_stdout(struct bufr_atom_data *a)
print the data in a struct bufr_atom_data to stdout
int print_bufrdeco_compressed_data_references(struct bufrdeco_compressed_data_references *r)
prints a struct bufrdeco_compressed_references
int sprint_sec0_info(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec0.
int bufrdeco_fprint_tree(FILE *f, struct bufrdeco *b)
Print a tree of descriptors.
int print_sec3_info(struct bufrdeco *b)
Prints info from sec3.
char * bufrdeco_print_atom_data(char *target, size_t lmax, struct bufr_atom_data *a)
print the data in a struct bufr_atom_data to a string
int bufrdeco_print_tree(struct bufrdeco *b)
Print a tree of descriptors.
int print_sec4_info(struct bufrdeco *b)
Prints info from sec3.
int bufrdeco_print_atom_data_file(FILE *f, struct bufr_atom_data *a)
print the data in a struct bufr_atom_data to a file already open by caller
int bufrdeco_fprint_tree_recursive(FILE *f, struct bufrdeco *b, struct bufr_sequence *seq)
Print a tree of descriptors to a file in a recursive way.
int print_sec1_info(struct bufrdeco *b)
Prints info from sec1.
Contains all the information for a single data related with a descriptor in a expanded squence.
Definition: bufrdeco.h:435
int32_t escale
Definition: bufrdeco.h:441
uint32_t mask
Definition: bufrdeco.h:437
char name[BUFR_TABLEB_NAME_LENGTH]
Definition: bufrdeco.h:438
char ctable[BUFR_EXPLAINED_LENGTH]
Definition: bufrdeco.h:444
struct bufr_descriptor desc
Definition: bufrdeco.h:436
buf_t related_to
Definition: bufrdeco.h:449
double val
Definition: bufrdeco.h:440
buf_t is_bitmaped_by
Definition: bufrdeco.h:447
char unit[BUFR_TABLEB_UNIT_LENGTH]
Definition: bufrdeco.h:439
char cval[BUFR_CVAL_LENGTH]
Definition: bufrdeco.h:443
struct bufr_sequence * seq
Definition: bufrdeco.h:445
buf_t bitmap_to
Definition: bufrdeco.h:448
char c[12]
Definition: bufrdeco.h:414
uint8_t edition
Definition: bufrdeco.h:698
uint32_t bufr_length
Definition: bufrdeco.h:697
uint8_t month
Definition: bufrdeco.h:785
uint32_t year
Definition: bufrdeco.h:784
uint8_t master_local
Definition: bufrdeco.h:783
uint32_t subcentre
Definition: bufrdeco.h:776
uint32_t centre
Definition: bufrdeco.h:775
uint8_t category
Definition: bufrdeco.h:779
uint8_t options
Definition: bufrdeco.h:778
uint8_t minute
Definition: bufrdeco.h:788
uint8_t subcategory
Definition: bufrdeco.h:780
uint8_t master_version
Definition: bufrdeco.h:782
uint8_t second
Definition: bufrdeco.h:789
uint8_t day
Definition: bufrdeco.h:786
uint32_t length
Definition: bufrdeco.h:773
uint8_t subcategory_local
Definition: bufrdeco.h:781
uint8_t hour
Definition: bufrdeco.h:787
uint8_t update
Definition: bufrdeco.h:777
uint8_t master
Definition: bufrdeco.h:774
uint8_t observed
Definition: bufrdeco.h:811
uint8_t compressed
Definition: bufrdeco.h:812
struct bufr_descriptor unexpanded[BUFR_LEN_UNEXPANDED_DESCRIPTOR]
Definition: bufrdeco.h:814
uint32_t ndesc
Definition: bufrdeco.h:813
uint32_t length
Definition: bufrdeco.h:809
uint32_t subsets
Definition: bufrdeco.h:810
uint32_t length
Definition: bufrdeco.h:826
Stores an unexpanded sequence of descriptors.
Definition: bufrdeco.h:572
struct bufr_descriptor lseq[NMAXSEQ_DESCRIPTORS]
Definition: bufrdeco.h:583
buf_t ndesc
Definition: bufrdeco.h:575
uint8_t replicated[NMAXSEQ_DESCRIPTORS]
Definition: bufrdeco.h:582
buf_t level
Definition: bufrdeco.h:574
struct bufr_sequence * sons[NMAXSEQ_DESCRIPTORS]
Definition: bufrdeco.h:584
char name[BUFR_EXPLAINED_LENGTH]
Definition: bufrdeco.h:588
char name[BUFR_TABLEB_NAME_LENGTH]
Definition: bufrdeco.h:842
struct bufr_tableB_decoded_item item[BUFR_MAXLINES_TABLEB]
Definition: bufrdeco.h:867
char path[BUFRDECO_PATH_LENGTH]
Definition: bufrdeco.h:861
char path[BUFRDECO_PATH_LENGTH]
Definition: bufrdeco.h:893
char path[BUFRDECO_PATH_LENGTH]
Definition: bufrdeco.h:922
struct bufr_tableD d
Definition: bufrdeco.h:941
struct bufr_tableB b
Definition: bufrdeco.h:939
struct bufr_tableC c
Definition: bufrdeco.h:940
Manage an array of structs bufrdeco_compressed_ref.
Definition: bufrdeco.h:668
struct bufrdeco_compressed_ref * refs
Definition: bufrdeco.h:671
Struct to hold the needed reference bit offsets, descriptor tree and replications in a compressed BUF...
Definition: bufrdeco.h:639
char unit[BUFR_TABLEB_UNIT_LENGTH]
Definition: bufrdeco.h:651
char name[BUFR_TABLEB_NAME_LENGTH]
Definition: bufrdeco.h:650
struct bufr_descriptor * desc
Definition: bufrdeco.h:652
struct bufr_sequence seq[BUFR_MAX_EXPANDED_SEQUENCES]
Definition: bufrdeco.h:598
Contains all the information for a subset in a expanded squence This is a version to use with bufrdec...
Definition: bufrdeco.h:458
struct bufr_atom_data * sequence
Definition: bufrdeco.h:462
This struct contains all needed data to parse and decode a BUFR file.
Definition: bufrdeco.h:965
struct bufr_sec0 sec0
Definition: bufrdeco.h:968
uint32_t mask
Definition: bufrdeco.h:966
struct bufr_sec4 sec4
Definition: bufrdeco.h:972
struct bufr_tables * tables
Definition: bufrdeco.h:973
struct bufr_sec3 sec3
Definition: bufrdeco.h:971
struct bufrdeco_expanded_tree * tree
Definition: bufrdeco.h:975
char error[1024]
Definition: bufrdeco.h:983
struct bufr_sec1 sec1
Definition: bufrdeco.h:969