bufr2synop 0.24.0
Functions
bufr2tac_xml.c File Reference

Output a struct metreport in xml form. More...

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

Go to the source code of this file.

Functions

int print_xml_alphanum (FILE *f, char *type, char *alphanum, struct metreport *m)
 
int print_xml (FILE *f, struct metreport *m)
 prints a struct metreport in xml format More...
 

Detailed Description

Output a struct metreport in xml form.

Definition in file bufr2tac_xml.c.

Function Documentation

◆ print_xml()

int print_xml ( FILE *  f,
struct metreport m 
)

prints a struct metreport in xml format

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

Definition at line 71 of file bufr2tac_xml.c.

72{
73 // Single report
74 if ( m->alphanum[0] )
75 {
76 print_xml_alphanum ( f, m->type, m->alphanum, m );
77 }
78
79 if ( m->alphanum2[0] ) //TTBB
80 {
81 print_xml_alphanum ( f, m->type2, m->alphanum2, m );
82 }
83
84 if ( m->alphanum3[0] ) //TTCC
85 {
86 print_xml_alphanum ( f, m->type3, m->alphanum3, m );
87 }
88
89 if ( m->alphanum4[0] ) //TTDD
90 {
91 print_xml_alphanum ( f, m->type4, m->alphanum4, m );
92 }
93
94 return 0;
95}
int print_xml_alphanum(FILE *f, char *type, char *alphanum, struct metreport *m)
Definition: bufr2tac_xml.c:28
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_xml_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_xml_alphanum()

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

Definition at line 28 of file bufr2tac_xml.c.

29{
30 // prints header
31 fprintf ( f, "<metreport type=%s>\n", type );
32 // print GTS_HEADER
33 if ( m->h != NULL )
34 {
35 fprintf ( f, "<bufrfile>%s</bufrfile>\n",m->h->filename );
36 fprintf ( f, " <gts_header>%s %s %s %s</gts_header>\n",m->h->bname, m->h->center, m->h->dtrel, m->h->order );
37 }
38 // print DATE AND TIME
39 fprintf ( f, " <observation_datetime>%s</observation_datetime>\n",m->t.datime );
40
41 // Geo data
42 fprintf ( f, " <geo>\n" );
43 if ( strlen ( m->g.index ) )
44 {
45 fprintf ( f, " <index>%s</index>\n", m->g.index );
46 }
47 if ( strlen ( m->g.name ) )
48 {
49 fprintf ( f, " <name>%s</name>\n", m->g.name );
50 }
51 if ( strlen ( m->g.country ) )
52 {
53 fprintf ( f, " <country>%s</country>\n", m->g.country );
54 }
55 fprintf ( f, " <latitude>%.6lf</latitude>\n", m->g.lat );
56 fprintf ( f, " <longitude>%.6lf</longitude>\n", m->g.lon );
57 fprintf ( f, " <altitude>%.1lf</altitude>\n", m->g.alt );
58 fprintf ( f, " </geo>\n" );
59 fprintf ( f, " <report>%s=</report>\n", alphanum );
60 fprintf ( f, "</metreport>\n" );
61 return 0;
62}
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_xml().

Here is the caller graph for this function: