bufr2synop 0.24.0
Functions
bufr2tac_csv.c File Reference

Output a struct metreport in csv labeled form. More...

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

Go to the source code of this file.

Functions

int print_csv_alphanum (FILE *f, char *type, char *alphanum, struct metreport *m)
 
int print_csv (FILE *f, struct metreport *m)
 prints a struct metreport in labeled csv format More...
 

Detailed Description

Output a struct metreport in csv labeled form.

Definition in file bufr2tac_csv.c.

Function Documentation

◆ print_csv()

int print_csv ( FILE *  f,
struct metreport m 
)

prints a struct metreport in labeled csv format

Parameters
fpointer to a file already open by caller routine
mpointer to a struct metreport containing the data to print

Definition at line 85 of file bufr2tac_csv.c.

86{
87 // Single report
88 if ( m->alphanum[0] )
89 {
90 print_csv_alphanum ( f, m->type, m->alphanum, m );
91 }
92
93 if ( m->alphanum2[0] ) //TTBB
94 {
95 print_csv_alphanum ( f, m->type2, m->alphanum2, m );
96 }
97
98 if ( m->alphanum3[0] ) //TTCC
99 {
100 print_csv_alphanum ( f, m->type3, m->alphanum3, m );
101 }
102
103 if ( m->alphanum4[0] ) //TTDD
104 {
105 print_csv_alphanum ( f, m->type4, m->alphanum4, m );
106 }
107
108 return 0;
109}
int print_csv_alphanum(FILE *f, char *type, char *alphanum, struct metreport *m)
Definition: bufr2tac_csv.c:26
char alphanum[REPORT_LENGTH]
Definition: bufr2tac.h:321
char type4[8]
Definition: bufr2tac.h:326
char type[8]
Definition: bufr2tac.h:320
char type3[8]
Definition: bufr2tac.h:324
char type2[8]
Definition: bufr2tac.h:322
char alphanum3[REPORT_LENGTH]
Definition: bufr2tac.h:325
char alphanum2[REPORT_LENGTH]
Definition: bufr2tac.h:323
char alphanum4[REPORT_LENGTH]
Definition: bufr2tac.h:327

References metreport::alphanum, metreport::alphanum2, metreport::alphanum3, metreport::alphanum4, print_csv_alphanum(), metreport::type, metreport::type2, metreport::type3, and metreport::type4.

Referenced by main().

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

◆ print_csv_alphanum()

int print_csv_alphanum ( FILE *  f,
char *  type,
char *  alphanum,
struct metreport m 
)

Definition at line 26 of file bufr2tac_csv.c.

27{
28 // prints header
29 fprintf ( f, "\"%s\",", type );
30 // print GTS_HEADER
31 if ( m->h != NULL )
32 {
33 fprintf ( f, "\"%s\",",m->h->filename );
34 fprintf ( f, "\"%s %s %s %s\",",m->h->bname, m->h->center, m->h->dtrel, m->h->order );
35 }
36 else
37 {
38 fprintf ( f, ",," );
39 }
40 // print DATE AND TIME
41 fprintf ( f, "\"%s\",",m->t.datime );
42
43 // Geo data
44 if ( strlen ( m->g.index ) )
45 {
46 fprintf ( f, "\"%s\",", m->g.index );
47 }
48 else
49 {
50 fprintf ( f, "," );
51 }
52
53 if ( strlen ( m->g.name ) )
54 {
55 fprintf ( f, "\"%s\",", m->g.name );
56 }
57 else
58 {
59 fprintf ( f, "," );
60 }
61
62
63 if ( strlen ( m->g.country ) )
64 {
65 fprintf ( f, "\"%s\",", m->g.country );
66 }
67 else
68 {
69 fprintf ( f, "," );
70 }
71
72 fprintf ( f, "%.6lf,", m->g.lat );
73 fprintf ( f, "%.6lf,", m->g.lon );
74 fprintf ( f, "%.1lf,", m->g.alt );
75 fprintf ( f, "\"%s=\"\n", alphanum );
76 return 0;
77}
char center[8]
Definition: bufrdeco.h:709
char dtrel[16]
Definition: bufrdeco.h:710
char order[8]
Definition: bufrdeco.h:711
char bname[16]
Definition: bufrdeco.h:708
char filename[BUFRDECO_PATH_LENGTH]
Definition: bufrdeco.h:712
char datime[16]
Definition: metcommon.h:63
double lat
Definition: bufr2tac.h:299
double lon
Definition: bufr2tac.h:300
double alt
Definition: bufr2tac.h:301
char index[16]
Definition: bufr2tac.h:296
char name[80]
Definition: bufr2tac.h:297
char country[80]
Definition: bufr2tac.h:298
struct gts_header * h
Definition: bufr2tac.h:313
struct met_datetime t
Definition: bufr2tac.h:314
struct met_geo g
Definition: bufr2tac.h:315

References met_geo::alt, gts_header::bname, gts_header::center, met_geo::country, met_datetime::datime, gts_header::dtrel, gts_header::filename, metreport::g, metreport::h, met_geo::index, met_geo::lat, met_geo::lon, met_geo::name, gts_header::order, and metreport::t.

Referenced by print_csv().

Here is the caller graph for this function: