Skip to content

Commit c57a331

Browse files
committed
Add some utility functions
1 parent 4ef9a56 commit c57a331

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Sources/SwiftMETAR/Common/Weather.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ public struct Weather: Codable, Equatable, Sendable {
5959

6060
/// Another "pseudo-intensity" for heavy phenomena in the vicinity.
6161
case vicinityHeavy = "+VC"
62+
63+
/// `true` if this is an "in the vicinity" pseudo-intensity.
64+
public var isVicinity: Bool {
65+
self == .vicinity || self == .vicinityLight || self == .vicinityHeavy
66+
}
6267
}
6368

6469
/// Qualifiers for precipitation phenomena. Most are not applied to

Sources/SwiftMETAR/Remarks/Remark.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ public enum Remark: Codable, Equatable, Sendable {
430430

431431
/// The distance, in statute miles.
432432
public let distance: UInt
433+
434+
/// The distance, as a measurement.
435+
public var distanceMeasurement: Measurement<UnitLength> {
436+
.init(value: Double(distance), unit: .miles)
437+
}
433438
}
434439

435440
/// A proximity from an observation station.

0 commit comments

Comments
 (0)