Skip to content

Commit 324126c

Browse files
committed
Updated units and documentation
1 parent e760883 commit 324126c

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ The following units are supported:
7070
- UK
7171
- Auto (uses the local units for the location for which you are requesting weather data)
7272

73+
More details about the units of each property are available [in the Dark Sky API docs](https://darksky.net/dev/docs/forecast).
74+
7375
You can also choose the language that you want `Forecast` responses to use:
7476

7577
```swift

Source/DataPoint.swift

+28-24
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,49 @@ import Foundation
1111
/// Weather data for a specific location and time.
1212
public struct DataPoint {
1313

14-
/// The time at which this `DataPoint` occurs.
14+
/// The time at which this `DataPoint` begins. `minutely` `DataPoint`s are always aligned to the top of the minute, `hourly` `DataPoint`s to the top of the hour, and `daily` `DataPoint`s to midnight of the day, all according to the local timezone.
1515
public let time: Date
1616

17-
/// A human-readable text summary of the weather.
17+
/// A human-readable text summary of this `DataPoint`.
1818
public let summary: String?
1919

20-
/// A machine-readable summary of the weather suitable for selecting an icon for display.
20+
/// A machine-readable text summary of this data point, suitable for selecting an icon for display.
2121
public let icon: Icon?
2222

23-
/// The time of the last sunrise before the solar noon closest to local noon on the given day. Only defined on `Forecast`'s `daily` `DataPoint`s. Note: near the poles, this may occur on a different day entirely!
23+
/// The time when the sun will rise during a given day. Only defined on `Forecast`'s `daily` `DataPoint`s.
2424
public let sunriseTime: Date?
2525

26-
/// The time of the first sunset after the solar noon closest to local noon on the given day. Only defined on `Forecast`'s `daily` `DataPoint`s. Note: near the poles, this may occur on a different day entirely!
26+
/// The time when the sun will set during a given day. Only defined on `Forecast`'s `daily` `DataPoint`s.
2727
public let sunsetTime: Date?
2828

29-
/// The fractional part of the lunation number of the given day. This can be thought of as the "percentage complete" of the current lunar month. A value of `0` represents a new moon, a value of `0.25` represents a first quarter moon, a value of `0.5` represents a full moon, and a value of `0.75` represents a last quarter moon. The ranges between these values represent waxing crescent, waxing gibbous, waning gibbous, and waning crescent moons, respectively. Only defined on `Forecast`'s `daily` `DataPoint`s.
29+
/// The fractional part of the lunation number during the given day: a value of `0` corresponds to a new moon, `0.25` to a first quarter moon, `0.5` to a full moon, and `0.75` to a last quarter moon. The ranges in between these represent waxing crescent, waxing gibbous, waning gibbous, and waning crescent moons, respectively. Only defined on `Forecast`'s `daily` `DataPoint`s.
3030
public let moonPhase: Float?
3131

32-
/// The distance to the nearest storm in miles. This value is *very approximate* and should not be used in scenarios requiring accurate results. A storm distance of `0` doesn't necessarily refer to a storm at the requested location, but rather a storm in the vicinity of the requested location. Only defined on `Forecast`'s `currently` `DataPoint`s.
32+
/// The approximate distance to the nearest storm. A storm distance of `0` doesn't necessarily refer to a storm at the requested location, but rather a storm in the vicinity of that location. Only defined on `Forecast`'s `currently` `DataPoint`s.
3333
public let nearestStormDistance: Float?
3434

35-
/// The direction of the nearest storm in degrees, with true north at 0º and progressing clockwise. If `nearestStormDistance` is `0`, then this value will be `nil`. The caveats that apply to `nearestStormDistance` apply to this too. Only defined on `Forecast`'s `currently` `DataPoint`s.
35+
/// The approximate direction of the nearest storm in degrees, with true north at 0º and progressing clockwise. If `nearestStormDistance` is `0`, then this value will be `nil`. Only defined on `Forecast`'s `currently` `DataPoint`s.
3636
public let nearestStormBearing: Float?
3737

38-
/// The average expected intensity in inches of liquid water per hour of precipitation occurring at the given time *conditional on probability* (assuming any precipitation occurs at all). A *very* rough guide is that a value of `0` corresponds to no precipitation, `0.002` corresponds to very light precipitation, `0.017` corresponds to light precipitation, `0.1` corresponds to moderate precipitation, and `0.4` corresponds to heavy precipitation.
38+
/// The intensity of precipitation occuring at the given time. This value is *conditional on probability* (that is, assuming any precipitation falls at all) for `minutely` `DataPoint`s, and unconditional otherwise.
3939
public let precipitationIntensity: Float?
4040

41-
/// Maximum expected intensity of precipitation on the given day in inches of liquid water per hour. Only defined on `Forecast`'s `daily` `DataPoint`s.
41+
/// The maximum value of `precipitationIntensity` during a given day. Only defined on `Forecast`'s `daily` `DataPoint`s.
4242
public let precipitationIntensityMax: Float?
4343

44-
/// Time at which the maximum expected intensity of precipitation will occur. Only defined on `Forecast`'s `daily` `DataPoint`s.
44+
/// The time at which `precipitationIntensityMax` occurs during a given day. Only defined on `Forecast`'s `daily` `DataPoint`s.
4545
public let precipitationIntensityMaxTime: Date?
4646

47-
/// Value between `0` and `1` (inclusive) representing the probability of precipitation occurring at the given time.
47+
/// The probability of precipitation occurring, between `0` and `1`, inclusive.
4848
public let precipitationProbability: Float?
4949

50-
/// Type of precipitation occurring at the given time. If `precipIntensity` is `0`, then this will be `nil`.
50+
/// The type of precipitation occurring at the given time. If `precipIntensity` is `0`, then this will be `nil`.
5151
public let precipitationType: Precipitation?
5252

53-
/// The amount of snowfall accumulation expected to occur on the given day, in inches. This will be `nil` if no accumulation is expected. Only defined on `Forecast`'s `hourly` and `daily` `DataPoint`s.
53+
/// The amount of snowfall accumulation expected to occur. This will be `nil` if no accumulation is expected. Only defined on `Forecast`'s `hourly` and `daily` `DataPoint`s.
5454
public let precipitationAccumulation: Float?
5555

56-
/// The temperature at the given time in degrees Fahrenheit. Not defined on `Forecast`'s `daily` `DataPoint`s.
56+
/// The air temperature. Not defined on `Forecast`'s `minutely` `DataPoint`s.
5757
public let temperature: Float?
5858

5959
/// The overnight low temperature. Only defined on `Forecast`'s `daily` `DataPoint`s.
@@ -68,7 +68,7 @@ public struct DataPoint {
6868
/// The time at which the daytime high temperature occurs. Only defined on `Forecast`'s `daily` `DataPoint`s.
6969
public let temperatureHighTime: Date?
7070

71-
/// The apparent or "feels like" temperature at the given time in degrees Fahrenheit. Not defined on `Forecast`'s `daily` `DataPoint`s.
71+
/// The apparent or "feels like" temperature. Not defined on `Forecast`'s `daily` `DataPoint`s.
7272
public let apparentTemperature: Float?
7373

7474
/// The overnight low apparent temperature. Only defined on `Forecast`'s `daily` `DataPoint`s.
@@ -83,25 +83,28 @@ public struct DataPoint {
8383
/// The time at which the daytime high apparent temperature occurs. Only defined on `Forecast`'s `daily` `DataPoint`s.
8484
public let apparentTemperatureHighTime: Date?
8585

86-
/// The dew point at the given time in degrees Fahrenheit.
86+
/// The dew point at the given time.
8787
public let dewPoint: Float?
8888

89-
/// The wind speed at the given time in miles per hour.
89+
/// The wind gust speed.
90+
public let windGust: Float?
91+
92+
/// The wind speed at the given time.
9093
public let windSpeed: Float?
9194

92-
/// The direction that the wind is coming from in degrees, with true north at 0º and progressing clockwise. If `windSpeed` is `0`, then this will be `nil`.
95+
/// The direction that the wind is coming *from* in degrees, with true north at 0º and progressing clockwise. If `windSpeed` is `0`, then this will be `nil`.
9396
public let windBearing: Float?
9497

95-
/// Value between `0` and `1` (inclusive) representing the percentage of sky occluded by clouds. A value of `0` corresponds to a clear sky, `0.4` corresponds to scattered clouds, `0.75` correspond to broken cloud cover, and `1` corresponds to completely overcast skies.
98+
/// The percentage of sky occluded by clouds, between `0` and `1`, inclusive.
9699
public let cloudCover: Float?
97100

98-
/// Value between `0` and `1` (inclusive) representing the relative humidity.
101+
/// The relative humidity, between `0` and `1`, inclusive.
99102
public let humidity: Float?
100103

101-
/// The sea-level air pressure in millibars.
104+
/// The sea-level air pressure.
102105
public let pressure: Float?
103106

104-
/// The average visibility in miles, capped at `10`.
107+
/// The average visibility, capped at 10 miles.
105108
public let visibility: Float?
106109

107110
/// The columnar density of total atomspheric ozone at the given time in Dobson units.
@@ -110,7 +113,7 @@ public struct DataPoint {
110113
/// The UV index.
111114
public let uvIndex: Float?
112115

113-
// The time at which the maximum UV index occurs during the given day.
116+
/// The time at which the maximum UV index occurs during the given day. Only defined on `Forecast`'s `daily` `DataPoint`s.
114117
public let uvIndexTime: Date?
115118

116119
/// Creates a new `DataPoint` from a JSON object.
@@ -180,6 +183,7 @@ public struct DataPoint {
180183
apparentTemperatureHighTime = nil
181184
}
182185
dewPoint = json["dewPoint"] as? Float
186+
windGust = json["windGust"] as? Float
183187
windSpeed = json["windSpeed"] as? Float
184188
windBearing = json["windBearing"] as? Float
185189
cloudCover = json["cloudCover"] as? Float

0 commit comments

Comments
 (0)