Skip to content

Commit 22c1abe

Browse files
committed
Glidepath is degrees (not 100ths) in CSV format; change raw stored value to degrees
1 parent d587540 commit 22c1abe

5 files changed

Lines changed: 16 additions & 16 deletions

File tree

Sources/SwiftNASR/Models/Records/Airport/RunwayEnd+Measurement.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public extension RunwayEnd {
88

99
/// The glidepath angle for a visual approach as a Measurement.
1010
var visualGlidepath: Measurement<UnitAngle>? {
11-
visualGlidepathHundredthsDeg.map { Measurement(value: Double($0) / 100.0, unit: .degrees) }
11+
visualGlidepathDeg.map { Measurement(value: Double($0), unit: .degrees) }
1212
}
1313

1414
/// The distance between the runway end and displaced threshold as a Measurement.

Sources/SwiftNASR/Models/Records/Airport/RunwayEnd.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public struct RunwayEnd: Record {
3535
/// The height of the visual glidepath above the runway threshold (feet AGL).
3636
public let thresholdCrossingHeightFtAGL: UInt?
3737

38-
/// The glidepath angle for a visual approach (hundredths of degrees).
39-
public let visualGlidepathHundredthsDeg: Float?
38+
/// The glidepath angle for a visual approach (degrees).
39+
public let visualGlidepathDeg: Float?
4040

4141
/// The location and elevation of the displaced threshold, which is the
4242
/// start of the landing portion of the runway.
@@ -144,7 +144,7 @@ public struct RunwayEnd: Record {
144144
markingCondition: Self.MarkingCondition?,
145145
threshold: Location?,
146146
thresholdCrossingHeightFtAGL: UInt?,
147-
visualGlidepathHundredthsDeg: Float?,
147+
visualGlidepathDeg: Float?,
148148
displacedThreshold: Location?,
149149
thresholdDisplacementFt: UInt?,
150150
touchdownZoneElevationFtMSL: Float?,
@@ -181,7 +181,7 @@ public struct RunwayEnd: Record {
181181
self.markingCondition = markingCondition
182182
self.threshold = threshold
183183
self.thresholdCrossingHeightFtAGL = thresholdCrossingHeightFtAGL
184-
self.visualGlidepathHundredthsDeg = visualGlidepathHundredthsDeg
184+
self.visualGlidepathDeg = visualGlidepathDeg
185185
self.displacedThreshold = displacedThreshold
186186
self.thresholdDisplacementFt = thresholdDisplacementFt
187187
self.touchdownZoneElevationFtMSL = touchdownZoneElevationFtMSL
@@ -703,7 +703,7 @@ public struct RunwayEnd: Record {
703703
/// Fields that per-field remarks can be associated with.
704704
public enum Field: String, RemarkField {
705705
case id, heading, instrumentLandingSystem, rightTraffic, marking, markingCondition,
706-
threshold, thresholdCrossingHeightFtAGL, visualGlidepathHundredthsDeg, displacedThreshold,
706+
threshold, thresholdCrossingHeightFtAGL, visualGlidepathDeg, displacedThreshold,
707707
thresholdDisplacementFt, touchdownZoneElevationFtMSL, gradientPct, TORAFt, TODAFt, ASDAFt,
708708
LDAFt, LAHSO,
709709
visualGlideslopeIndicator, RVRSensors, hasRVV, approachLighting, hasREIL,
@@ -721,7 +721,7 @@ public struct RunwayEnd: Record {
721721
order.append(contentsOf: [
722722
.id, .heading, .instrumentLandingSystem, .rightTraffic, .marking, .markingCondition,
723723
.threshold, .threshold, .threshold, .threshold, .threshold, .thresholdCrossingHeightFtAGL,
724-
.visualGlidepathHundredthsDeg, .displacedThreshold, .displacedThreshold,
724+
.visualGlidepathDeg, .displacedThreshold, .displacedThreshold,
725725
.displacedThreshold,
726726
.displacedThreshold, .displacedThreshold, .thresholdDisplacementFt,
727727
.touchdownZoneElevationFtMSL,
@@ -750,7 +750,7 @@ public struct RunwayEnd: Record {
750750

751751
private enum CodingKeys: String, CodingKey {
752752
case id, heading, instrumentLandingSystem, rightTraffic, marking, markingCondition,
753-
threshold, thresholdCrossingHeightFtAGL, visualGlidepathHundredthsDeg, displacedThreshold,
753+
threshold, thresholdCrossingHeightFtAGL, visualGlidepathDeg, displacedThreshold,
754754
thresholdDisplacementFt, touchdownZoneElevationFtMSL, visualGlideslopeIndicator, RVRSensors,
755755
hasRVV,
756756
approachLighting, hasREIL, hasCenterlineLighting, hasEndTouchdownLighting, controllingObject,

Sources/SwiftNASR/Parsers/CSV/Parsers/CSVAirportParser.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ actor CSVAirportParser: CSVParser {
637637
markingCondition: nil,
638638
threshold: nil,
639639
thresholdCrossingHeightFtAGL: nil,
640-
visualGlidepathHundredthsDeg: nil,
640+
visualGlidepathDeg: nil,
641641
displacedThreshold: nil,
642642
thresholdDisplacementFt: nil,
643643
touchdownZoneElevationFtMSL: nil,
@@ -830,7 +830,7 @@ actor CSVAirportParser: CSVParser {
830830
// Parse threshold crossing height
831831
let thresholdCrossingHeight: UInt? = try t[optional: "THR_CROSSING_HGT"]
832832

833-
// Parse visual glidepath angle
833+
// Parse visual glidepath angle (CSV stores degrees directly)
834834
let visualGlidepath: Float? = try t[optional: "VISUAL_GLIDE_PATH_ANGLE"]
835835

836836
// Parse displaced threshold
@@ -922,7 +922,7 @@ actor CSVAirportParser: CSVParser {
922922
markingCondition: markingCondition,
923923
threshold: threshold,
924924
thresholdCrossingHeightFtAGL: thresholdCrossingHeight,
925-
visualGlidepathHundredthsDeg: visualGlidepath,
925+
visualGlidepathDeg: visualGlidepath,
926926
displacedThreshold: displacedThreshold,
927927
thresholdDisplacementFt: thresholdDisplacement,
928928
touchdownZoneElevationFtMSL: touchdownZoneElevation,

Sources/SwiftNASR/Parsers/Record Parsers/AirportParser/AirportParser+RunwayEnd.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ extension FixedWidthAirportParser {
177177
thresholdLon: Float? = try t[optional: offset1 + 8],
178178
thresholdElev: Float? = try t[optional: offset1 + 10],
179179
thresholdCrossingHeightFtAGL: UInt? = try t[optional: offset1 + 11],
180-
visualGlidepathHundredthsDeg: Float? = try t[optional: offset1 + 12],
180+
visualGlidepathHundredths: Float? = try t[optional: offset1 + 12],
181181
displacedThresholdLat: Float? = try t[optional: offset1 + 13],
182182
displacedThresholdLon: Float? = try t[optional: offset1 + 15],
183183
displacedThresholdElev: Float? = try t[optional: offset1 + 17],
@@ -313,7 +313,7 @@ extension FixedWidthAirportParser {
313313
markingCondition: markingCondition,
314314
threshold: threshold,
315315
thresholdCrossingHeightFtAGL: thresholdCrossingHeightFtAGL,
316-
visualGlidepathHundredthsDeg: visualGlidepathHundredthsDeg,
316+
visualGlidepathDeg: visualGlidepathHundredths.map { $0 / 100.0 },
317317
displacedThreshold: displacedThreshold,
318318
thresholdDisplacementFt: thresholdDisplacementFt,
319319
touchdownZoneElevationFtMSL: touchdownZoneElevationFtMSL,

Sources/SwiftNASR/Parsers/Record Parsers/NavaidParser.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ func parseNavaidFrequencyToHz(_ frequencyString: String?, navaidType: Navaid.Fac
3131
guard let kHz = UInt(frequencyString) else { return nil }
3232
return kHz * 1000
3333
}
34-
// Input is in MHz (e.g., "113.00"), output in Hz
35-
guard let MHz = Double(frequencyString) else { return nil }
36-
return UInt(MHz * 1_000_000)
34+
// Input is in MHz (e.g., "113.00"), output in Hz
35+
guard let MHz = Double(frequencyString) else { return nil }
36+
return UInt(MHz * 1_000_000)
3737
}
3838

3939
enum NavaidRecordIdentifier: String {

0 commit comments

Comments
 (0)