Skip to content

Commit 8bc8eb6

Browse files
committed
Improve interpretation of bayer greek naming
1 parent 37054da commit 8bc8eb6

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

Sources/SwiftAstro/StarCatalog/StarNamesCatalog.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,15 @@ private extension SwiftAstro.StarNamesCatalog {
106106
}
107107

108108
var bayerGreek: String?
109-
if let greek: String = line.cols(56, 5), greek != "_" {
110-
bayerGreek = greek
109+
if let greek: String = line.cols(56, 5),
110+
greek != "_",
111+
greek.cols(1, 1) != "V"
112+
{
113+
if let flamsteed = Int(greek) {
114+
designations.append(.flamsteed(number: flamsteed))
115+
} else {
116+
bayerGreek = greek
117+
}
111118
}
112119

113120
if let hip: String = line.cols(91, 6), let number = Int(hip) {

Tests/SwiftAstroTests/StarNamesTests.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,22 @@ final class StarNamesCatalogTests: XCTestCase {
5252
XCTAssertNil(wds?.component)
5353
}
5454

55+
func testStarNamesMerope() throws {
56+
let snc = SwiftAstro.StarNamesCatalog()
57+
let merope = try XCTUnwrap(snc.findByName("Merope"))
58+
59+
XCTAssertEqual(merope.name, "Merope")
60+
XCTAssertNil(merope.bayerGreek)
61+
XCTAssertEqual(merope.flamsteedNumber, 23)
62+
}
63+
64+
func testStarNamesPhoenicia() throws {
65+
let snc = SwiftAstro.StarNamesCatalog()
66+
let phoenicia = try XCTUnwrap(snc.findByName("Phoenicia"))
67+
68+
XCTAssertEqual(phoenicia.name, "Phoenicia")
69+
XCTAssertNil(phoenicia.bayerGreek)
70+
XCTAssertEqual(phoenicia.variableNumber, 1703)
71+
}
72+
5573
}

0 commit comments

Comments
 (0)