-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeatherReading.java
269 lines (222 loc) · 5.86 KB
/
WeatherReading.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
package com.deange.uwaterlooapi.model.weather;
import android.os.Parcel;
import android.os.Parcelable;
import com.deange.uwaterlooapi.model.BaseModel;
import com.deange.uwaterlooapi.utils.DateUtils;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
public class WeatherReading
extends BaseModel
implements
Parcelable {
public static final String PRESSURE_STEADY = "steady";
public static final String PRESSURE_RISING = "rising";
public static final String PRESSURE_FALLING = "falling";
@SerializedName("latitude")
float mLatitude;
@SerializedName("longitude")
float mLongitude;
@SerializedName("elevation_m")
float mElevation;
@SerializedName("observation_time")
String mObservationTime;
@SerializedName("temperature_current_c")
float mTemperature;
@SerializedName("humidex_c")
float mHumidex;
@SerializedName("windchill_c")
float mWindchill;
@SerializedName("temperature_24hr_max_c")
float mTemperature24hMax;
@SerializedName("temperature_24hr_min_c")
float mTemperature24hMin;
@SerializedName("precipitation_15min_mm")
float mPrecipitation15Min;
@SerializedName("precipitation_1hr_mm")
float mPrecipitation1Hr;
@SerializedName("precipitation_24hr_mm")
float mPrecipitation24Hr;
@SerializedName("relative_humidity_percent")
float mRelativeHumidity;
@SerializedName("dew_point_c")
float mDewPoint;
@SerializedName("wind_speed_kph")
float mWindSpeed;
@SerializedName("wind_direction")
String mWindDirection;
@SerializedName("pressure_kpa")
float mPressureKpa;
@SerializedName("pressure_trend")
String mPressureTrend;
@SerializedName("incoming_shortwave_radiation_wm2")
float mShortWaveRadiation;
protected WeatherReading(final Parcel in) {
super(in);
mLatitude = in.readFloat();
mLongitude = in.readFloat();
mElevation = in.readFloat();
mObservationTime = in.readString();
mTemperature = in.readFloat();
mHumidex = in.readFloat();
mWindchill = in.readFloat();
mTemperature24hMax = in.readFloat();
mTemperature24hMin = in.readFloat();
mPrecipitation15Min = in.readFloat();
mPrecipitation1Hr = in.readFloat();
mPrecipitation24Hr = in.readFloat();
mRelativeHumidity = in.readFloat();
mDewPoint = in.readFloat();
mWindSpeed = in.readFloat();
mWindDirection = in.readString();
mPressureKpa = in.readFloat();
mPressureTrend = in.readString();
mShortWaveRadiation = in.readFloat();
}
@Override
public void writeToParcel(final Parcel dest, final int flags) {
super.writeToParcel(dest, flags);
dest.writeFloat(mLatitude);
dest.writeFloat(mLongitude);
dest.writeFloat(mElevation);
dest.writeString(mObservationTime);
dest.writeFloat(mTemperature);
dest.writeFloat(mHumidex);
dest.writeFloat(mWindchill);
dest.writeFloat(mTemperature24hMax);
dest.writeFloat(mTemperature24hMin);
dest.writeFloat(mPrecipitation15Min);
dest.writeFloat(mPrecipitation1Hr);
dest.writeFloat(mPrecipitation24Hr);
dest.writeFloat(mRelativeHumidity);
dest.writeFloat(mDewPoint);
dest.writeFloat(mWindSpeed);
dest.writeString(mWindDirection);
dest.writeFloat(mPressureKpa);
dest.writeString(mPressureTrend);
dest.writeFloat(mShortWaveRadiation);
}
public static final Creator<WeatherReading> CREATOR = new Creator<WeatherReading>() {
@Override
public WeatherReading createFromParcel(final Parcel in) {
return new WeatherReading(in);
}
@Override
public WeatherReading[] newArray(final int size) {
return new WeatherReading[size];
}
};
/**
* Station's latitude + longitude
*/
public float[] getLocation() {
return new float[]{mLatitude, mLongitude};
}
/**
* Station elevation in meters
*/
public float getElevation() {
return mElevation;
}
/**
* ISO 8601 timestamp of weather recordings
*/
public Date getObservationTime() {
return DateUtils.parseDate(mObservationTime);
}
/**
* ISO 8601 timestamp of weather recordings as a string
*/
public String getRawObservationTime() {
return mObservationTime;
}
/**
* Current temperature in celsius
*/
public float getTemperature() {
return mTemperature;
}
/**
* Humidex temperature in celsius
*/
public float getHumidex() {
return mHumidex;
}
/**
* Windchill in celsius
*/
public float getWindchill() {
return mWindchill;
}
/**
* 24 hour maximum temperature in celsius
*/
public float getTemperature24hMax() {
return mTemperature24hMax;
}
/**
* 24 hour minimum temperature in celsius
*/
public float getTemperature24hMin() {
return mTemperature24hMin;
}
/**
* Precipitation reading for 15 minute interval in mm
*/
public float getPrecipitation15Min() {
return mPrecipitation15Min;
}
/**
* Precipitation reading for 1 hour interval in mm
*/
public float getPrecipitation1Hr() {
return mPrecipitation1Hr;
}
/**
* Precipitation reading for every 24 hour interval in mm
*/
public float getPrecipitation24Hr() {
return mPrecipitation24Hr;
}
/**
* Relative humidity in percentage
*/
public float getRelativeHumidity() {
return mRelativeHumidity;
}
/**
* Dew point in celsius
*/
public float getDewPoint() {
return mDewPoint;
}
/**
* Wind speed in km per hour
*/
public float getWindSpeed() {
return mWindSpeed;
}
/**
* Wind direction
*/
public String getWindDirection() {
return mWindDirection;
}
/**
* Pressure in kilopascals
*/
public float getPressureKpa() {
return mPressureKpa;
}
/**
* Word description of the current pressure trend
*/
public String getPressureTrend() {
return mPressureTrend;
}
/**
* Incoming radiation in watts per meter square
*/
public float getShortWaveRadiation() {
return mShortWaveRadiation;
}
}