bufr2synop 0.24.0
Functions
bufr2tac_climat.c File Reference

file with the code to parse a sequence as a FM-71 XII CLIMAT and FM-72 XII CLIMAT SHIP More...

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

Go to the source code of this file.

Functions

int parse_subset_as_climat (struct metreport *m, struct bufr2tac_subset_state *s, struct bufr_subset_sequence_data *sq, char *err)
 

Detailed Description

file with the code to parse a sequence as a FM-71 XII CLIMAT and FM-72 XII CLIMAT SHIP

Definition in file bufr2tac_climat.c.

Function Documentation

◆ parse_subset_as_climat()

int parse_subset_as_climat ( struct metreport m,
struct bufr2tac_subset_state s,
struct bufr_subset_sequence_data sq,
char *  err 
)

Definition at line 38 of file bufr2tac_climat.c.

39{
40 size_t is;
41 char aux[32];
42 struct climat_chunks *c;
43
44 c = &m->climat;
45
46 // clean data
48
49 // reject if still not coded type
50 if ( strcmp ( s->type_report,"CLIMAT" ) )
51 {
52 sprintf ( err,"bufr2tac: parse_subset_as_climat(): '%s' reports still not decoded in this software", s->type_report );
53 return 1;
54 }
55
56 strcpy ( m->type, s->type_report );
57
58 /**** First pass, sequential analysis *****/
59 for ( is = 0; is < sq->nd; is++ )
60 {
61 s->i = is;
62 s->ival = ( int ) sq->sequence[is].val;
63 s->val = sq->sequence[is].val;
64 s->a = &sq->sequence[is];
65 if ( is > 0 )
66 {
67 s->a1 = &sq->sequence[is - 1];
68 }
69
70 switch ( sq->sequence[is].desc.x )
71 {
72 case 1: //localization descriptors
73 climat_parse_x01 ( c, s );
74 break;
75
76 case 2: //Type of station descriptors
77 climat_parse_x02 ( c, s );
78 break;
79
80 case 4: //Date and time descriptors
81 climat_parse_x04 ( c, s );
82 break;
83
84 case 5: // Horizontal position. Latitude
85 climat_parse_x05 ( c, s );
86 break;
87
88 case 6: // Horizontal position. Longitude
89 climat_parse_x06 ( c, s );
90 break;
91
92 case 7: // Vertical position
93 climat_parse_x07 ( c, s );
94 break;
95
96 case 8: // significance qualifier
97 climat_parse_x08 ( c, s );
98 break;
99
100 case 10: // Air pressure
101 climat_parse_x10 ( c, s );
102 break;
103
104 case 11: // Wind
105 climat_parse_x11 ( c, s );
106 break;
107
108 case 12: // Temperature
109 climat_parse_x12 ( c, s );
110 break;
111
112 case 13: // Humidity and precipitation data
113 climat_parse_x13 ( c, s );
114 break;
115
116 case 14: // Radiation
117 climat_parse_x14 ( c, s );
118 break;
119
120 default:
121 break;
122 }
123
124 }
125
126 // Fill some metreport fields
127 if ( strlen ( c->s0.II ) )
128 {
129 strcpy ( m->g.index, c->s0.II );
130 strcat ( m->g.index, c->s0.iii );
131 }
132
134 {
135 m->g.lat = s->lat;
136 }
138 {
139 m->g.lon = s->lon;
140 }
142 {
143 m->g.alt = s->alt;
144 }
145 if ( s->mask & SUBSET_MASK_HAVE_NAME )
146 {
147 strcpy ( m->g.name, s->name );
148 }
150 {
151 strcpy ( m->g.country, s->country );
152 }
153
154 sprintf ( aux,"%s%s%s%s%s", c->e.YYYY, c->e.MM, c->e.DD, c->e.HH, c->e.mm );
155 YYYYMMDDHHmm_to_met_datetime ( &m->t, aux );
156
157 // copy WIGOS ID
158 memcpy(&m->g.wid, &m->climat.wid, sizeof (struct wigos_id) );
159
160 if ( check_date_from_future ( m ) )
161 {
162 return 1; // Bad date/time . Is a report from future!
163 }
164
165
166 return 0;
167}
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.
Definition: bufr2tac.h:134
#define SUBSET_MASK_HAVE_NAME
Bit mask to mark a struct bufr_subset_sequence_data having station name.
Definition: bufr2tac.h:128
int climat_parse_x12(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 12.
Definition: bufr2tac_x12.c:526
#define SUBSET_MASK_HAVE_ALTITUDE
Bit mask to mark a struct bufr_subset_sequence_data having altitude.
Definition: bufr2tac.h:122
int climat_parse_x10(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 10.
Definition: bufr2tac_x10.c:214
int climat_parse_x02(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 02.
Definition: bufr2tac_x02.c:146
int climat_parse_x05(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 05.
Definition: bufr2tac_x05.c:170
int climat_parse_x06(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 06.
Definition: bufr2tac_x06.c:165
int climat_parse_x13(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 13.
Definition: bufr2tac_x13.c:909
int YYYYMMDDHHmm_to_met_datetime(struct met_datetime *t, const char *source)
Parse the string YYYYMMDDHHmm[ss] and set a struct met_datetime.
void bufr2tac_clean_climat_chunks(struct climat_chunks *c)
cleans a climat_chunks struct
int climat_parse_x11(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 11.
Definition: bufr2tac_x11.c:454
#define SUBSET_MASK_HAVE_LONGITUDE
Bit mask to mark a struct bufr_subset_sequence_data having longitude.
Definition: bufr2tac.h:116
int climat_parse_x08(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 08.
Definition: bufr2tac_x08.c:164
int climat_parse_x01(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
Definition: bufr2tac_x01.c:324
#define SUBSET_MASK_HAVE_LATITUDE
Bit mask to mark a struct bufr_subset_sequence_data having latitude.
Definition: bufr2tac.h:110
int climat_parse_x04(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 04.
Definition: bufr2tac_x04.c:405
int climat_parse_x07(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Definition: bufr2tac_x07.c:208
int climat_parse_x14(struct climat_chunks *c, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 14.
Definition: bufr2tac_x14.c:497
struct bufr_atom_data * a1
Definition: bufr2tac.h:250
struct bufr_atom_data * a
Definition: bufr2tac.h:249
char type_report[16]
Definition: bufr2tac.h:247
contains all possible substrings from a synop report is parsed with success
Definition: metclimat.h:213
struct report_date_ext e
Definition: metclimat.h:215
struct climat_sec0 s0
Definition: metclimat.h:217
struct wigos_id wid
Definition: metclimat.h:216
char iii[4]
Definition: metclimat.h:73
char II[4]
Definition: metclimat.h:72
double lat
Definition: bufr2tac.h:299
double lon
Definition: bufr2tac.h:300
double alt
Definition: bufr2tac.h:301
struct wigos_id wid
Definition: bufr2tac.h:295
char index[16]
Definition: bufr2tac.h:296
char name[80]
Definition: bufr2tac.h:297
char country[80]
Definition: bufr2tac.h:298
char type[8]
Definition: bufr2tac.h:320
struct climat_chunks climat
Definition: bufr2tac.h:319
struct met_datetime t
Definition: bufr2tac.h:314
struct met_geo g
Definition: bufr2tac.h:315
char mm[4]
Definition: metcommon.h:37
char HH[4]
Definition: metcommon.h:36
char DD[4]
Definition: metcommon.h:35
char MM[4]
Definition: metcommon.h:34
char YYYY[6]
Definition: metcommon.h:33
WIGOS station identifier.
Definition: metcommon.h:46

References bufr2tac_subset_state::a, bufr2tac_subset_state::a1, bufr2tac_subset_state::alt, met_geo::alt, bufr2tac_clean_climat_chunks(), check_date_from_future(), metreport::climat, climat_parse_x01(), climat_parse_x02(), climat_parse_x04(), climat_parse_x05(), climat_parse_x06(), climat_parse_x07(), climat_parse_x08(), climat_parse_x10(), climat_parse_x11(), climat_parse_x12(), climat_parse_x13(), climat_parse_x14(), bufr2tac_subset_state::country, met_geo::country, report_date_ext::DD, climat_chunks::e, metreport::g, report_date_ext::HH, bufr2tac_subset_state::i, climat_sec0::II, climat_sec0::iii, met_geo::index, bufr2tac_subset_state::ival, bufr2tac_subset_state::lat, met_geo::lat, bufr2tac_subset_state::lon, met_geo::lon, bufr2tac_subset_state::mask, report_date_ext::MM, report_date_ext::mm, bufr2tac_subset_state::name, met_geo::name, climat_chunks::s0, SUBSET_MASK_HAVE_ALTITUDE, SUBSET_MASK_HAVE_COUNTRY, SUBSET_MASK_HAVE_LATITUDE, SUBSET_MASK_HAVE_LONGITUDE, SUBSET_MASK_HAVE_NAME, metreport::t, metreport::type, bufr2tac_subset_state::type_report, bufr2tac_subset_state::val, met_geo::wid, climat_chunks::wid, report_date_ext::YYYY, and YYYYMMDDHHmm_to_met_datetime().

Referenced by parse_subset_sequence().

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