bufr2synop 0.24.0
bufr2tac.h
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.h
22 \brief Include header file for binary bufr2tac
23*/
24#ifndef BUFR2TAC_H
25#define BUFR2TAC_H
26
27#ifndef _GNU_SOURCE
28#define _GNU_SOURCE
29#endif
30
31#include <stdio.h>
32#include <stdlib.h>
33#include <string.h>
34#include <getopt.h>
35#include <time.h>
36#include <math.h>
37#include <sys/stat.h>
38
39// project includes
40#include "bufrdeco.h"
41#include "metsynop.h"
42#include "metbuoy.h"
43#include "mettemp.h"
44#include "metclimat.h"
45//#define DEBUG
46
47//#define USE_BUFRDC
48
49#ifdef USE_BUFRDC
50/*!
51 \def KELEM
52 \brief max dimension of elements for a single report
53*/
54#define KELEM (8192 * 1)
55
56/*!
57 \def KVALS
58 \brief dimension of arrays of doubles. It must store all the data for all subset
59*/
60#define KVALS (32768 * 512)
61
62/*!
63 \def KSUBS
64 \brief Maximum number of subset this version can manage
65*/
66#define KSUBS (KVALS / KELEM)
67
68#endif // USE_BUFRDC
69
70/*!
71 \def SUBSET_MASK_LATITUDE_SOUTH
72 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data with south latitude
73*/
74#define SUBSET_MASK_LATITUDE_SOUTH (1)
75
76/*!
77 \def SUBSET_MASK_LONGITUDE_WEST
78 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data with west longitude
79*/
80#define SUBSET_MASK_LONGITUDE_WEST (2)
81
82/*!
83 \def SUBSET_MASK_HAVE_TYPE_STATION
84 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having type station information
85*/
86#define SUBSET_MASK_HAVE_TYPE_STATION (4)
87
88/*!
89 \def SUBSET_MASK_HAVE_NO_SIGNIFICANT_WW
90 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data without WW information
91*/
92#define SUBSET_MASK_HAVE_NO_SIGNIFICANT_WW (8)
93
94/*!
95 \def SUBSET_MASK_HAVE_NO_SIGNIFICANT_W1
96 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data without W1 information
97*/
98#define SUBSET_MASK_HAVE_NO_SIGNIFICANT_W1 (16)
99
100/*!
101 \def SUBSET_MASK_HAVE_NO_SIGNIFICANT_W2
102 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data without W1 information
103*/
104#define SUBSET_MASK_HAVE_NO_SIGNIFICANT_W2 (32)
105
106/*!
107 \def SUBSET_MASK_HAVE_LATITUDE
108 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having latitude
109*/
110#define SUBSET_MASK_HAVE_LATITUDE (64)
111
112/*!
113 \def SUBSET_MASK_HAVE_LONGITUDE
114 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having longitude
115*/
116#define SUBSET_MASK_HAVE_LONGITUDE (128)
117
118/*!
119 \def SUBSET_MASK_HAVE_ALTITUDE
120 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having altitude
121*/
122#define SUBSET_MASK_HAVE_ALTITUDE (256)
123
124/*!
125 \def SUBSET_MASK_HAVE_NAME
126 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having station name
127*/
128#define SUBSET_MASK_HAVE_NAME (512)
129
130/*!
131 \def SUBSET_MASK_HAVE_COUNTRY
132 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having country name
133*/
134#define SUBSET_MASK_HAVE_COUNTRY (1024)
135
136/*!
137 \def SUBSET_MASK_HAVE_YEAR
138 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having observation year
139*/
140#define SUBSET_MASK_HAVE_YEAR (2048)
141
142/*!
143 \def SUBSET_MASK_HAVE_MONTH
144 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having observation month
145*/
146#define SUBSET_MASK_HAVE_MONTH (4096)
147
148/*!
149 \def SUBSET_MASK_HAVE_DAY
150 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having observation day in a month
151*/
152#define SUBSET_MASK_HAVE_DAY (8192)
153
154/*!
155 \def SUBSET_MASK_HAVE_HOUR
156 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having observation hour
157*/
158#define SUBSET_MASK_HAVE_HOUR (16384)
159
160/*!
161 \def SUBSET_MASK_HAVE_MINUTE
162 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having observation minute
163*/
164#define SUBSET_MASK_HAVE_MINUTE (32768)
165
166/*!
167 \def SUBSET_MASK_HAVE_SECOND
168 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having observation second
169*/
170#define SUBSET_MASK_HAVE_SECOND (65536)
171
172/*!
173 \def SUBSET_MASK_HAVE_GUST
174 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having wind gust observation other than 10 minutes
175*/
176#define SUBSET_MASK_HAVE_GUST (131072)
177
178/*!
179 \def SUBSET_MASK_HAVE_GUST10
180 \brief Bit mask to mark a struct \ref bufr_subset_sequence_data having wind gust observation other than 10 minutes
181*/
182#define SUBSET_MASK_HAVE_GUST10 ( 2 * 131072)
183
184/*!
185 \def SUBSET_MASK_HAVE_WIGOS_ID
186 \brief Bit mask to mark if a subset has a WIGOS ID
187*/
188#define SUBSET_MASK_HAVE_WIGOS_ID ( 4 * 131072)
189
190
191/*! \def BUFR2TAC_ERROR_STACK_DIM
192 * \brief set de dimension of a struct \ref bufr2tac_error_stack
193 */
194#define BUFR2TAC_ERROR_STACK_DIM 16
195
196/*! \def BUFR2TAC_ERROR_DESCRIPTION_LENGTH
197 * \brief set de dimension of member \a description of a struct \ref bufr2tac_error
198 */
199#define BUFR2TAC_ERROR_DESCRIPTION_LENGTH 1024
200
201
202#define REPORT_LENGTH (16384)
203
204/*!
205 * \def PRINT_BITMASK_WIGOS
206 * \brief Bit mask to member \a print_mask in struct \ref metreport to print WIGOS Identifier
207 */
208#define PRINT_BITMASK_WIGOS (1)
209
210/*!
211 * \def PRINT_BITMASK_GEO
212 * \brief Bit mask to member \a print_mask in struct \ref metreport to print geographic position
213 */
214#define PRINT_BITMASK_GEO (2)
215
216/*!
217 * \def bufr_subset_sequence_data
218 * \brief To use bufrdeco library with legacy old code using ECMWF library which is not used currently
219 */
220# define bufr_subset_sequence_data bufrdeco_subset_sequence_data
221
222/*!
223 * \struct bufr2tac_error
224 * \brief Store an error/warning/info and its severity
225 */
227 int severity; /*!< Level of severity. if = 1 then is a warning. if = 2 is an error */
228 char description[BUFR2TAC_ERROR_DESCRIPTION_LENGTH]; /*!< string with error description */
229};
230
231/*!
232 * \struct bufr2tac_error_stack
233 * \brief A stack of structs \ref bufr2tac_error
234 */
236 size_t ne; /*!< Current warning/error active. If = 0 then no errors */
237 int full; /*!< if 1 then one or more warnings cannot be pushed because of full stack. If = 2 an error cannot be pushed */
238 struct bufr2tac_error err[BUFR2TAC_ERROR_STACK_DIM] ; /*!< Dimension of stack array */
239};
240
241/*!
242 \struct bufr2tac_subset_state
243 \brief stores information needed to parse a sequential list of expanded descriptors for a subset
244*/
246{
247 char type_report[16]; /*!< The type of report to decode (MMMM) */
248 struct bufr2tac_error_stack e; /*!< Pointer to a struct \ref bufr2tac_error_stack */
249 struct bufr_atom_data *a; /*!< the current struct \ref bufr_atom_data being parsed */
250 struct bufr_atom_data *a1; /*!< the prior struct \ref bufr_atom_data being parsed */
251 size_t i; /*!< current index in array element */
252 int rep; /*!< Latest delayed replicator */
253 size_t k_rep; /*!< Index of latest delayed replicator */
254 int ival; /*!< the integer value in the descriptor */
255 double val; /*!< the float value in the descriptor */
256 int itval; /*!< Latest parsed time displacement in seconds */
257 int itmask; /*!< Latest time displacement descriptor mask */
258 size_t k_itval; /*!< index in array of latest time displacemet descriptor */
259 int jtval; /*!< Prior to latest parsed time displacement in seconds */
260 int jtmask; /*!< Prior to latest time displacement descriptor mask */
261 size_t k_jtval; /*!< index in array of time prior to latest displacemet descriptor */
262 int isq; /*!< if 1, the current atom data is in a Significant qualifier squence, and not computed */
263 int isq_val; /*!< Value of a significant qualifier */
264 int type; /*!< type of station */
265 int clayer; /*!< cloud layer being parsed */
266 int layer; /*!< Layer/level of data when parsing Buoy report*/
267 int deep; /*!< Latest parsed deep in meters of a layer */
268 double lat; /*!< Latitude of station */
269 double lon; /*!< longitude of station */
270 double alt; /*!< Altitude (m)*/
271 double hsensor; /*!< Sensor height over station ground (m) */
272 double hwsensor; /*!< Sensor height over water surface (m) */
273 char name[80]; /*!< Name of observatory, if any */
274 char country[80]; /*!< Name of state/country if known */
275 time_t tobs; /*!< Unix time reference*/
276 int dift; /*!< UTC - LST , in hours */
277 int day; /*!< Day of ephemerides in some reports */
278 int more_days; /*!< If = 1 there are more than a day in ephemeride */
279 int nday; /*!< period (days) in some reports */
280 int month; /*!< month for some normal values */
281 int is_normal; /*!< if 1, the values are normal of a defined period */
282 int mask; /*!< mask which contain several information from the subset data taken at the moment */
283 int SnSn; /*!< Latest int value of Synop suplementary information */
284 int tw1w2; /*!< Period for synop w1w2 (seconds) */
285 struct temp_raw_data *r; /*!< pointer to a struct where to set the data from a temp profile being parsed */
286 struct temp_raw_wind_shear_data *w; /*!< pointer to a struct where to set the data from a temp profile being parsed */
287};
288
289/*!
290 \struct met_geo
291 \brief Geographic meta information
292*/
294{
295 struct wigos_id wid; /*!< The WIGOS Id if known or '0-0-0-MISSING' */
296 char index[16]; /*!< The index indetifier of place, if any */
297 char name[80]; /*!< The common name of place */
298 char country[80]; /*!< The country name, if known */
299 double lat; /*!< Latitude in degrees. North positive */
300 double lon; /*!< Longitude in degrees. East positive */
301 double alt; /*!< Altitude in metres */
302};
303
304/*!
305 \struct metreport
306 \brief all the information for a meteorological report in WMO text format from a BUFR file
307*/
309{
310 char source[256];/*!< The bufr source filename */
311 int subset; /*!< Subset index in bufr report */
312 int print_mask; /*!< Mode of print 0=legacy, 1= with WIGOS id, 2=with lat/lon/alt */
313 struct gts_header *h; /*!< A pointer to a GTS Header Bulletin */
314 struct met_datetime t; /*!< The date/time information for report */
315 struct met_geo g; /*!< The geographical info */
316 struct synop_chunks synop; /*!< The possible parsed synop */
317 struct buoy_chunks buoy; /*!< The possible parsed buoy */
318 struct temp_chunks temp; /*!< The possible parsed temp */
319 struct climat_chunks climat; /*!< The pssible parsed climat */
320 char type[8]; /*!< The type of report as MiMiMjMj */
321 char alphanum[REPORT_LENGTH]; /*!< The alphanumeric report */
322 char type2[8]; /*!< The type of report of part 2 as MiMiMjMj */
323 char alphanum2[REPORT_LENGTH]; /*!< The alphanumeric report, part 2 */
324 char type3[8]; /*!< The type of report of part 3 as MiMiMjMj */
325 char alphanum3[REPORT_LENGTH]; /*!< The alphanumeric report, part 3 */
326 char type4[8]; /*!< The type of report of part 4 as MiMiMjMj */
327 char alphanum4[REPORT_LENGTH]; /*!< The alphanumeric report, part 4 */
328};
329
330/* Functions definitions */
331char *bufr2tac_get_version(char *version, size_t dversion, char *build, size_t dbuild, char *builder, size_t dbuilder,
332 int *version_major, int *version_minor, int *version_patch);
333
334/* Error/debug functions */
335int bufr2tac_push_error ( struct bufr2tac_error_stack *e, int severity, char *description );
337int bufr2tac_set_error ( struct bufr2tac_subset_state *s, int severity, char *origin, char *explanation);
339int bufr2tac_set_debug_level(int level);
340
341void bufr2tac_clean_buoy_chunks ( struct buoy_chunks *b );
343void bufr2tac_clean_temp_chunks ( struct temp_chunks *t );
345void bufr2tac_clean_metreport (struct metreport *m);
346
347int set_environment ( char *default_bufrtables, char *bufrtables_dir );
348int integer_to_descriptor ( struct bufr_descriptor *d, int id );
349int descriptor_to_integer ( int *id, struct bufr_descriptor *d );
350unsigned int three_bytes_to_uint ( const unsigned char *source );
351char * charray_to_string ( char *s, unsigned char *buf, size_t size );
352char * adjust_string ( char *s );
353char * get_explained_table_val ( char *expl, size_t dim, char tablec[MAXLINES_TABLEC][92], size_t nlines_tablec,
354 struct bufr_descriptor *d, int ival );
355char * get_explained_flag_val ( char *expl, size_t dim, char tablec[MAXLINES_TABLEC][92], size_t nlines_tablec,
356 struct bufr_descriptor *d, unsigned long ival );
357char * get_ecmwf_tablename ( char *target, char type, char *bufrtables_dir, int ksec1[40] );
359 char *err );
361 char *err );
363 char *err );
365 char *err );
366int YYYYMMDDHHmm_to_met_datetime ( struct met_datetime *t, const char *source );
367int round_met_datetime_to_hour ( struct met_datetime *target, struct met_datetime *source );
368int synop_YYYYMMDDHHmm_to_YYGG ( struct synop_chunks *syn );
369char *met_datetime_to_YYGG ( char *target, struct met_datetime *t );
371int check_date_from_future ( struct metreport *m );
372char *guess_WMO_region ( char *A1, char *Reg, const char *II, const char *iii );
373char * guess_WMO_region_synop ( struct synop_chunks *syn );
374char *guess_WMO_region_temp ( struct temp_chunks *temp );
375int read_table_c ( char tablec[MAXLINES_TABLEC][92], size_t *nlines_tablec, char *bufrtables_dir, int ksec1[40] );
377 int *kdtlst, size_t nlst, int *ksec1, char *err );
378int find_descriptor ( int *haystack, size_t nlst, int needle );
379int find_descriptor_interval ( int *haystack, size_t nlst, int needlemin, int needlemax );
380int bufr_set_environment ( char *default_bufrtables, char *bufrtables_dir );
381int guess_gts_header ( struct gts_header *h, const char *f );
382int read_bufr ( unsigned char *bufr, char *filename, int *length );
384int hour_rounded ( struct synop_chunks *syn );
385
386char * latlon_to_MMM ( char *target, double lat, double lon );
387char * kelvin_to_TTTT ( char *target, double T );
388char * kelvin_to_snTTT ( char *target, double T );
389char * kelvin_to_snTT ( char *target, double T );
390char * kelvin_to_TT ( char *target, double T );
391char * kelvin_to_TTTa ( char *target, double T );
392char * dewpoint_depression_to_DnDn ( char * target, double T, double Td );
393char * m_to_h ( char *target, double h );
394char * m_to_hh ( char *target, double h );
395char * m_to_9h ( char *target, double h );
396char * m_to_RR ( char *target, double m );
397char * pascal_to_ppp ( char *target, double P );
398char * pascal_to_pnpnpn ( char *target, double P );
399char * pascal_to_PPPP ( char *target, double P );
400char * percent_to_okta ( char *target, double perc );
401char * prec_to_RRR ( char *target, double r );
402char * prec_to_RRRR24 ( char *target, double r );
403char * secs_to_tt ( char *tt, int secs );
404char * vism_to_VV ( char *target, double V );
405char * recent_snow_to_ss ( char *target, double r );
406char * total_snow_depth_to_sss ( char *target, double r );
407char * wind_to_dndnfnfnfn ( char *target, double dd, double ff );
408char * grad_to_D ( char *D, double grad );
409char * grad_to_ec ( char *target, double grad );
410int check_kj_m2 ( double val );
411int check_j_cm2 ( double val );
412
413size_t print_geo ( char **geo, size_t lmax, struct metreport *m );
414size_t print_wigos_id ( char **wid, size_t lmax, struct metreport *m );
415
416int print_synop_report ( struct metreport *m);
417size_t print_synop_sec0 ( char **sec0, size_t lmax, struct synop_chunks *syn );
418size_t print_synop_sec1 ( char **sec1, size_t lmax, struct synop_chunks *syn );
419size_t print_synop_sec2 ( char **sec2, size_t lmax, struct synop_chunks *syn );
420size_t print_synop_sec3 ( char **sec3, size_t lmax, struct synop_chunks *syn );
421size_t print_synop_wigos_id ( char **wid, size_t lmax, struct synop_chunks *syn );
422
424
425
426int print_buoy_report ( struct metreport *m);
427size_t print_buoy_sec0 ( char **sec0, size_t lmax, struct buoy_chunks *b );
428size_t print_buoy_sec1 ( char **sec1, size_t lmax, struct buoy_chunks *b );
429size_t print_buoy_sec2 ( char **sec2, size_t lmax, struct buoy_chunks *b );
430size_t print_buoy_sec3 ( char **sec3, size_t lmax, struct buoy_chunks *b );
431size_t print_buoy_wigos_id ( char **wid, size_t lmax, struct buoy_chunks *b);
432
433int print_climat_report ( struct metreport *m);
434size_t print_climat_sec0 ( char **sec0, size_t lmax, struct climat_chunks *cl );
435size_t print_climat_sec1 ( char **sec1, size_t lmax, struct climat_chunks *cl );
436size_t print_climat_sec2 ( char **sec2, size_t lmax, struct climat_chunks *cl );
437size_t print_climat_sec3 ( char **sec3, size_t lmax, struct climat_chunks *cl );
438size_t print_climat_sec4 ( char **sec4, size_t lmax, struct climat_chunks *cl );
439size_t print_climat_wigos_id ( char **wid, size_t lmax, struct climat_chunks *cl);
440
441int print_temp_report ( struct metreport *m );
442int print_temp_a ( struct metreport *m );
443size_t print_temp_a_sec1 ( char **sec1, size_t lmax, struct temp_chunks *t );
444size_t print_temp_a_sec2 ( char **sec2, size_t lmax, struct temp_chunks *t );
445size_t print_temp_a_sec3 ( char **sec3, size_t lmax, struct temp_chunks *t );
446size_t print_temp_a_sec4 ( char **sec4, size_t lmax, struct temp_chunks *t );
447size_t print_temp_a_sec7 ( char **sec7, size_t lmax, struct temp_chunks *t );
448int print_temp_b ( struct metreport *m );
449size_t print_temp_b_sec1 ( char **sec1, size_t lmax, struct temp_chunks *t );
450size_t print_temp_b_sec5 ( char **sec5, size_t lmax, struct temp_chunks *t );
451size_t print_temp_b_sec6 ( char **sec6, size_t lmax, struct temp_chunks *t );
452size_t print_temp_b_sec7 ( char **sec7, size_t lmax, struct temp_chunks *t );
453size_t print_temp_b_sec8 ( char **sec8, size_t lmax, struct temp_chunks *t );
454int print_temp_c ( struct metreport *m );
455size_t print_temp_c_sec1 ( char **sec1, size_t lmax, struct temp_chunks *t );
456size_t print_temp_c_sec2 ( char **sec2, size_t lmax, struct temp_chunks *t );
457size_t print_temp_c_sec3 ( char **sec3, size_t lmax, struct temp_chunks *t );
458size_t print_temp_c_sec4 ( char **sec4, size_t lmax, struct temp_chunks *t );
459size_t print_temp_c_sec7 ( char **sec7, size_t lmax, struct temp_chunks *t );
460int print_temp_d ( struct metreport *m );
461size_t print_temp_d_sec1 ( char **sec1, size_t lmax, struct temp_chunks *t );
462size_t print_temp_d_sec5 ( char **sec5, size_t lmax, struct temp_chunks *t );
463size_t print_temp_d_sec6 ( char **sec6, size_t lmax, struct temp_chunks *t );
464size_t print_temp_d_sec7 ( char **sec7, size_t lmax, struct temp_chunks *t );
465size_t print_temp_d_sec8 ( char **sec8, size_t lmax, struct temp_chunks *t );
466size_t print_temp_wigos_id ( char **wid, size_t lmax, struct temp_chunks *t );
467
468int parse_temp_raw_data ( struct temp_chunks *t, struct temp_raw_data *r );
470int print_temp_raw_data ( struct temp_raw_data *r );
472
473int print_csv ( FILE *f, struct metreport *m );
474int print_json ( FILE *f, struct metreport *m );
475int print_xml ( FILE *f, struct metreport *m );
476int print_plain ( FILE *f, struct metreport *m );
477int print_html ( FILE *f, struct metreport *m );
478
479int syn_parse_x01 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
480int syn_parse_x02 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
481int syn_parse_x04 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
482int syn_parse_x05 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
483int syn_parse_x06 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
484int syn_parse_x07 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
485int syn_parse_x08 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
486int syn_parse_x10 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
487int syn_parse_x11 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
488int syn_parse_x12 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
489int syn_parse_x13 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
490int syn_parse_x14 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
491int syn_parse_x20 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
492int syn_parse_x22 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
493int syn_parse_x31 ( struct synop_chunks *syn, struct bufr2tac_subset_state *s );
494
495int buoy_parse_x01 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
496int buoy_parse_x02 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
497int buoy_parse_x04 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
498int buoy_parse_x05 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
499int buoy_parse_x06 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
500int buoy_parse_x07 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
501int buoy_parse_x08 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
502int buoy_parse_x10 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
503int buoy_parse_x11 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
504int buoy_parse_x12 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
505int buoy_parse_x13 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
506int buoy_parse_x14 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
507int buoy_parse_x20 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
508int buoy_parse_x22 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
509int buoy_parse_x31 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
510int buoy_parse_x33 ( struct buoy_chunks *b, struct bufr2tac_subset_state *s );
511
512int climat_parse_x01 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
513int climat_parse_x02 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
514int climat_parse_x04 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
515int climat_parse_x05 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
516int climat_parse_x06 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
517int climat_parse_x07 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
518int climat_parse_x08 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
519int climat_parse_x10 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
520int climat_parse_x11 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
521int climat_parse_x12 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
522int climat_parse_x13 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
523int climat_parse_x14 ( struct climat_chunks *c, struct bufr2tac_subset_state *s );
528
529int temp_parse_x01 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
530int temp_parse_x02 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
531int temp_parse_x04 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
532int temp_parse_x05 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
533int temp_parse_x06 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
534int temp_parse_x07 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
535int temp_parse_x08 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
536int temp_parse_x10 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
537int temp_parse_x11 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
538int temp_parse_x12 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
539int temp_parse_x20 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
540int temp_parse_x22 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
541int temp_parse_x31 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
542int temp_parse_x33 ( struct temp_chunks *t, struct bufr2tac_subset_state *s );
543
544// These are prototypes for used ecmwf bufr library functions
545int bus012_ ( int *, unsigned int *, int *, int *, int *, int *, int * );
546int buprs0_ ( int * );
547int buprs1_ ( int * );
548int buprs3_ ( int *, int *, int *, int *, int *, int *, char ** );
549int bufrex_ ( int *, int *, int *, int *, int *, int *, int *, int *, int *, char **, char **, int *, double *, char **, int * );
550int busel_ ( int *, int *, int *, int *, int * );
551int busel2_ ( int *, int *, int *, char **, int *, char **, char **, char **, int * );
552int buukey_ ( int *, int *, int *, int *, int * );
553int buprt_ ( int *, int *, int *, int *, char **, char **, char **, int *, double *, int *, int *, int * );
554
555// Global static vars
556extern int BUFR2TAC_DEBUG_LEVEL;
557
558#endif // from ifndef BUFR2TAC_H
size_t print_climat_sec3(char **sec3, size_t lmax, struct climat_chunks *cl)
Prints the climat section 3.
void bufr2tac_clean_synop_chunks(struct synop_chunks *s)
char * m_to_9h(char *target, double h)
converts the altitude of cloud layer into 9h string code
Definition: bufr2tac_x20.c:135
int buprt_(int *, int *, int *, int *, char **, char **, char **, int *, double *, int *, int *, int *)
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
size_t print_temp_b_sec5(char **sec5, size_t lmax, struct temp_chunks *t)
Prints the section 5 of part B of a TEMP report.
int climat_parse_x33(struct climat_chunks *c, struct bufr2tac_subset_state *s)
size_t print_temp_c_sec2(char **sec2, size_t lmax, struct temp_chunks *t)
Prints the section 2 of part C of a TEMP report.
size_t print_temp_d_sec5(char **sec5, size_t lmax, struct temp_chunks *t)
Prints the section 5 of part D of a TEMP report.
int buoy_parse_x07(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 07.
Definition: bufr2tac_x07.c:164
char * met_datetime_to_YYGG(char *target, struct met_datetime *t)
Get YYGG from a struct met_datetime.
size_t print_synop_sec0(char **sec0, size_t lmax, struct synop_chunks *syn)
Prints the synop section 0 (header)
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
int check_date_from_future(struct metreport *m)
Check a estructure metreport not from future.
size_t print_temp_c_sec4(char **sec4, size_t lmax, struct temp_chunks *t)
Prints the section 4 of part C of a TEMP report.
char * pascal_to_ppp(char *target, double P)
Converts pascal values (variation) into a ppp string.
Definition: bufr2tac_x10.c:32
int guess_gts_header(struct gts_header *h, const char *f)
Guess the WMO GTS header from filename.
int busel2_(int *, int *, int *, char **, int *, char **, char **, char **, int *)
char * dewpoint_depression_to_DnDn(char *target, double T, double Td)
Set DnDn (dewpoint depression)
Definition: bufr2tac_x12.c:179
void bufr2tac_clean_temp_chunks(struct temp_chunks *t)
cleans a buoy_chunks struct
int syn_parse_x04(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 04.
Definition: bufr2tac_x04.c:110
int print_json(FILE *f, struct metreport *m)
prints a struct metreport in json format
Definition: bufr2tac_json.c:62
int buoy_YYYYMMDDHHmm_to_JMMYYGGgg(struct buoy_chunks *b)
Sets YYGG from YYYYMMDDHHmm extended group.
Definition: bufr2tac_buoy.c:31
int syn_parse_x31(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 31.
Definition: bufr2tac_x31.c:35
size_t print_buoy_sec1(char **sec1, size_t lmax, struct buoy_chunks *b)
Prints the buoy section 1.
int temp_parse_x11(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 11.
Definition: bufr2tac_x11.c:500
size_t print_buoy_sec0(char **sec0, size_t lmax, struct buoy_chunks *b)
Prints the buoy section 1.
size_t print_temp_c_sec7(char **sec7, size_t lmax, struct temp_chunks *t)
Prints the section 7 of part C of a TEMP report.
size_t print_temp_b_sec6(char **sec6, size_t lmax, struct temp_chunks *t)
Prints the section 6 of part B of a TEMP report.
size_t print_temp_d_sec8(char **sec8, size_t lmax, struct temp_chunks *t)
int temp_parse_x05(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Definition: bufr2tac_x05.c:204
char * bufr2tac_get_version(char *version, size_t dversion, char *build, size_t dbuild, char *builder, size_t dbuilder, int *version_major, int *version_minor, int *version_patch)
Definition: bufr2tac.c:48
#define BUFR2TAC_ERROR_STACK_DIM
set de dimension of a struct bufr2tac_error_stack
Definition: bufr2tac.h:194
int bufr2tac_set_error(struct bufr2tac_subset_state *s, int severity, char *origin, char *explanation)
size_t print_wigos_id(char **wid, size_t lmax, struct metreport *m)
int syn_parse_x11(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 11.
Definition: bufr2tac_x11.c:116
int syn_parse_x13(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 13.
Definition: bufr2tac_x13.c:201
char * kelvin_to_TTTT(char *target, double T)
converts a kelvin temperature value into a TTTT string
Definition: bufr2tac_x12.c:123
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)
int busel_(int *, int *, int *, int *, int *)
size_t print_temp_b_sec8(char **sec8, size_t lmax, struct temp_chunks *t)
Prints the section 8 of part B of a TEMP report.
int buoy_parse_x05(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 05.
Definition: bufr2tac_x05.c:134
char * grad_to_D(char *D, double grad)
Converts true direction in grads to D (code table 0700)
Definition: bufr2tac_x05.c:32
int buprs3_(int *, int *, int *, int *, int *, int *, char **)
char * kelvin_to_TTTa(char *target, double T)
Set temperature TTTa.
Definition: bufr2tac_x12.c:147
int print_temp_d(struct metreport *m)
Prints the part D of a TEMP report into a string.
char * get_ecmwf_tablename(char *target, char type, char *bufrtables_dir, int ksec1[40])
Get the complete pathname of a table file needed by a bufr message.
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 * prec_to_RRRR24(char *target, double r)
converts a precipitation in Kg/m2 into a RRRR24 string
Definition: bufr2tac_x13.c:87
int set_environment(char *default_bufrtables, char *bufrtables_dir)
size_t print_climat_sec1(char **sec1, size_t lmax, struct climat_chunks *cl)
Prints the climat section 1.
size_t print_temp_a_sec2(char **sec2, size_t lmax, struct temp_chunks *t)
Prints the section 2 of part A of a TEMP report.
char * secs_to_tt(char *tt, int secs)
get tt code from seconds
Definition: bufr2tac_x11.c:34
int integer_to_descriptor(struct bufr_descriptor *d, int id)
parse an integer with a descriptor fom bufr ECWMF libary
int buoy_parse_x14(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 14.
Definition: bufr2tac_x14.c:467
#define bufr_subset_sequence_data
To use bufrdeco library with legacy old code using ECMWF library which is not used currently.
Definition: bufr2tac.h:220
int check_kj_m2(double val)
Check if a radiation value can be wrote in Kj/m2 using up to 4 chars.
Definition: bufr2tac_x14.c:33
int bufrex_(int *, int *, int *, int *, int *, int *, int *, int *, int *, char **, char **, int *, double *, char **, int *)
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
int print_temp_raw_wind_shear_data(struct temp_raw_wind_shear_data *w)
Prints for debug a struct temp_raw_data.
int syn_parse_x06(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 06.
Definition: bufr2tac_x06.c:67
char * grad_to_ec(char *target, double grad)
Converts elevation in grads to ec (code table 1004)
Definition: bufr2tac_x07.c:32
size_t print_temp_d_sec7(char **sec7, size_t lmax, struct temp_chunks *t)
Prints the section 7 of part D of a TEMP report.
size_t print_buoy_sec2(char **sec2, size_t lmax, struct buoy_chunks *b)
Prints the buoy section 1.
int parse_temp_raw_data(struct temp_chunks *t, struct temp_raw_data *r)
parse a struct temp_raw_data to fill chunks in a struct temp_chunks
int find_descriptor(int *haystack, size_t nlst, int needle)
Try to find a descriptor in an array.
int print_buoy_report(struct metreport *m)
prints a buoy into a string
size_t print_buoy_wigos_id(char **wid, size_t lmax, struct buoy_chunks *b)
int buoy_parse_x01(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
Definition: bufr2tac_x01.c:205
char * charray_to_string(char *s, unsigned char *buf, size_t size)
get a null termitated c-string from an array of unsigned chars
size_t print_temp_c_sec1(char **sec1, size_t lmax, struct temp_chunks *t)
Prints the section 1 of part C of a TEMP report.
size_t print_climat_sec4(char **sec4, size_t lmax, struct climat_chunks *cl)
Prints the climat section 4.
int print_csv(FILE *f, struct metreport *m)
prints a struct metreport in labeled csv format
Definition: bufr2tac_csv.c:85
int parse_subset_as_temp(struct metreport *m, struct bufr2tac_subset_state *s, struct bufr_subset_sequence_data *sq, char *err)
Definition: bufr2tac_temp.c:75
int buoy_parse_x13(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 13.
Definition: bufr2tac_x13.c:877
size_t print_synop_sec2(char **sec2, size_t lmax, struct synop_chunks *syn)
Prints the synop section 2.
int time_period_duration(struct bufr2tac_subset_state *s)
Get time period duration in seconds.
Definition: bufr2tac_x04.c:33
char * guess_WMO_region_temp(struct temp_chunks *temp)
Definition: bufr2tac_temp.c:34
size_t print_temp_d_sec6(char **sec6, size_t lmax, struct temp_chunks *t)
Prints the section 6 of part D of a TEMP report.
int buoy_parse_x11(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 11.
Definition: bufr2tac_x11.c:387
int syn_parse_x02(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 02.
Definition: bufr2tac_x02.c:34
size_t print_climat_sec2(char **sec2, size_t lmax, struct climat_chunks *cl)
Prints the climat section 2.
int syn_parse_x20(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 20.
Definition: bufr2tac_x20.c:298
size_t print_climat_wigos_id(char **wid, size_t lmax, struct climat_chunks *cl)
char * get_explained_flag_val(char *expl, size_t dim, char tablec[MAXLINES_TABLEC][92], size_t nlines_tablec, struct bufr_descriptor *d, unsigned long ival)
char * wind_to_dndnfnfnfn(char *target, double dd, double ff)
Definition: bufr2tac_x11.c:93
char * percent_to_okta(char *target, double perc)
Converts percent cloud cover into okta.
Definition: bufr2tac_x20.c:32
int read_table_c(char tablec[MAXLINES_TABLEC][92], size_t *nlines_tablec, char *bufrtables_dir, int ksec1[40])
char * pascal_to_pnpnpn(char *target, double P)
Definition: bufr2tac_x10.c:47
int climat_parse_x22(struct climat_chunks *c, struct bufr2tac_subset_state *s)
size_t print_temp_b_sec7(char **sec7, size_t lmax, struct temp_chunks *t)
Prints the section 7 of part B of a TEMP report.
int bufr2tac_push_error(struct bufr2tac_error_stack *e, int severity, char *description)
size_t print_temp_b_sec1(char **sec1, size_t lmax, struct temp_chunks *t)
Prints the section 1 of part B of a TEMP report.
int print_climat_report(struct metreport *m)
prints a climat into a string
char * vism_to_VV(char *target, double V)
Convert horizontal visibilty in meters to a VV string.
Definition: bufr2tac_x20.c:226
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 read_bufr(unsigned char *bufr, char *filename, int *length)
read a bufr file as an array of unsigned chars
Definition: bufr2tac_io.c:34
int buoy_parse_x22(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 22.
Definition: bufr2tac_x22.c:148
size_t print_temp_a_sec4(char **sec4, size_t lmax, struct temp_chunks *t)
Prints the section 4 of part A of a TEMP report.
int bus012_(int *, unsigned int *, int *, int *, int *, int *, int *)
int parse_subset_sequence(struct metreport *m, struct bufr_subset_sequence_data *sq, struct bufr2tac_subset_state *st, int *kdtlst, size_t nlst, int *ksec1, char *err)
Parse a sequence of expanded descriptors for a subset.
int climat_parse_x20(struct climat_chunks *c, struct bufr2tac_subset_state *s)
int parse_temp_raw_wind_shear_data(struct temp_chunks *t, struct temp_raw_wind_shear_data *w)
int syn_parse_x01(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
Definition: bufr2tac_x01.c:54
void bufr2tac_clean_metreport(struct metreport *m)
int temp_parse_x07(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Definition: bufr2tac_x07.c:258
size_t print_temp_a_sec1(char **sec1, size_t lmax, struct temp_chunks *t)
Prints the section 1 of part A of a TEMP report.
int syn_parse_x12(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 12.
Definition: bufr2tac_x12.c:220
int buoy_parse_x10(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 10.
Definition: bufr2tac_x10.c:161
int temp_parse_x04(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 04.
Definition: bufr2tac_x04.c:575
size_t print_temp_c_sec3(char **sec3, size_t lmax, struct temp_chunks *t)
Prints the section 3 of part C of a TEMP report.
char * pascal_to_PPPP(char *target, double P)
Converts pascal values into a PPPP string.
Definition: bufr2tac_x10.c:69
int syn_parse_x10(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 10.
Definition: bufr2tac_x10.c:87
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 buoy_parse_x06(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 06.
Definition: bufr2tac_x06.c:129
int print_xml(FILE *f, struct metreport *m)
prints a struct metreport in xml format
Definition: bufr2tac_xml.c:71
int syn_parse_x08(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 08.
Definition: bufr2tac_x08.c:37
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
size_t print_temp_d_sec1(char **sec1, size_t lmax, struct temp_chunks *t)
Prints the section 1 of part D of a TEMP report.
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 hour_rounded(struct synop_chunks *syn)
Get the rounded hour of a given date.
Definition: bufr2tac_x04.c:78
int bufr_set_environment(char *default_bufrtables, char *bufrtables_dir)
set the environment vars needed to work properly with ECMWF bufrdc library
Definition: bufr2tac_env.c:41
int temp_parse_x20(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 20.
int parse_subset_as_climat(struct metreport *m, struct bufr2tac_subset_state *s, struct bufr_subset_sequence_data *sq, char *err)
int print_temp_c(struct metreport *m)
Prints the part C of a TEMP report into a string.
int syn_parse_x14(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 14.
Definition: bufr2tac_x14.c:59
int temp_parse_x12(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 12.
Definition: bufr2tac_x12.c:751
int climat_parse_x31(struct climat_chunks *c, struct bufr2tac_subset_state *s)
size_t print_synop_sec1(char **sec1, size_t lmax, struct synop_chunks *syn)
Prints the synop section 1.
size_t print_climat_sec0(char **sec0, size_t lmax, struct climat_chunks *cl)
Prints the climat section 0 (header)
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 syn_parse_x22(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
Definition: bufr2tac_x22.c:35
int buoy_parse_x02(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 02.
Definition: bufr2tac_x02.c:83
int print_synop_report(struct metreport *m)
prints a synop into a string
int buprs1_(int *)
int find_descriptor_interval(int *haystack, size_t nlst, int needlemin, int needlemax)
size_t print_geo(char **geo, size_t lmax, struct metreport *m)
char * get_explained_table_val(char *expl, size_t dim, char tablec[MAXLINES_TABLEC][92], size_t nlines_tablec, struct bufr_descriptor *d, int ival)
size_t print_temp_a_sec3(char **sec3, size_t lmax, struct temp_chunks *t)
Prints the section 3 of part A of a TEMP report.
int YYYYMMDDHHmm_to_met_datetime(struct met_datetime *t, const char *source)
Parse the string YYYYMMDDHHmm[ss] and set a struct met_datetime.
#define BUFR2TAC_ERROR_DESCRIPTION_LENGTH
set de dimension of member description of a struct bufr2tac_error
Definition: bufr2tac.h:199
char * recent_snow_to_ss(char *target, double r)
converts recent snow in m to ss (code table 3870)
Definition: bufr2tac_x13.c:157
int temp_parse_x31(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 31.
Definition: bufr2tac_x31.c:120
int print_plain(FILE *f, struct metreport *m)
Print in a file the report decoded to Traditional Alphanumeric Code in plain text format....
int round_met_datetime_to_hour(struct met_datetime *target, struct met_datetime *source)
#define REPORT_LENGTH
Definition: bufr2tac.h:202
int temp_parse_x01(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
Definition: bufr2tac_x01.c:415
void bufr2tac_clean_climat_chunks(struct climat_chunks *c)
cleans a climat_chunks struct
int buoy_parse_x31(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 31.
Definition: bufr2tac_x31.c:81
int temp_parse_x22(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 22.
Definition: bufr2tac_x22.c:289
int buoy_parse_x04(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 04.
Definition: bufr2tac_x04.c:254
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
size_t print_buoy_sec3(char **sec3, size_t lmax, struct buoy_chunks *b)
Prints the buoy section 3.
char * m_to_hh(char *target, double h)
converts the altitude of cloud layer into hh string code
Definition: bufr2tac_x20.c:188
size_t print_temp_wigos_id(char **wid, size_t lmax, struct temp_chunks *t)
int BUFR2TAC_DEBUG_LEVEL
Definition: bufr2tac.c:31
int temp_parse_x02(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 02.
Definition: bufr2tac_x02.c:187
int buoy_parse_x12(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 12.
Definition: bufr2tac_x12.c:466
int print_temp_raw_data(struct temp_raw_data *r)
Prints for debug a struct temp_raw_data.
int buoy_parse_x08(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 08.
Definition: bufr2tac_x08.c:121
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 bufr2tac_print_error(struct bufr2tac_error_stack *e)
int print_temp_a(struct metreport *m)
Prints the part A of a TEMP report into a string.
int print_html(FILE *f, struct metreport *m)
Print in a file the report decoded to Traditional Alphanumeric Code in plain html format....
int temp_parse_x06(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Definition: bufr2tac_x06.c:200
int bufr2tac_set_debug_level(int level)
Definition: bufr2tac.c:93
char * m_to_RR(char *target, double m)
Convert distance (m) in RR code (3570)
Definition: bufr2tac_x20.c:261
int synop_YYYYMMDDHHmm_to_YYGG(struct synop_chunks *syn)
Sets YYGG from YYYYMMDDHHmm extended group.
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
int syn_parse_x05(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 05.
Definition: bufr2tac_x05.c:66
char * prec_to_RRR(char *target, double r)
converts a precipitation in Kg/m2 into a RRR string
Definition: bufr2tac_x13.c:32
size_t print_synop_sec3(char **sec3, size_t lmax, struct synop_chunks *syn)
Prints the synop section 3.
void bufr2tac_clean_buoy_chunks(struct buoy_chunks *b)
cleans a buoy_chunks struct
int parse_subset_as_buoy(struct metreport *m, struct bufr2tac_subset_state *s, struct bufr_subset_sequence_data *sq, char *err)
Definition: bufr2tac_buoy.c:74
size_t print_synop_wigos_id(char **wid, size_t lmax, struct synop_chunks *syn)
char * kelvin_to_snTTT(char *target, double T)
converts a kelvin temperature value into a snTTT string
Definition: bufr2tac_x12.c:32
unsigned int three_bytes_to_uint(const unsigned char *source)
returns the integer value from an array of three bytes, most significant first
char * m_to_h(char *target, double h)
converts the altitude of cloud layer into h string code
Definition: bufr2tac_x20.c:83
char * kelvin_to_TT(char *target, double T)
converts a kelvin temperature value into a TT string
Definition: bufr2tac_x12.c:96
int print_temp_report(struct metreport *m)
print the four parts of a decoded TEMP report from a BUFR file into strings
int descriptor_to_integer(int *id, struct bufr_descriptor *d)
parse a descriptor and sets an integer in the decimal formas fxxyyy
int temp_parse_x08(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 08.
Definition: bufr2tac_x08.c:421
int temp_parse_x10(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 10.
Definition: bufr2tac_x10.c:297
int print_temp_b(struct metreport *m)
Prints the part B of a TEMP report into a string.
size_t print_temp_a_sec7(char **sec7, size_t lmax, struct temp_chunks *t)
Prints the section 7 of part A of a TEMP report.
int buoy_parse_x20(struct buoy_chunks *b, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 20.
char * kelvin_to_snTT(char *target, double T)
converts a kelvin temperature value into a snTT string
Definition: bufr2tac_x12.c:69
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 buukey_(int *, int *, int *, int *, int *)
char * total_snow_depth_to_sss(char *target, double r)
converts tatal snow depth in m to sss (code table 3889)
Definition: bufr2tac_x13.c:124
char * adjust_string(char *s)
Supress trailing blanks of a string.
int syn_parse_x07(struct synop_chunks *syn, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 07.
Definition: bufr2tac_x07.c:65
int bufr2tac_clean_error_stack(struct bufr2tac_error_stack *e)
char * latlon_to_MMM(char *target, double lat, double lon)
convert latitude and longitude to a MMM string
Definition: bufr2tac_x06.c:34
int check_j_cm2(double val)
Check if a radiation value can be wrote in J/cm2 using up to 4 chars.
Definition: bufr2tac_x14.c:45
int buprs0_(int *)
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
Include header file for bufrdeco library.
#define MAXLINES_TABLEC
The maximum expected lines in a Table C file, legacy def used from ECMWF.
Definition: bufrdeco.h:110
Main header file for buoy related tasks.
Main header file for synop related tasks.
Main header file for temp report related tasks.
A stack of structs bufr2tac_error.
Definition: bufr2tac.h:235
struct bufr2tac_error err[BUFR2TAC_ERROR_STACK_DIM]
Definition: bufr2tac.h:238
Store an error/warning/info and its severity.
Definition: bufr2tac.h:226
char description[BUFR2TAC_ERROR_DESCRIPTION_LENGTH]
Definition: bufr2tac.h:228
stores information needed to parse a sequential list of expanded descriptors for a subset
Definition: bufr2tac.h:246
struct temp_raw_wind_shear_data * w
Definition: bufr2tac.h:286
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
struct temp_raw_data * r
Definition: bufr2tac.h:285
struct bufr2tac_error_stack e
Definition: bufr2tac.h:248
Contains all the information for a single data related with a descriptor in a expanded squence.
Definition: bufrdeco.h:435
BUFR descriptor.
Definition: bufrdeco.h:409
contains all possible substrings from a synop report is parsed with success
Definition: metbuoy.h:197
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 wigos_id wid
Definition: metclimat.h:216
stores WMO GTS header info
Definition: bufrdeco.h:707
stores date and time reference of a report, commonly the observation time
Definition: metcommon.h:60
Geographic meta information.
Definition: bufr2tac.h:294
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
all the information for a meteorological report in WMO text format from a BUFR file
Definition: bufr2tac.h:309
char alphanum[REPORT_LENGTH]
Definition: bufr2tac.h:321
int subset
Definition: bufr2tac.h:311
char source[256]
Definition: bufr2tac.h:310
char type4[8]
Definition: bufr2tac.h:326
struct synop_chunks synop
Definition: bufr2tac.h:316
struct temp_chunks temp
Definition: bufr2tac.h:318
char type[8]
Definition: bufr2tac.h:320
int print_mask
Definition: bufr2tac.h:312
struct buoy_chunks buoy
Definition: bufr2tac.h:317
char type3[8]
Definition: bufr2tac.h:324
struct climat_chunks climat
Definition: bufr2tac.h:319
struct gts_header * h
Definition: bufr2tac.h:313
char type2[8]
Definition: bufr2tac.h:322
char alphanum3[REPORT_LENGTH]
Definition: bufr2tac.h:325
struct met_datetime t
Definition: bufr2tac.h:314
struct met_geo g
Definition: bufr2tac.h:315
char alphanum2[REPORT_LENGTH]
Definition: bufr2tac.h:323
char alphanum4[REPORT_LENGTH]
Definition: bufr2tac.h:327
contains all possible substrings from a synop report is parsed with success
Definition: metsynop.h:293
Store the whole TEMP report.
Definition: mettemp.h:511
Stores the array of all data profile points as it in bufr sequence.
Definition: mettemp.h:213
array of Wind shear data points at a pressure level
Definition: mettemp.h:238
WIGOS station identifier.
Definition: metcommon.h:46