WXP C++ Library Version 6.74.6
Loading...
Searching...
No Matches
SfcData.h
1#ifndef _WINC_SFCDATA
2#define _WINC_SFCDATA
3
4#include <stdlib.h>
5
6#include <WXP/CloudLayer.h>
7#include <WXP/Date.h>
8#include <WXP/StrLib.h>
9#include <WXP/String.h>
10
11namespace WXP {
12 class SfcData {
13 public:
14 static const int comment_len = 100;
15 private:
16 char id[11]; /* Station identifier */
17 char name[25]; /* Long name for station */
18 char area[11]; /* Regional identifier */
19 int type; /* Report type (e.g. METAR, SA, SYNOP) */
20 int stype; /* Report subtype (e.g. SPECIAL, AUTO) */
21 long wmo; /* WMO station number */
22 float lat; /* Station latitude */
23 float lon; /* Station longitude */
24 float elev; /* Station elevation */
25 int prior; /* Station plotting priority */
26 Date date; /* Observation time */
27 int flag; /* Data flag */
28
29 float t; /* Temperature in C */
30 float td; /* Dewpoint in C */
31 float dir; /* Wind direction in Deg */
32 float spd; /* Wind speed in knt */
33 float gust; /* Wind gust in knt */
34 float slp; /* Sea level pressure in mb */
35 float alt; /* Altimeter setting in inHg */
36 float vis; /* Visibility in miles */
37 CloudLayer cloud[5]; /* Cloud layers */
38 int num_cld; /* Number of cloud layers */
39 char weather[21]; /* Type of weather */
40 int ptend_type; /* Type of pressure tendency */
41 float ptend; /* Pressure tendency */
42 float prec3; /* 3 hour precipitation in mm */
43 float prec6; /* 6 hour precipitation in mm */
44 float prec12; /* 12 hour precipitation in mm */
45 float prec24; /* 24 hour precipitation in mm */
46 float prec; /* XX hour precipitation in mm */
47 int prec_per; /* Period of time prec is valid */
48 int cld_low; /* Percent of low cloud cover */
49 char cld_type[3]; /* Low, medium and high level cloud types */
50 float max_t; /* Maximum temperature in C */
51 float min_t; /* Minimum temperature in C */
52 float max6_t; /* 6 hour Maximum temperature in C */
53 float min6_t; /* 6 hour Minimum temperature in C */
54 float snow_cov; /* Snow cover information in cm */
55 float solar; /* Total minutes of sunshine */
56 float sst; /* Sea surface temperature in C */
57 float wav_per; /* Sea wave period */
58 float wav_hgt; /* Sea wave height in m */
59 char comment[comment_len];/* The comment field */
60
61 public:
62 SfcData();
63 int init( );
64 inline int setId( const char *str ){
65 StrLib::copy( id, 10, str ); return 1; };
66 inline const char *getId(){ return id; };
67
68 inline int setArea( const char *str ){
69 StrLib::copy( area, 10, str ); return 1; };
70 inline const char *getArea(){ return area; };
71
72 inline int setName( const char *str ){
73 StrLib::copy( name, 10, str ); return 1; };
74 inline const char *getName(){ return name; };
75
76 inline int setWmo( const char *str ){ wmo = atol( str ); return 1; };
77 inline int getWmo(){ return wmo; };
78
79 inline int setLoc( float rlat, float rlon ){
80 lat = rlat; lon = rlon; return 1; };
81
82 inline float getLat(){ return lat; }
83 inline float getLon(){ return lon; }
84
85 inline int setElev( float el ){ elev = el; return 1; }
86 inline float getElev(){ return elev; }
87
88 inline int setDate( Date rdate ){ date = rdate; return 1; }
89 int getDate( Date &rdate );
90 inline Date getDate(){ return date; }
91 int getTime();
92 int getHour();
93 int getSeconds();
94
95 inline int setType( int rtype ){ type = rtype; return 1; }
96 inline int getType(){ return type; }
97
98 inline int setT( float rt ){ t = rt; return 1; }
99 inline float getT(){ return t; }
100
101 inline int setTd( float rtd ){ td = rtd; return 1; }
102 inline float getTd(){ return td; }
103
104 inline int setDir( float rdir ){ dir = rdir; return 1; }
105 inline float getDir(){ return dir; }
106
107 inline int setSpd( float rspd ){ spd = rspd; return 1; }
108 inline float getSpd(){ return spd; }
109
110 inline int setGust( float rgust ){ gust = rgust; return 1; }
111 inline float getGust(){ return gust; }
112
113 inline int setAlt( float ralt ){ alt = ralt; return 1; }
114 inline float getAlt(){ return alt; }
115
116 inline int setSlp( float rslp ){ slp = rslp; return 1; }
117 inline float getSlp(){ return slp; }
118
119 inline int setVis( float rvis ){ vis = rvis; return 1; }
120 inline float getVis(){ return vis; }
121
122 inline int setWeather( const char *wx ){
123 StrLib::copy( weather, 21, wx ); return 1; }
124 inline const char *getWeather(){ return weather; }
125 int weatherText( String &str );
126
127 inline int setNumCld( int num ){ num_cld = num; return 1; }
128 inline int getNumCld(){ return num_cld; }
129
130 int setCldHeight( int ind, float height );
131 float getCldHeight( int ind );
132 float getCldHeight();
133 int setCldCover( int ind, char cover );
134 char getCldCover( int ind );
135 char getCldCover();
136
137 inline int setPtendType( int type ){ ptend_type = type; return 1; }
138 inline int getPtendType(){ return ptend_type; }
139
140 inline int setPtend( float rptend ){ ptend = rptend; return 1; }
141 inline float getPtend(){ return ptend; }
142
143 inline int setPrec3( float val ){ prec3 = val; return 1; }
144 inline float getPrec3(){ return prec3; }
145
146 inline int setPrec6( float val ){ prec6 = val; return 1; }
147 inline float getPrec6(){ return prec6; }
148
149 inline int setPrec12( float val ){ prec12 = val; return 1; }
150 inline float getPrec12(){ return prec12; }
151
152 inline int setPrec24( float val ){ prec24 = val; return 1; }
153 inline float getPrec24(){ return prec24; }
154
155 inline int setPrec( float val ){ prec = val; return 1; }
156 inline float getPrec(){ return prec; }
157
158 inline int setPrecPer( int per ){ prec_per = per; return 1; }
159 inline int getPrecPer(){ return prec_per; }
160
161 inline int setCldLow( int low ){ cld_low = low; return 1; }
162 inline int getCldLow(){ return cld_low; }
163
164 int setCldType( int ind, char type );
165 char getCldType( int ind );
166
167 inline int setMaxT( float t ){ max_t = t; return 1; }
168 inline float getMaxT(){ return max_t; }
169
170 inline int setMinT( float t ){ min_t = t; return 1; }
171 inline float getMinT(){ return min_t; }
172
173 inline int setMax6T( float t ){ max6_t = t; return 1; }
174 inline float getMax6T(){ return max6_t; }
175
176 inline int setMin6T( float t ){ min6_t = t; return 1; }
177 inline float getMin6T(){ return min6_t; }
178
179 inline int setSnowCov( float snow ){ snow_cov = snow; return 1; }
180 inline float getSnowCov(){ return snow_cov; }
181
182 inline int setSolar( float solar ){ solar = solar; return 1; }
183 inline float getSolar(){ return solar; }
184
185 inline int setSst( float sst ){ sst = sst; return 1; }
186 inline float getSst(){ return sst; }
187
188 inline int setWavPer( float wav_per ){ wav_per = wav_per; return 1; }
189 inline float getWavPer(){ return wav_per; }
190
191 inline int setWavHgt( float wav_hgt ){ wav_hgt = wav_hgt; return 1; }
192 inline float getWavHgt(){ return wav_hgt; }
193
194 int setComment( const char *str );
195 int addComment( const char *str );
196 int addComment( const char *str, int num );
197 const char *getComment();
198 int setFlag( int val );
199 int orFlag( int val );
200 int getFlag();
201 int print();
202 int printLine();
203 int outString( String &str );
204 int update( SfcData &rep, int lev );
205 inline int update( SfcData &rep ){ return update( rep, 0xFFFF ); };
206 int validate();
207
208 static int compare( SfcData &rep1, SfcData &rep2 );
209 static int printDiff( int diff );
210
211 friend class SfcDataTool;
212 friend class SfcDecode;
213 friend class MetarTool;
214 friend class SynopTool;
215 friend class SaoTool;
216 friend class SfcFile;
217 friend class SfcWxpFile;
218 friend class SfcCdfFile;
219 friend class SfcXmlFile;
220 /*
221 Define data locations
222 */
223 enum Locate { USA, CANADA, MEXICO, OTHER };
224
225 enum StatType { MANNED, AMOS, ASOS, AWOS };
226
227 enum RepType {
228 UNK,
229 METAR,
230 SPECI,
231 SA,
232 SP,
233 SYNOP,
234 SHIP,
235 BUOY,
236 DRIBU,
237 MOBIL,
238 CMAN,
239 MISC
240 };
241 // Define special flags
242 static const int RMK = 0x1;
243 static const int TGRP = 0x2;
244
245 static const int SPECIAL = 1;
246 static const int CORRECT = 2;
247 static const int AUTO = 4;
248
249 static const int DF_TYPE = 1;
250 static const int DF_TIME = 1 << 1;
251 static const int DF_TEMP = 1 << 2;
252 static const int DF_PRES = 1 << 3;
253 static const int DF_WIND = 1 << 4;
254 static const int DF_WX = 1 << 5;
255 static const int DF_CLD = 1 << 6;
256 static const int DF_VIS = 1 << 7;
257 static const int DF_PTND = 1 << 8;
258 static const int DF_PREC = 1 << 9;
259 static const int DF_EXTT = 1 << 10;
260 static const int DF_SNOW = 1 << 11;
261 static const int DF_SOL = 1 << 12;
262 static const int DF_SEA = 1 << 13;
263 static const int DF_CTYP = 1 << 14;
264 static const int DF_COM = 1 << 15;
265 };
266}
267#endif
This class stores date and time information.
Definition: Date.h:8
This class is a set of tools to manage METAR data.
Definition: MetarTool.h:8
This class is a set of tools to manage METAR data.
Definition: SaoTool.h:10
This class reads in surface data from a netCDF file.
Definition: SfcCdfFile.h:9
This class processes data from SfcData class.
Definition: SfcDataTool.h:9
This class stores surface data.
Definition: SfcData.h:12
int validate()
Definition: SfcData.cc:882
SfcData()
Definition: SfcData.cc:29
int outString(String &str)
Definition: SfcData.cc:417
int print()
Definition: SfcData.cc:291
static int compare(SfcData &rep1, SfcData &rep2)
Definition: SfcData.cc:545
int weatherText(String &str)
Definition: SfcData.cc:120
int printLine()
Definition: SfcData.cc:407
int init()
Definition: SfcData.cc:36
int update(SfcData &rep, int lev)
Definition: SfcData.cc:708
This class decodes METAR, SAO and SYNOP data files.
Definition: SfcDecode.h:11
This class reads in surface data from a file from file.
Definition: SfcFile.h:12
This class reads in surface data from a WXP formatted file from file.
Definition: SfcWxpFile.h:9
This class reads in surface data from a WXP formatted file from file.
Definition: SfcXmlFile.h:11
static int copy(char *s1, int len1, const char s2)
Definition: StrLib.cc:506
This is a variable length string class.
Definition: String.h:5
This class is a set of tools to manage SYNOP data.
Definition: SynopTool.h:8
All WXP classes fall under the WXP namespace.
Definition: Angle.h:4
This struct stores cloud layer data.
Definition: CloudLayer.h:5