bufr2synop 0.24.0
Functions
bufr2tac_x06.c File Reference

decodes the descriptors with X = 06 (Horizontal Position-2) More...

#include "bufr2tac.h"
Include dependency graph for bufr2tac_x06.c:

Go to the source code of this file.

Functions

char * latlon_to_MMM (char *target, double lat, double lon)
 convert latitude and longitude to a MMM string More...
 
int syn_parse_x06 (struct synop_chunks *syn, struct bufr2tac_subset_state *s)
 Parse a expanded descriptor with X = 06. More...
 
int buoy_parse_x06 (struct buoy_chunks *b, struct bufr2tac_subset_state *s)
 Parse a expanded descriptor with X = 06. More...
 
int climat_parse_x06 (struct climat_chunks *c, struct bufr2tac_subset_state *s)
 Parse a expanded descriptor with X = 06. More...
 
int temp_parse_x06 (struct temp_chunks *t, struct bufr2tac_subset_state *s)
 

Detailed Description

decodes the descriptors with X = 06 (Horizontal Position-2)

Definition in file bufr2tac_x06.c.

Function Documentation

◆ buoy_parse_x06()

int buoy_parse_x06 ( struct buoy_chunks b,
struct bufr2tac_subset_state s 
)

Parse a expanded descriptor with X = 06.

Parameters
bpointer to a struct buoy_chunks where to set the results
spointer to a struct bufr2tac_subset_state where is stored needed information in sequential analysis

It returns 0 if success, 1 if problems when processing. If a descriptor is not processed returns 0 anyway

Definition at line 129 of file bufr2tac_x06.c.

130{
131 int ia;
132
133 if ( s->a->mask & DESCRIPTOR_VALUE_MISSING )
134 return 0;
135
136 switch ( s->a->desc.y )
137 {
138 case 1: // 0 06 001 . Longitude (High accuracy)
139 case 2: // 0 06 002 . Longitude (Coarse accuracy)
140 if ( s->val < 0.0 )
141 s->mask |= SUBSET_MASK_LONGITUDE_WEST; // Sign for longitude
143 s->lon = s->val;
144 ia = ( int ) ( fabs ( s->val ) * 1000.0 + 0.5 );
145 sprintf ( b->s0.LoLoLoLoLoLo, "%06d",ia );
146 break;
147
148 default:
149 if ( BUFR2TAC_DEBUG_LEVEL > 1 && (s->a->mask & DESCRIPTOR_VALUE_MISSING) == 0 )
150 bufr2tac_set_error ( s, 0, "buoy_parse_x06()", "Descriptor not parsed" );
151 break;
152 }
153 return 0;
154}
int BUFR2TAC_DEBUG_LEVEL
Definition: bufr2tac.c:31
int bufr2tac_set_error(struct bufr2tac_subset_state *s, int severity, char *origin, char *explanation)
#define SUBSET_MASK_LONGITUDE_WEST
Bit mask to mark a struct bufr_subset_sequence_data with west longitude.
Definition: bufr2tac.h:80
#define SUBSET_MASK_HAVE_LONGITUDE
Bit mask to mark a struct bufr_subset_sequence_data having longitude.
Definition: bufr2tac.h:116
#define DESCRIPTOR_VALUE_MISSING
Bit mask for a missing value in a struct bufr_atom_data.
Definition: bufrdeco.h:140
struct bufr_atom_data * a
Definition: bufr2tac.h:249
uint32_t mask
Definition: bufrdeco.h:437
struct bufr_descriptor desc
Definition: bufrdeco.h:436
struct buoy_sec0 s0
Definition: metbuoy.h:201
char LoLoLoLoLoLo[8]
Definition: metbuoy.h:80

References bufr2tac_subset_state::a, BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, buoy_sec0::LoLoLoLoLoLo, bufr2tac_subset_state::lon, bufr_atom_data::mask, bufr2tac_subset_state::mask, buoy_chunks::s0, SUBSET_MASK_HAVE_LONGITUDE, SUBSET_MASK_LONGITUDE_WEST, bufr2tac_subset_state::val, and bufr_descriptor::y.

Referenced by parse_subset_as_buoy().

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

◆ climat_parse_x06()

int climat_parse_x06 ( struct climat_chunks c,
struct bufr2tac_subset_state s 
)

Parse a expanded descriptor with X = 06.

Parameters
cpointer to a struct climat_chunks where to set the results
spointer to a struct bufr2tac_subset_state where is stored needed information in sequential analysis

It returns 0 if success, 1 if problems when processing. If a descriptor is not processed returns 0 anyway

Definition at line 165 of file bufr2tac_x06.c.

166{
167 if ( s->a->mask & DESCRIPTOR_VALUE_MISSING )
168 return 0;
169
170 // this is to avoid warning
171 if ( c == NULL )
172 return 1;
173
174 switch ( s->a->desc.y )
175 {
176 case 1: // 0 06 001 . Longitude (High accuracy)
177 case 2: // 0 06 002 . Longitude (Coarse accuracy)
178 if ( s->val < 0.0 )
179 s->mask |= SUBSET_MASK_LONGITUDE_WEST; // Sign for longitude
181 s->lon = s->val;
182 break;
183
184 default:
185 if ( BUFR2TAC_DEBUG_LEVEL > 1 && (s->a->mask & DESCRIPTOR_VALUE_MISSING) == 0 )
186 bufr2tac_set_error ( s, 0, "climat_parse_x06()", "Descriptor not parsed" );
187 break;
188 }
189 return 0;
190}

References bufr2tac_subset_state::a, BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, bufr2tac_subset_state::lon, bufr_atom_data::mask, bufr2tac_subset_state::mask, SUBSET_MASK_HAVE_LONGITUDE, SUBSET_MASK_LONGITUDE_WEST, bufr2tac_subset_state::val, and bufr_descriptor::y.

Referenced by parse_subset_as_climat().

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

◆ latlon_to_MMM()

char * latlon_to_MMM ( char *  target,
double  lat,
double  lon 
)

convert latitude and longitude to a MMM string

Parameters
latlatitude (degree, N positive)
lonlongitude (degree, E positive)
targetresulting MMM string

Definition at line 34 of file bufr2tac_x06.c.

35{
36 int col, row, ori = 0;
37
38 if ( lon < 0.0 )
39 col = ( int ) ( -lat * 0.1 ) + 1;
40 else
41 col = 36 - ( int ) ( lat * 0.1 );
42
43
44 if ( lat >= 80.0 )
45 row = 25;
46 else if ( lat >= 0.0 )
47 row = ( int ) ( lat * 0.1 );
48 else
49 {
50 ori = 299;
51 row = ( int ) ( -lat * 0.1 );
52 }
53
54 sprintf ( target,"%03d", col + ori + row * 36 );
55
56 return target;
57}

Referenced by syn_parse_x05(), syn_parse_x06(), temp_parse_x05(), and temp_parse_x06().

Here is the caller graph for this function:

◆ syn_parse_x06()

int syn_parse_x06 ( struct synop_chunks syn,
struct bufr2tac_subset_state s 
)

Parse a expanded descriptor with X = 06.

Parameters
synpointer to a struct synop_chunks where to set the results
spointer to a struct bufr2tac_subset_state where is stored needed information in sequential analysis

It returns 0 if success, 1 if problems when processing. If a descriptor is not processed returns 0 anyway

Definition at line 67 of file bufr2tac_x06.c.

68{
69 int ia;
70
72 return 0;
73
74 switch ( s->a->desc.y )
75 {
76 case 1: // 0 06 001 . Longitude (High accuracy)
77 case 2: // 0 06 002 . Longitude (Coarse)
78 if ( s->val < 0.0 )
79 s->mask |= SUBSET_MASK_LONGITUDE_WEST; // Sign for longitude
81 ia = ( int ) ( fabs ( s->val ) * 10.0 + 0.5 );
82 sprintf ( syn->s0.LoLoLoLo, "%04d",ia );
83 syn->s0.Ulo[0] = syn->s0.LoLoLoLo[2];
84 s->lon = s->val;
85 break;
86
87 default:
88 if ( BUFR2TAC_DEBUG_LEVEL > 1 && (s->a->mask & DESCRIPTOR_VALUE_MISSING) == 0 )
89 bufr2tac_set_error ( s, 0, "syn_parse_x06()", "Descriptor not parsed" );
90 break;
91 }
92
93 // check if set both LaLaLa and LoLoLoLo to set Qc
94 if ( ( syn->s0.Qc[0] == 0 ) && syn->s0.LaLaLa[0] && syn->s0.LoLoLoLo[0] )
95 {
97 {
99 strcpy ( syn->s0.Qc, "5" );
100 else
101 strcpy ( syn->s0.Qc, "3" );
102 }
103 else
104 {
106 strcpy ( syn->s0.Qc, "7" );
107 else
108 strcpy ( syn->s0.Qc, "1" );
109 }
110 }
111
112 // check if about MMM
113 if ( ( syn->s0.MMM[0] == 0 ) && syn->s0.LaLaLa[0] && syn->s0.LoLoLoLo[0] )
114 {
115 latlon_to_MMM ( syn->s0.MMM, s->lat, s->lon );
116 }
117
118 return 0;
119}
#define SUBSET_MASK_LATITUDE_SOUTH
Bit mask to mark a struct bufr_subset_sequence_data with south latitude.
Definition: bufr2tac.h:74
char * latlon_to_MMM(char *target, double lat, double lon)
convert latitude and longitude to a MMM string
Definition: bufr2tac_x06.c:34
struct synop_sec0 s0
Definition: metsynop.h:297
char LaLaLa[4]
Definition: metsynop.h:105
char Qc[2]
Definition: metsynop.h:106
char LoLoLoLo[6]
Definition: metsynop.h:107
char Ulo[2]
Definition: metsynop.h:110
char MMM[4]
Definition: metsynop.h:108

References bufr2tac_subset_state::a, BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, synop_sec0::LaLaLa, bufr2tac_subset_state::lat, latlon_to_MMM(), synop_sec0::LoLoLoLo, bufr2tac_subset_state::lon, bufr_atom_data::mask, bufr2tac_subset_state::mask, synop_sec0::MMM, synop_sec0::Qc, synop_chunks::s0, SUBSET_MASK_HAVE_LONGITUDE, SUBSET_MASK_LATITUDE_SOUTH, SUBSET_MASK_LONGITUDE_WEST, synop_sec0::Ulo, bufr2tac_subset_state::val, and bufr_descriptor::y.

Referenced by parse_subset_as_synop().

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

◆ temp_parse_x06()

int temp_parse_x06 ( struct temp_chunks t,
struct bufr2tac_subset_state s 
)

Definition at line 200 of file bufr2tac_x06.c.

201{
202 int ia;
203
204 if ( s->a->mask & DESCRIPTOR_VALUE_MISSING )
205 return 0;
206
207 switch ( s->a->desc.y )
208 {
209 case 1: // 0 06 001 . Longitude (High accuracy)
210 case 2: // 0 06 002 . Longitude (Coarse)
211 if ( s->val < 0.0 )
212 s->mask |= SUBSET_MASK_LONGITUDE_WEST; // Sign for longitude
214 ia = ( int ) ( fabs ( s->val ) * 10.0 + 0.5 );
215 sprintf ( t->a.s1.LoLoLoLo, "%04d",ia );
216 sprintf ( t->b.s1.LoLoLoLo, "%04d",ia );
217 sprintf ( t->c.s1.LoLoLoLo, "%04d",ia );
218 sprintf ( t->d.s1.LoLoLoLo, "%04d",ia );
219 t->a.s1.Ulo[0] = t->a.s1.LoLoLoLo[2];
220 t->b.s1.Ulo[0] = t->b.s1.LoLoLoLo[2];
221 t->c.s1.Ulo[0] = t->c.s1.LoLoLoLo[2];
222 t->d.s1.Ulo[0] = t->d.s1.LoLoLoLo[2];
223 s->lon = s->val;
224
225 // check if set both LaLaLa and LoLoLoLo to set Qc
226 if ( ( t->a.s1.Qc[0] == 0 ) && t->a.s1.LaLaLa[0] && t->a.s1.LoLoLoLo[0] )
227 {
229 {
231 strcpy ( t->a.s1.Qc, "5" );
232 else
233 strcpy ( t->a.s1.Qc, "3" );
234 }
235 else
236 {
238 strcpy ( t->a.s1.Qc, "7" );
239 else
240 strcpy ( t->a.s1.Qc, "1" );
241 }
242 strcpy ( t->b.s1.Qc, t->a.s1.Qc );
243 strcpy ( t->c.s1.Qc, t->a.s1.Qc );
244 strcpy ( t->d.s1.Qc, t->a.s1.Qc );
245 }
246
247 // check if about MMM
248 if ( ( t->a.s1.MMM[0] == 0 ) && t->a.s1.LaLaLa[0] && t->a.s1.LoLoLoLo[0] )
249 {
250 latlon_to_MMM ( t->a.s1.MMM, s->lat, s->lon );
251 strcpy ( t->b.s1.MMM, t->a.s1.MMM );
252 strcpy ( t->c.s1.MMM, t->a.s1.MMM );
253 strcpy ( t->d.s1.MMM, t->a.s1.MMM );
254 }
255 break;
256
257 case 15: // 0 06 015. Longitude displacement since launch site (high accuracy)
258 if ( s->rep > 0 && s->r->n > 0 )
259 {
260 s->r->raw[s->r->n - 1].dlon = s->val;
261 }
262 else if ( s->w->n > 0 )
263 {
264 s->w->raw[s->w->n - 1].dlon = s->val;
265 }
266 break;
267
268 default:
269 if ( BUFR2TAC_DEBUG_LEVEL > 1 && (s->a->mask & DESCRIPTOR_VALUE_MISSING) == 0 )
270 bufr2tac_set_error ( s, 0, "temp_parse_x06()", "Descriptor not parsed" );
271 break;
272 }
273
274 return 0;
275}
struct temp_raw_wind_shear_data * w
Definition: bufr2tac.h:286
struct temp_raw_data * r
Definition: bufr2tac.h:285
struct temp_acd_sec1 s1
Definition: mettemp.h:455
char LoLoLoLo[6]
Definition: mettemp.h:323
char MMM[4]
Definition: mettemp.h:324
char LaLaLa[4]
Definition: mettemp.h:321
char Ulo[2]
Definition: mettemp.h:326
char Qc[2]
Definition: mettemp.h:322
char Qc[2]
Definition: mettemp.h:349
char MMM[4]
Definition: mettemp.h:351
char Ulo[2]
Definition: mettemp.h:353
char LoLoLoLo[6]
Definition: mettemp.h:350
struct temp_b_sec1 s1
Definition: mettemp.h:470
struct temp_acd_sec1 s1
Definition: mettemp.h:485
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
struct temp_raw_point_data raw[TEMP_NMAX_POINTS *4]
Definition: mettemp.h:215
size_t n
Definition: mettemp.h:214
struct temp_raw_wind_shear_point raw[TEMP_NMAX_POINTS]
Definition: mettemp.h:240

References bufr2tac_subset_state::a, temp_chunks::a, temp_chunks::b, BUFR2TAC_DEBUG_LEVEL, bufr2tac_set_error(), temp_chunks::c, temp_chunks::d, bufr_atom_data::desc, DESCRIPTOR_VALUE_MISSING, temp_raw_point_data::dlon, temp_raw_wind_shear_point::dlon, temp_acd_sec1::LaLaLa, bufr2tac_subset_state::lat, latlon_to_MMM(), temp_acd_sec1::LoLoLoLo, temp_b_sec1::LoLoLoLo, bufr2tac_subset_state::lon, bufr_atom_data::mask, bufr2tac_subset_state::mask, temp_acd_sec1::MMM, temp_b_sec1::MMM, temp_raw_data::n, temp_raw_wind_shear_data::n, temp_acd_sec1::Qc, temp_b_sec1::Qc, bufr2tac_subset_state::r, temp_raw_data::raw, temp_raw_wind_shear_data::raw, bufr2tac_subset_state::rep, temp_a::s1, temp_b::s1, temp_c::s1, temp_d::s1, SUBSET_MASK_HAVE_LONGITUDE, SUBSET_MASK_LATITUDE_SOUTH, SUBSET_MASK_LONGITUDE_WEST, temp_acd_sec1::Ulo, temp_b_sec1::Ulo, bufr2tac_subset_state::val, bufr2tac_subset_state::w, and bufr_descriptor::y.

Referenced by parse_subset_as_temp().

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