73 if ( s == NULL || r == NULL )
75 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Unspected NULL argument(s)\n", __func__ );
82 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Try to parse compressed data without parsed tree\n", __func__ );
181 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Unspected NULL argument(s)\n", __func__ );
217 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Cannot manage subset bit offset for subset %u. Consider increase BUFR_MAX_SUBSETS\n",
258 for ( i = 0, j = 0 ; i < seq->
ndesc ; i++ )
260 switch ( seq->
lseq[i].
f )
267 i <= seq->no_data_present.last )
270 if ( seq->
lseq[i].
x > 9 &&
271 seq->
lseq[i].
x != 31 )
273 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Getting data from table b with class other than 1-9,31 and no data present activated\n",
306 if ( seq->
lseq[i].
x == 31 && ( seq->
lseq[i].
y == 11 || seq->
lseq[i].
y == 12 ) )
322 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): No more space for first order statistic vars in bitmap. Check BUFR_MAX_QUALITY_DATA\n",
339 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): No more space for difference statistic vars in bitmap. Check BUFR_MAX_QUALITY_DATA\n",
352 if ( d->
nd < ( d->
dim - 1 ) )
362 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): No more bufr_atom_data available. Check BUFR_NMAXSEQ\n", __func__ );
370 replicator.
ixrep = i;
379 if ( seq->
lseq[i].
y != 0 )
382 replicator.
ixdel = i;
397 i += replicator.
ndesc;
402 replicator.
ixdel = i + 1;
428 if ( d->
nd < ( d->
dim - 1 ) )
439 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): No more bufr_atom_data available. Check BUFR_NMAXSEQ\n", __func__ );
447 i += replicator.
ndesc + 1;
483 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Found bad 'f' in descriptor '%s' \n", seq->
lseq[i].
c, __func__ );
520 if ( d == NULL || r == NULL )
523 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Unspected NULL argument(s)\n", __func__ );
528 for ( ixloop = 0; ixloop < r->
nloops; ixloop++ )
530 for ( ixd = 0; ixd < r->
ndesc ; ixd ++ )
533 snprintf(aux,
sizeof (aux),
"\"Replicated\":\"Descriptor %u/%u of loop %u/%u\"", ixd + 1, ixloop + 1, r->
ndesc, r->
nloops);
535 i = ixd + r->
ixdel + 1;
536 switch ( l->
lseq[i].
f )
542 i <= l->no_data_present.last )
545 if ( l->
lseq[i].
x > 9 &&
548 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Getting data from table b with class other than 1-9,31 and no data present activated\n", __func__ );
575 if ( l->
lseq[i].
x == 31 && ( l->
lseq[i].
y == 11 || l->
lseq[i].
y == 12 ) )
603 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): No more space for quality vars in bitmap. Check BUFR_MAX_QUALITY_DATA\n", __func__ );
623 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): No more space for first order statistic vars in bitmap. Check BUFR_MAX_QUALITY_DATA\n", __func__ );
643 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): No more space for difference statistic vars in bitmap. Check BUFR_MAX_QUALITY_DATA\n", __func__ );
650 if ( d->
nd < ( d->
dim - 1 ) )
660 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): No more bufr_atom_data available. Check BUFR_NMAXSEQ\n", __func__ );
668 replicator.
ixrep = i;
675 if ( l->
lseq[i].
y != 0 )
678 replicator.
ixdel = i;
682 ixd += replicator.
ndesc;
687 replicator.
ixdel = i + 1;
700 if ( d->
nd < ( d->
dim - 1 ) )
710 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): No more bufr_atom_data available. Check BUFR_NMAXSEQ\n", __func__ );
714 ixd += replicator.
ndesc + 1;
746 if ( d->
nd < ( d->
dim - 1 ) )
752 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Reached limit. Consider increas BUFR_NMAXSEQ\n", __func__ );
772 if ( d->
nd < ( d->
dim - 1 ) )
778 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Reached limit. Consider increas BUFR_NMAXSEQ\n", __func__ );
810 if ( d->
nd < ( d->
dim - 1 ) )
816 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Reached limit. Consider increas BUFR_NMAXSEQ\n", __func__ );
855 if ( d->
nd < ( d->
dim - 1 ) )
861 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Reached limit. Consider increas BUFR_NMAXSEQ\n", __func__ );
879 snprintf ( b->
error, sizeof ( b->
error ),
"%s(): Found bad 'f' in descriptor\n", __func__ );
Include header file for bufrdeco library.
#define BUFR_NMAXSEQ
Maximum expected descriptors in a expanded sequence for a single subset.
buf_t bufrdeco_print_json_subset_data_prologue(FILE *out, struct bufrdeco *b)
uint32_t buf_t
Type to set offsets and dimension of arrays or counters used in bufrdeco.
int bufrdeco_clean_bitmaps(struct bufrdeco *b)
Clean all allocated bitmaps, but still is in memory.
#define bufrdeco_assert(__my_expr__)
Check a expression and exit if it fails.
buf_t bufrdeco_print_json_separator(FILE *out)
Print the comma ',' separator in an output.
int bufrdeco_add_to_bitmap(struct bufrdeco_bitmap *bm, buf_t index_to, buf_t index_by)
Push a bitmap element in a bufrdeco_bitmap.
int bufrdeco_parse_f2_descriptor(struct bufrdeco_subset_sequence_data *s, struct bufr_descriptor *d, struct bufrdeco *b)
parse a descritor with f = 2
buf_t bufrdeco_print_json_object_operator_descriptor(FILE *out, struct bufr_descriptor *d, char *aux)
print an operator desciptor as a json object
#define BUFR_MAX_QUALITY_DATA
Max amount of quality data which is maped by a struct bufrdeco_bitmap element.
buf_t bufrdeco_print_json_sequence_descriptor_final(FILE *out)
buf_t bufrdeco_print_json_object_replicator_descriptor(FILE *out, struct bufr_descriptor *d, char *aux)
print an operator desciptor as a json object
#define BUFRDECO_OUTPUT_JSON_SUBSET_DATA
Bit mask to the member mask of struct bufrdeco to print bufr subset data in json format.
buf_t bufrdeco_print_json_sequence_descriptor_header(FILE *out, struct bufr_sequence *seq)
Print the header of a sequence descriptor (f == 3)
#define BUFR_MAX_SUBSETS
Max number of subsets in the array off bitoffset subset marks the bufrdeco library can manage.
buf_t bufrdeco_print_json_subset_data_epilogue(FILE *out)
int bufrdeco_parse_compressed(struct bufrdeco_compressed_data_references *r, struct bufrdeco *b)
Preliminary parse of a compressed data bufr.
int bufrdeco_clean_subset_sequence_data(struct bufrdeco_subset_sequence_data *ba)
Cleans a struct bufrdeco_subset_sequence_data.
int bufrdeco_tableB_val(struct bufr_atom_data *a, struct bufrdeco *b, struct bufr_descriptor *d)
Get data from a table B descriptor.
int bufr_decode_subset_data_compressed(struct bufrdeco_subset_sequence_data *s, struct bufrdeco_compressed_data_references *r, struct bufrdeco *b)
Get data for a given subset in a compressed data bufr.
buf_t bufrdeco_print_json_object_atom_data(FILE *out, struct bufr_atom_data *a, char *aux)
Print an json object with a descriptor data.
struct bufrdeco_subset_sequence_data * bufrdeco_get_subset_sequence_data(struct bufrdeco *b)
Parse and get a struct bufrdeco_subset_sequence_data.
int bufrdeco_increase_data_array(struct bufrdeco_subset_sequence_data *d)
doubles the allocated space for a struct bufrdeco_subset_sequence_data whenever is posible
int bufrdeco_decode_subset_data_recursive(struct bufrdeco_subset_sequence_data *d, struct bufr_sequence *l, struct bufrdeco *b)
decode the data from a subset in a recursive way
int bufrdeco_decode_replicated_subsequence(struct bufrdeco_subset_sequence_data *d, struct bufr_replicator *r, struct bufrdeco *b)
Decodes a replicated sequence.
int bufrdeco_decode_data_subset(struct bufrdeco *b)
User interface to decode a BUFR subset.
Contains all the information for a single data related with a descriptor in a expanded squence.
struct bufr_sequence * seq
store the information when parsing related to replicators
Stores an unexpanded sequence of descriptors.
struct bufr_descriptor lseq[NMAXSEQ_DESCRIPTORS]
struct bufr_sequence_index_range no_data_present
struct bufr_sequence * sons[NMAXSEQ_DESCRIPTORS]
struct bufrdeco_bitmap * bmap[BUFR_MAX_BITMAPS]
buf_t dstat_desc[BUFR_MAX_QUALITY_DATA]
buf_t stat1_desc[BUFR_MAX_QUALITY_DATA]
buf_t stat1[BUFR_MAX_QUALITY_DATA]
buf_t quality[BUFR_MAX_QUALITY_DATA]
buf_t bitmap_to[BUFR_MAX_BITMAP_PRESENT_DATA]
Manage an array of structs bufrdeco_compressed_ref.
uint8_t changing_reference
uint8_t local_bit_reserved
buf_t data_repetition_factor
struct bufrdeco_bitmap * bitmap
struct bufr_sequence seq[BUFR_MAX_EXPANDED_SEQUENCES]
buf_t ofs[BUFR_MAX_SUBSETS]
Contains all the information for a subset in a expanded squence This is a version to use with bufrdec...
struct bufr_atom_data * sequence
This struct contains all needed data to parse and decode a BUFR file.
struct bufrdeco_bitmap_array bitmap
struct bufrdeco_subset_sequence_data seq
struct bufrdeco_compressed_data_references refs
struct bufrdeco_subset_bit_offsets offsets
struct bufrdeco_decoding_data_state state
struct bufrdeco_expanded_tree * tree