diff --git a/README.md b/README.md index 85787c94..ed2325b5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Examples -
+
Code & Docs
diff --git a/generate/version.txt b/generate/version.txt index 399088bf..04b10b4f 100644 --- a/generate/version.txt +++ b/generate/version.txt @@ -1 +1 @@ -2.1.6 +2.1.7 diff --git a/source/csharp/astronomy.csproj b/source/csharp/astronomy.csproj index 69520a43..2fbb4f2e 100644 --- a/source/csharp/astronomy.csproj +++ b/source/csharp/astronomy.csproj @@ -4,7 +4,7 @@ true true CosineKitty.AstronomyEngine - 2.1.6 + 2.1.7 https://github.com/cosinekitty/astronomy Don Cross Astronomy Engine diff --git a/source/js/package.json b/source/js/package.json index eaf965e5..176ce6b2 100644 --- a/source/js/package.json +++ b/source/js/package.json @@ -1,6 +1,6 @@ { "name": "astronomy-engine", - "version": "2.1.6", + "version": "2.1.7", "description": "Astronomy calculation for Sun, Moon, and planets.", "main": "./astronomy.js", "module": "./esm/astronomy.js", diff --git a/source/kotlin/README.md b/source/kotlin/README.md index db6124dc..a8cf69d9 100644 --- a/source/kotlin/README.md +++ b/source/kotlin/README.md @@ -25,7 +25,7 @@ allprojects { Now add the dependency: ```kotlin dependencies { - implementation("io.github.cosinekitty:astronomy:2.1.6") + implementation("io.github.cosinekitty:astronomy:2.1.7") } ``` diff --git a/source/kotlin/build.gradle.kts b/source/kotlin/build.gradle.kts index 441fe131..007e9781 100644 --- a/source/kotlin/build.gradle.kts +++ b/source/kotlin/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "io.github.cosinekitty" -version = "2.1.6" +version = "2.1.7" repositories { mavenCentral() diff --git a/source/kotlin/src/test/kotlin/io/github/cosinekitty/astronomy/Tests.kt b/source/kotlin/src/test/kotlin/io/github/cosinekitty/astronomy/Tests.kt index f11bcb3e..2a6d160e 100644 --- a/source/kotlin/src/test/kotlin/io/github/cosinekitty/astronomy/Tests.kt +++ b/source/kotlin/src/test/kotlin/io/github/cosinekitty/astronomy/Tests.kt @@ -1680,9 +1680,40 @@ class Tests { //---------------------------------------------------------------------------------------- + private fun lunarFractionCase(year: Int, month: Int, day: Int, obscuration: Double) { + // Search for the first lunar eclipse to occur after the given date. + val time = Time(year, month, day, 0, 0, 0.0) + val eclipse = searchLunarEclipse(time) + + // This should be a partial lunar eclipse. + assertTrue(eclipse.kind == EclipseKind.Partial, "$time: expected partial eclipse, but found ${eclipse.kind}") + + // The partial eclipse should always happen within 24 hours of the given date. + val dt = eclipse.peak.ut - time.ut + assertTrue(dt >= 0.0 && dt <= 1.0, "$time: eclipse occurs $dt days after the search time.") + + val diff = eclipse.obscuration - obscuration + assertTrue(abs(diff) < 0.00763, "$time: obscuration error = $diff, expected $obscuration, found ${eclipse.obscuration}") + } + @Test fun `Lunar eclipse obscuration`() { + // Verify calculation of the fraction of the Moon's disc covered by the Earth's umbra during a partial eclipse. + // Data for this is more tedious to gather, because Espenak data does not contain it. + // We already verify fraction=0.0 for penumbral eclipses and fraction=1.0 for total eclipses in LunarEclipseTest. + lunarFractionCase(2010, 6, 26, 0.506) // https://www.timeanddate.com/eclipse/lunar/2010-june-26 + lunarFractionCase(2012, 6, 4, 0.304) // https://www.timeanddate.com/eclipse/lunar/2012-june-4 + lunarFractionCase(2013, 4, 25, 0.003) // https://www.timeanddate.com/eclipse/lunar/2013-april-25 + lunarFractionCase(2017, 8, 7, 0.169) // https://www.timeanddate.com/eclipse/lunar/2017-august-7 + lunarFractionCase(2019, 7, 16, 0.654) // https://www.timeanddate.com/eclipse/lunar/2019-july-16 + lunarFractionCase(2021, 11, 19, 0.991) // https://www.timeanddate.com/eclipse/lunar/2021-november-19 + lunarFractionCase(2023, 10, 28, 0.060) // https://www.timeanddate.com/eclipse/lunar/2023-october-28 + lunarFractionCase(2024, 9, 18, 0.035) // https://www.timeanddate.com/eclipse/lunar/2024-september-18 + lunarFractionCase(2026, 8, 28, 0.962) // https://www.timeanddate.com/eclipse/lunar/2026-august-28 + lunarFractionCase(2028, 1, 12, 0.024) // https://www.timeanddate.com/eclipse/lunar/2028-january-12 + lunarFractionCase(2028, 7, 6, 0.325) // https://www.timeanddate.com/eclipse/lunar/2028-july-6 + lunarFractionCase(2030, 6, 15, 0.464) // https://www.timeanddate.com/eclipse/lunar/2030-june-15 } //---------------------------------------------------------------------------------------- diff --git a/source/python/setup.py b/source/python/setup.py index e3425940..57c7bdab 100644 --- a/source/python/setup.py +++ b/source/python/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( name='astronomy-engine', - version='2.1.6', + version='2.1.7', description='Astronomy calculation for Sun, Moon, and planets.', long_description=open('README.md').read(), long_description_content_type='text/markdown',