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