]> git.mxchange.org Git - flightgear.git/blob - src/WeatherCM/FGWeatherParse.h
One more pass at a reorg.
[flightgear.git] / src / WeatherCM / FGWeatherParse.h
1 /*****************************************************************************
2
3  Header:       FGWeatherParse.h 
4  Author:       Christian Mayer
5  Date started: 28.05.99
6
7  -------- Copyright (C) 1999 Christian Mayer (fgfs@christianmayer.de) --------
8
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  details.
18
19  You should have received a copy of the GNU General Public License along with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA  02111-1307, USA.
22
23  Further information about the GNU General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 FUNCTIONAL DESCRIPTION
27 ------------------------------------------------------------------------------
28 Parse the weather that can be downloaded from 
29
30     http://129.13.102.67/out/flight/yymmddhhdata.txt.gz
31
32 where yy stands for the year, mm for the month, dd for the day and hh for the
33 hour.
34 The columns are explained at
35
36     http://129.13.102.67/out/flight/kopf.txt
37
38 and a list of the stations can be found at
39
40     http://129.13.102.67/out/flight/wmoconv.txt.gz
41
42 Many thanks to Georg Mueller (Georg.Mueller@imk.fzk.de) of the 
43
44     Institut fuer Meteorologie und Klimaforschung, Universitaet Karlsruhe
45
46 for makeking such a service aviable. 
47 You can also visit his homepage at http://www.wetterzentrale.de
48
49 HISTORY
50 ------------------------------------------------------------------------------
51 18.10.1999 Christian Mayer      Created
52 14.12.1999 Christian Mayer      minor internal changes
53 *****************************************************************************/
54
55 /****************************************************************************/
56 /* SENTRY                                                                   */
57 /****************************************************************************/
58 #ifndef FGWeatherParse_H
59 #define FGWeatherParse_H
60
61 /****************************************************************************/
62 /* INCLUDES                                                                 */
63 /****************************************************************************/
64 #include <simgear/compiler.h>
65 #include <vector>
66
67 #include <simgear/misc/fgstream.hxx>
68
69 #include "FGPhysicalProperties.h"
70
71 /****************************************************************************/
72 /* DEFINES                                                                  */
73 /****************************************************************************/
74 FG_USING_STD(vector);
75
76 /****************************************************************************/
77 /* CLASS DECLARATION                                                        */
78 /****************************************************************************/
79 class FGWeatherParse
80 {
81 public:
82     struct entry;
83
84 private:
85     vector<entry> weather_station;
86
87 protected:
88 public:
89     /************************************************************************/
90     /* A line (i.e. entry) in the data file looks like:                     */
91     /*  yyyy mm dd hh XXXXX BBBBB LLLLLL UUUUU VVVVV TTTTT DDDDD PPPPP pppp */
92     /************************************************************************/
93     struct entry
94     {
95         int year;                       // The yyyy
96         int month;                      // The mm
97         int day;                        // The dd
98         int hour;                       // The hh
99         unsigned int station_number;    // The XXXXX
100         float lat;                      // The BBBBBB   negative = south
101         float lon;                      // The LLLLLLL  negative = west 
102         float x_wind;                   // The UUUUU    negative = to the weat
103         float y_wind;                   // The VVVVV    negative = to the south
104         float temperature;              // The TTTTT    in degC
105         float dewpoint;                 // The DDDDD    in degC
106         float airpressure;              // The PPPPP    in hPa
107         float airpressure_history[4];   // The pppp     in hPa
108     };
109
110     FGWeatherParse();
111     ~FGWeatherParse();
112
113     void input(const char *file);
114
115     unsigned int stored_stations(void) const
116     {
117         return weather_station.size();
118     }
119
120     entry getEntry(const unsigned int nr) const
121     {
122         return weather_station[nr];
123     }
124
125     FGPhysicalProperties getFGPhysicalProperties(const unsigned int nr) const;
126     void getPosition(const unsigned int nr, sgVec2 pos) const;
127 };
128
129 /****************************************************************************/
130 #endif /*FGWeatherParse_H*/