krz/moonrise

Night-sky companion for iPhone, Apple Watch and Vision Pro: what's up tonight, the Moon, planets, launches and missions, and a Library of the solar system. SwiftUI app with a Cloudflare Workers backend. astronomy cloudflare-workers ios night-sky space swiftui visionos watchos

Packages/MoonriseKit/Tests/SkyEngineTests/GeomagneticTests.swift

21 lines · 733 bytes

 1import Testing
 2@testable import SkyEngine
 3
 4@Test func chicagoIsAboutFiftyOneDegreesGeomagnetic() {
 5    let m = Geomagnetic.latitude(chicago)
 6    #expect(m > 49 && m < 53, "\(m)")
 7    #expect(Geomagnetic.band(chicago) == 50)
 8}
 9
10@Test func southernBandsAreNegative() {
11    // Hobart, Tasmania: the dipole model gives about 49.6° S, so the 45–50° S band.
12    let hobart = Observer(latitude: -42.88, longitude: 147.33)
13    let m = Geomagnetic.latitude(hobart)
14    #expect(m < -45 && m > -55, "\(m)")
15    #expect(Geomagnetic.band(hobart) == -50)
16}
17
18@Test func poleIsNinety() {
19    let pole = Observer(latitude: Geomagnetic.poleLatitude, longitude: Geomagnetic.poleLongitude)
20    #expect(abs(Geomagnetic.latitude(pole) - 90) < 1e-6)
21}