Skip to content

Commit 6f25a3d

Browse files
committed
Astronomy Engine v2.1.7: eclipse obscuration
This is my second attempt to release eclipse obscuration. I discovered there was a missing unit test for obscuration for lunar eclipses in the Kotlin library. It has been added.
1 parent 232da2c commit 6f25a3d

File tree

8 files changed

+39
-8
lines changed

8 files changed

+39
-8
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</td>
1111
<td style="text-align: center;"><a href="demo/c/">Examples</a></td>
1212
<td style="text-align: center;">
13-
<div><a href="source/c/"><img src="https://img.shields.io/badge/C%20%2f%20C%2b%2b-v2.1.6-blue" /></a></div>
13+
<div><a href="source/c/"><img src="https://img.shields.io/badge/C%20%2f%20C%2b%2b-v2.1.7-blue" /></a></div>
1414
<div><a href="source/c/">Code &amp; Docs</a></div>
1515
</td>
1616
</tr>

Diff for: generate/version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.6
1+
2.1.7

Diff for: source/csharp/astronomy.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<GenerateDocumentationFile>true</GenerateDocumentationFile>
55
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
66
<PackageId>CosineKitty.AstronomyEngine</PackageId>
7-
<PackageVersion>2.1.6</PackageVersion>
7+
<PackageVersion>2.1.7</PackageVersion>
88
<RepositoryUrl>https://github.com/cosinekitty/astronomy</RepositoryUrl>
99
<Authors>Don Cross</Authors>
1010
<Title>Astronomy Engine</Title>

Diff for: source/js/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "astronomy-engine",
3-
"version": "2.1.6",
3+
"version": "2.1.7",
44
"description": "Astronomy calculation for Sun, Moon, and planets.",
55
"main": "./astronomy.js",
66
"module": "./esm/astronomy.js",

Diff for: source/kotlin/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ allprojects {
2525
Now add the dependency:
2626
```kotlin
2727
dependencies {
28-
implementation("io.github.cosinekitty:astronomy:2.1.6")
28+
implementation("io.github.cosinekitty:astronomy:2.1.7")
2929
}
3030
```
3131

Diff for: source/kotlin/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group = "io.github.cosinekitty"
9-
version = "2.1.6"
9+
version = "2.1.7"
1010

1111
repositories {
1212
mavenCentral()

Diff for: source/kotlin/src/test/kotlin/io/github/cosinekitty/astronomy/Tests.kt

+32-1
Original file line numberDiff line numberDiff line change
@@ -1680,9 +1680,40 @@ class Tests {
16801680

16811681
//----------------------------------------------------------------------------------------
16821682

1683+
private fun lunarFractionCase(year: Int, month: Int, day: Int, obscuration: Double) {
1684+
// Search for the first lunar eclipse to occur after the given date.
1685+
val time = Time(year, month, day, 0, 0, 0.0)
1686+
val eclipse = searchLunarEclipse(time)
1687+
1688+
// This should be a partial lunar eclipse.
1689+
assertTrue(eclipse.kind == EclipseKind.Partial, "$time: expected partial eclipse, but found ${eclipse.kind}")
1690+
1691+
// The partial eclipse should always happen within 24 hours of the given date.
1692+
val dt = eclipse.peak.ut - time.ut
1693+
assertTrue(dt >= 0.0 && dt <= 1.0, "$time: eclipse occurs $dt days after the search time.")
1694+
1695+
val diff = eclipse.obscuration - obscuration
1696+
assertTrue(abs(diff) < 0.00763, "$time: obscuration error = $diff, expected $obscuration, found ${eclipse.obscuration}")
1697+
}
1698+
16831699
@Test
16841700
fun `Lunar eclipse obscuration`() {
1685-
1701+
// Verify calculation of the fraction of the Moon's disc covered by the Earth's umbra during a partial eclipse.
1702+
// Data for this is more tedious to gather, because Espenak data does not contain it.
1703+
// We already verify fraction=0.0 for penumbral eclipses and fraction=1.0 for total eclipses in LunarEclipseTest.
1704+
1705+
lunarFractionCase(2010, 6, 26, 0.506) // https://www.timeanddate.com/eclipse/lunar/2010-june-26
1706+
lunarFractionCase(2012, 6, 4, 0.304) // https://www.timeanddate.com/eclipse/lunar/2012-june-4
1707+
lunarFractionCase(2013, 4, 25, 0.003) // https://www.timeanddate.com/eclipse/lunar/2013-april-25
1708+
lunarFractionCase(2017, 8, 7, 0.169) // https://www.timeanddate.com/eclipse/lunar/2017-august-7
1709+
lunarFractionCase(2019, 7, 16, 0.654) // https://www.timeanddate.com/eclipse/lunar/2019-july-16
1710+
lunarFractionCase(2021, 11, 19, 0.991) // https://www.timeanddate.com/eclipse/lunar/2021-november-19
1711+
lunarFractionCase(2023, 10, 28, 0.060) // https://www.timeanddate.com/eclipse/lunar/2023-october-28
1712+
lunarFractionCase(2024, 9, 18, 0.035) // https://www.timeanddate.com/eclipse/lunar/2024-september-18
1713+
lunarFractionCase(2026, 8, 28, 0.962) // https://www.timeanddate.com/eclipse/lunar/2026-august-28
1714+
lunarFractionCase(2028, 1, 12, 0.024) // https://www.timeanddate.com/eclipse/lunar/2028-january-12
1715+
lunarFractionCase(2028, 7, 6, 0.325) // https://www.timeanddate.com/eclipse/lunar/2028-july-6
1716+
lunarFractionCase(2030, 6, 15, 0.464) // https://www.timeanddate.com/eclipse/lunar/2030-june-15
16861717
}
16871718

16881719
//----------------------------------------------------------------------------------------

Diff for: source/python/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='astronomy-engine',
5-
version='2.1.6',
5+
version='2.1.7',
66
description='Astronomy calculation for Sun, Moon, and planets.',
77
long_description=open('README.md').read(),
88
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)