bufr2synop 0.24.0
bufr2tac_x33.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 bufr2tac_x33.c
22 \brief decodes the descriptors with X = 33 (Quality data)
23*/
24#include "bufr2tac.h"
25
26/*!
27 \fn int buoy_parse_x33 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s )
28 \brief Parse a expanded descriptor with X = 33
29 \param b pointer to a struct \ref buoy_chunks where to set the results
30 \param s pointer to a struct \ref bufr2tac_subset_state where is stored needed information in sequential analysis
31
32 It returns 0 if success, 1 if problems when processing. If a descriptor is not processed returns 0 anyway
33*/
35{
36
38 return 0;
39
40
41 switch ( s->a->desc.y )
42 {
43 case 20: // 0 33 020. Quality control indication of followinf value
44 sprintf ( b->s0.Qt, "%d", s->ival );
45 b->mask |= BUOY_SEC1;
46 break;
47
48 case 21: // 0 33 021. Quality control of following value
49 sprintf ( b->s4.Qp, "%d", s->ival );
50 b->mask |= BUOY_SEC1;
51 break;
52
53 case 22: // 0 33 022. Quality of buoy satellite transmission
54 if ( s->ival == 0 )
55 {
56 if ( b->s0.Qt[0] == 0 )
57 sprintf ( b->s0.Qt, "1" );
58 if ( b->s1.Qd[0] == 0 )
59 sprintf ( b->s1.Qd, "1" );
60 if ( b->s2.Qd[0] == 0 )
61 sprintf ( b->s2.Qd, "1" );
62 }
63 if ( s->ival == 2 )
64 {
65 if ( b->s0.Qt[0] == 0 )
66 sprintf ( b->s0.Qt, "3" );
67 if ( b->s1.Qd[0] == 0 )
68 sprintf ( b->s1.Qd, "3" );
69 if ( b->s2.Qd[0] == 0 )
70 sprintf ( b->s2.Qd, "3" );
71 }
72 break;
73
74 case 23: // 0 33 023 . Quality of buoy location
75 sprintf ( b->s0.Ql, "%d", s->ival );
76 sprintf ( b->s4.QL, "%d", s->ival );
77 break;
78
79 case 27: // 0 33 027. Location quality class (range of ratiuos of 66% confidence)
80 sprintf ( b->s0.QA, "%d", s->ival );
81 sprintf ( b->s4.QA, "%d", s->ival );
82 break;
83
84 default:
85 if ( BUFR2TAC_DEBUG_LEVEL > 1 && (s->a->mask & DESCRIPTOR_VALUE_MISSING) == 0 )
86 bufr2tac_set_error ( s, 0, "syn_parse_x33()", "Descriptor not parsed" );
87 break;
88 }
89 return 0;
90}
91
92/*!
93 \fn int temp_parse_x33 ( struct temp_chunks *t, struct bufr2tac_subset_state *s )
94 \brief Parse a expanded descriptor with X = 33
95 \param t pointer to a struct \ref temp_chunks where to set the results
96 \param s pointer to a struct \ref bufr2tac_subset_state where is stored needed information in sequential analysis
97
98 It returns 0 if success, 1 if problems when processing. If a descriptor is not processed returns 0 anyway
99*/
101{
102
103 switch ( s->a->desc.y )
104 {
105 case 24: // 0 33 024. Station elevation quality mark (for mobile stations)
106 if ( s->a->mask & DESCRIPTOR_VALUE_MISSING )
107 {
108 strcpy ( t->a.s1.im, "/" );
109 strcpy ( t->b.s1.im, "/" );
110 strcpy ( t->c.s1.im, "/" );
111 strcpy ( t->d.s1.im, "/" );
112 return 0;
113 }
114
115 if ( s->ival >= 0 && s->ival < 9 )
116 {
117 sprintf ( t->a.s1.im, "%d", s->ival );
118 sprintf ( t->a.s1.im, "%d", s->ival );
119 sprintf ( t->a.s1.im, "%d", s->ival );
120 sprintf ( t->a.s1.im, "%d", s->ival );
121 }
122 else
123 {
124 strcpy ( t->a.s1.im, "/" );
125 strcpy ( t->b.s1.im, "/" );
126 strcpy ( t->c.s1.im, "/" );
127 strcpy ( t->d.s1.im, "/" );
128 }
129 break;
130 default:
131 if ( BUFR2TAC_DEBUG_LEVEL > 1 && (s->a->mask & DESCRIPTOR_VALUE_MISSING) == 0 )
132 bufr2tac_set_error ( s, 0, "temp_parse_x33()", "Descriptor not parsed" );
133 break;
134 }
135 return 0;
136}
int BUFR2TAC_DEBUG_LEVEL
Definition: bufr2tac.c:31
Include header file for binary bufr2tac.
int bufr2tac_set_error(struct bufr2tac_subset_state *s, int severity, char *origin, char *explanation)
int buoy_parse_x33(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 33.
Definition: bufr2tac_x33.c:34
int temp_parse_x33(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 33.
Definition: bufr2tac_x33.c:100
#define DESCRIPTOR_VALUE_MISSING
Bit mask for a missing value in a struct bufr_atom_data.
Definition: bufrdeco.h:140
#define BUOY_SEC1
mask bit meaning section 1 of buoy is solicited to or parsed with success
Definition: metbuoy.h:38
stores information needed to parse a sequential list of expanded descriptors for a subset
Definition: bufr2tac.h:246
struct bufr_atom_data * a
Definition: bufr2tac.h:249
uint32_t mask
Definition: bufrdeco.h:437
struct bufr_descriptor desc
Definition: bufrdeco.h:436
contains all possible substrings from a synop report is parsed with success
Definition: metbuoy.h:197
struct buoy_sec2 s2
Definition: metbuoy.h:203
int mask
Definition: metbuoy.h:198
struct buoy_sec1 s1
Definition: metbuoy.h:202
struct buoy_sec4 s4
Definition: metbuoy.h:205
struct buoy_sec0 s0
Definition: metbuoy.h:201
char Ql[2]
Definition: metbuoy.h:81
char Qt[2]
Definition: metbuoy.h:82
char QA[2]
Definition: metbuoy.h:83
char Qd[2]
Definition: metbuoy.h:91
char Qd[2]
Definition: metbuoy.h:112
char QL[2]
Definition: metbuoy.h:169
char Qp[2]
Definition: metbuoy.h:163
char QA[2]
Definition: metbuoy.h:170
struct temp_acd_sec1 s1
Definition: mettemp.h:455
char im[2]
Definition: mettemp.h:328
char im[2]
Definition: mettemp.h:355
struct temp_b_sec1 s1
Definition: mettemp.h:470
struct temp_acd_sec1 s1
Definition: mettemp.h:485
Store the whole TEMP report.
Definition: mettemp.h:511
struct temp_c c
Definition: mettemp.h:517
struct temp_d d
Definition: mettemp.h:518
struct temp_b b
Definition: mettemp.h:516
struct temp_a a
Definition: mettemp.h:515
struct temp_acd_sec1 s1
Definition: mettemp.h:500