38 if ( strlen ( syn->
e.
YYYY ) &&
39 strlen ( syn->
e.
MM ) &&
40 strlen ( syn->
e.
DD ) &&
41 strlen ( syn->
e.
HH ) &&
42 strlen ( syn->
e.
mm ) )
44 sprintf ( aux,
"%s%s%s%s%s", syn->
e.
YYYY, syn->
e.
MM, syn->
e.
DD, syn->
e.
HH, syn->
e.
mm );
47 if ( strlen ( aux ) != 12 )
55 if ( c != NULL && c[0] && strlen ( c ) < 256 )
61 setenv (
"TZ",
"UTC", 1 );
64 memset ( &tim, 0,
sizeof (
struct tm ) );
65 strptime ( aux,
"%Y%m%d%H%M", &tim );
67 t = mktime ( &tim ) + 1799 ;
68 gmtime_r ( &t, &tim );
69 sprintf ( syn->
s0.
YY,
"%02d", tim.tm_mday );
70 sprintf ( syn->
s0.
GG,
"%02d", tim.tm_hour );
75 setenv (
"TZ", tz, 1 );
100 if ( syn->
s0.
II[0] == 0 || syn->
s0.
iii[0] == 0 )
134 sprintf ( err,
"bufr2tac: parse_subset_as_synop(): '%s' reports still not decoded in this software", s->
type_report );
146 for ( is = 0; is < sq->nd; is++ )
149 if ( sq->sequence[is].desc.x == 8 )
152 s->
a = &sq->sequence[is];
153 s->
ival = ( int ) sq->sequence[is].val;
154 s->
val = sq->sequence[is].val;
163 s->
ival = ( int ) ( sq->sequence[is].val );
164 s->
val = sq->sequence[is].val;
165 s->
a = &sq->sequence[is];
168 s->
a1 = &sq->sequence[is - 1];
171 switch ( sq->sequence[is].desc.x )
245 sprintf ( err,
"bufr2tac: %s(): lack of mandatory descriptor in sequence", __func__ );
258 strcpy ( syn->
s0.
II,
"00" );
259 strcpy ( syn->
s0.
iii,
"000" );
263 sprintf ( err,
"bufr2tac: %s(): lack of mandatory index station for AAXX report", __func__ );
276 else if ( syn->
s1.
RRR[0] == 0 && syn->
s3.
RRR[0] != 0 )
280 else if ( syn->
s1.
RRR[0] != 0 && syn->
s3.
RRR[0] == 0 )
290 if ( ( syn->
s1.
ww[0] || syn->
s1.
W1[0] || syn->
s1.
W2[0] ) &&
291 ( syn->
s1.
ww[0] == 0 || syn->
s1.
ww[0] ==
'/' || ( strcmp ( syn->
s1.
ww,
"04" ) < 0 ) ) &&
292 ( syn->
s1.
W1[0] == 0 || syn->
s1.
W1[0] ==
'/' || ( strcmp ( syn->
s1.
W1,
"3" ) < 0 ) ) &&
293 ( syn->
s1.
W2[0] == 0 || syn->
s1.
W2[0] ==
'/' || ( strcmp ( syn->
s1.
W2,
"3" ) < 0 ) ) )
299 if ( syn->
s1.
ix[0] ==
'1' )
306 if ( syn->
s0.
iw[0] ==
'/' && syn->
s1.
ff[0] !=
'/' )
312 if ( syn->
s1.
ix[0] ==
'/' )
323 strcpy ( syn->
s1.
ix,
"2" );
325 else if ( s->
type == 0 )
327 strcpy ( syn->
s1.
ix,
"5" );
332 strcpy ( syn->
s1.
ix,
"6" );
339 strcpy ( syn->
s1.
ix,
"3" );
341 else if ( s->
type == 0 )
343 strcpy ( syn->
s1.
ix,
"6" );
348 strcpy ( syn->
s1.
ix,
"6" );
354 ( syn->
s3.
j5[0][0] || syn->
s3.
j5[1][0] ||
355 syn->
s3.
j5[2][0] || syn->
s3.
j5[3][0] ||
356 syn->
s3.
j5[4][0] || syn->
s3.
j5[5][0] ||
359 sprintf ( syn->
s3.
SS,
"//" );
368 sprintf ( syn->
s3.
SSS,
"///" );
374 if ( syn->
e.
mm[0] == 0 )
375 sprintf ( syn->
e.
mm,
"00" );
377 if ( strcmp ( syn->
e.
mm,
"00" ) )
379 strcpy ( syn->
s1.
GG, syn->
e.
HH );
380 strcpy ( syn->
s1.
gg, syn->
e.
mm );
388 if ( strlen ( syn->
s0.
II ) )
393 else if ( strlen ( syn->
s0.
D_D ) )
397 else if ( strlen ( syn->
s0.
IIIII ) )
423 sprintf ( aux,
"%s%s%s%s%s", syn->
e.
YYYY, syn->
e.
MM, syn->
e.
DD, syn->
e.
HH, syn->
e.
mm );
Include header file for binary bufr2tac.
void bufr2tac_clean_synop_chunks(struct synop_chunks *s)
#define SUBSET_MASK_HAVE_MONTH
Bit mask to mark a struct bufr_subset_sequence_data having observation month.
int check_date_from_future(struct metreport *m)
Check a estructure metreport not from future.
#define SUBSET_MASK_HAVE_COUNTRY
Bit mask to mark a struct bufr_subset_sequence_data having country name.
int syn_parse_x04(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 04.
int syn_parse_x31(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 31.
int syn_parse_x11(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 11.
#define SUBSET_MASK_HAVE_NO_SIGNIFICANT_WW
Bit mask to mark a struct bufr_subset_sequence_data without WW information.
int syn_parse_x13(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 13.
char * guess_WMO_region(char *A1, char *Reg, const char *II, const char *iii)
get WMO region A1 and Reg items from II and iii (WMO index)
#define SUBSET_MASK_HAVE_MINUTE
Bit mask to mark a struct bufr_subset_sequence_data having observation minute.
#define SUBSET_MASK_HAVE_NAME
Bit mask to mark a struct bufr_subset_sequence_data having station name.
#define bufr_subset_sequence_data
To use bufrdeco library with legacy old code using ECMWF library which is not used currently.
int syn_parse_x06(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 06.
int syn_parse_x02(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 02.
#define SUBSET_MASK_HAVE_TYPE_STATION
Bit mask to mark a struct bufr_subset_sequence_data having type station information.
int syn_parse_x20(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 20.
#define SUBSET_MASK_HAVE_ALTITUDE
Bit mask to mark a struct bufr_subset_sequence_data having altitude.
int syn_parse_x01(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
int syn_parse_x12(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 12.
int syn_parse_x10(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 10.
int syn_parse_x08(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 08.
int syn_parse_x14(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 14.
#define SUBSET_MASK_HAVE_WIGOS_ID
Bit mask to mark if a subset has a WIGOS ID.
int syn_parse_x22(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
#define SUBSET_MASK_HAVE_YEAR
Bit mask to mark a struct bufr_subset_sequence_data having observation year.
int YYYYMMDDHHmm_to_met_datetime(struct met_datetime *t, const char *source)
Parse the string YYYYMMDDHHmm[ss] and set a struct met_datetime.
#define SUBSET_MASK_HAVE_LONGITUDE
Bit mask to mark a struct bufr_subset_sequence_data having longitude.
int syn_parse_x05(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 05.
#define SUBSET_MASK_HAVE_LATITUDE
Bit mask to mark a struct bufr_subset_sequence_data having latitude.
#define SUBSET_MASK_HAVE_NO_SIGNIFICANT_W1
Bit mask to mark a struct bufr_subset_sequence_data without W1 information.
#define SUBSET_MASK_HAVE_DAY
Bit mask to mark a struct bufr_subset_sequence_data having observation day in a month.
#define SUBSET_MASK_HAVE_NO_SIGNIFICANT_W2
Bit mask to mark a struct bufr_subset_sequence_data without W1 information.
int syn_parse_x07(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 07.
#define SUBSET_MASK_HAVE_HOUR
Bit mask to mark a struct bufr_subset_sequence_data having observation hour.
int parse_subset_as_synop(struct metreport *m, struct bufr2tac_subset_state *s, struct bufr_subset_sequence_data *sq, char *err)
parses a subset sequence as an Land fixed SYNOP FM-12, SHIP FM-13 or SYNOP-mobil FM-14 report
char * guess_WMO_region_synop(struct synop_chunks *syn)
Try to find WMO region if it is not already set and WMO Block and number index are known.
int synop_YYYYMMDDHHmm_to_YYGG(struct synop_chunks *syn)
Sets YYGG from YYYYMMDDHHmm extended group.
#define SYNOP_SEC3
mask bit meaning section 3 or synop is solicited to or parsed with success
#define SYNOP_EXT
mask bit meaning date extension is parsed with success
#define SYNOP_BUFR
mask bit meaning date synop is decoded from a BUFR
stores information needed to parse a sequential list of expanded descriptors for a subset
struct bufr_atom_data * a1
struct bufr_atom_data * a
all the information for a meteorological report in WMO text format from a BUFR file
struct synop_chunks synop
contains all possible substrings from a synop report is parsed with success
WIGOS station identifier.