Skip to content

Commit c0bc2b6

Browse files
committed
Commit for 0.3.0 release
1 parent 2f07137 commit c0bc2b6

File tree

414 files changed

+426
-9590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

414 files changed

+426
-9590
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version: 0.3.0 (Pending Release. Should be done very soon)
1+
## Version: 0.3.0
22
### New Features
33
* Added `wasmJs` target. `wasmWasi` cannot be added yet as kotlinx-datetime does not support `wasmWasi`. Once kotlinx-datetime supports `wasmWasi` I plan to add support for it!
44
* JS compilation now targets ECMAScript 2015.

README.md

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Kastro
22
![Maven Central Version](https://img.shields.io/maven-central/v/dev.jamesyox/kastro)
33
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
4-
[![Kotlin](https://img.shields.io/badge/kotlin-1.9.23-blue.svg?logo=kotlin)](http://kotlinlang.org)
4+
[![Kotlin](https://img.shields.io/badge/kotlin-2.0.10-blue.svg?logo=kotlin)](http://kotlinlang.org)
55

66
Kastro is a Kotlin multiplatform library for calculating astronomical events for the Moon and Sun (Luna and Sol). What makes Kastro special is the lazily evaluated `Sequence`-based implementation, which allows you to use the data in powerful ways. Kastro builds on the work of Richard Körber (shred) in his library commons-suncalc. Much of the math in Kastro comes from commons-suncalc but was ported to common Kotlin.
77

8-
98
> [!NOTE]
109
> For a pure Java API be sure to check out [Richard Körber's project](https://github.com/shred/commons-suncalc)!.
1110
@@ -25,12 +24,12 @@ groupId: `dev.jamesyox`
2524

2625
artifactId: `kastro`
2726

28-
version: `0.2.0`
27+
version: `0.3.0`
2928

3029
## Gradle
3130
If you use Gradle you should be able to add the following to your dependencies to use Kastro:
3231
```kotlin
33-
implementation("dev.jamesyox:kastro:0.2.0")
32+
implementation("dev.jamesyox:kastro:0.3.0")
3433
```
3534

3635
## Solar Phases
@@ -88,6 +87,17 @@ val nextSunset = SolarEventSequence(
8887
requestedSolarEvents = listOf(SolarEvent.Sunset) // Not required but makes calculations more efficient
8988
).first() // This example is safe, but first() can throw on empty sequences!
9089
```
90+
### What time did the sun last set in Denver, CO?
91+
This use case uses the `reverse` parameter to return a `Sequence` that goes backwards in time. All sequences in Kastro support going in reverse chronological order!
92+
```kotlin
93+
val lastSunset = SolarEventSequence(
94+
start = clock.now(),
95+
latitude = latitude,
96+
longitude = longitude,
97+
requestedSolarEvents = listOf(SolarEvent.Sunset), // Not required but makes calculations more efficient,
98+
reverse = true // Sequence goes backwards in time
99+
).first() // This example is safe, but first() can throw on empty sequences!
100+
```
91101

92102
### When is solar noon on December 31st, 2023 in Denver, CO?
93103
```kotlin
@@ -163,14 +173,34 @@ val nextMoonrise = LunarHorizonEventSequence(
163173
).first()
164174
```
165175

176+
### When was the last moonrise in Denver, CO?
177+
```kotlin
178+
val lastMoonrise = LunarHorizonEventSequence(
179+
start = clock.now(),
180+
latitude = latitude,
181+
longitude = longitude,
182+
requestedHorizonEvents = listOf(LunarEvent.HorizonEvent.Moonrise),
183+
reverse = true
184+
).first()
185+
```
186+
166187
### When is the next full moon?
167188
```kotlin
168189
val nextFullMoon = LunarPhaseSequence(
169190
start = clock.now(),
170191
requestedLunarPhases = listOf(LunarEvent.PhaseEvent.FullMoon)
171192
).first()
172193
```
173-
194+
>[!NOTE]
195+
> This example does not require location because moon phases are the same across Earth.
196+
### When was the last full moon?
197+
```kotlin
198+
val lastFullMoon = LunarPhaseSequence(
199+
start = clock.now(),
200+
requestedLunarPhases = listOf(LunarEvent.PhaseEvent.FullMoon),
201+
reverse = true
202+
).first()
203+
```
174204
>[!NOTE]
175205
> This example does not require location because moon phases are the same across Earth.
176206
@@ -184,6 +214,7 @@ val moonList = LunarEventSequence(
184214
limit = 30.days
185215
).toList()
186216
```
217+
187218
### Do any full moons happen on Fridays this year?
188219
```kotlin
189220
val fridayFullMoon = LunarPhaseSequence(
@@ -200,7 +231,7 @@ Kastro guarantees all sequences are ordered by time. This means that events clos
200231
events. This means that if you wanted to execute some code on each sunset (maybe to turn off your lights?) the following
201232
would work.
202233

203-
Please note you will need to add [kotlinx-coroutines](https://github.com/Kotlin/kotlinx.coroutines) as a dependency to do this. Kastro strives to include as few dependencies as possible (really just [kotlinx-datetime](https://github.com/Kotlin/kotlinx-datetime))
234+
Please note you will need to add [kotlinx-coroutines](https://github.com/Kotlin/kotlinx.coroutines) as a dependency to do this. Kastro strives to include as few dependencies as possible.
204235
```kotlin
205236
SolarEventSequence(
206237
start = clock.now(),
@@ -234,9 +265,7 @@ Enhancements to the overall shape of the API are welcome though as this has not
234265
## Future Work
235266
I ran into some difficulties getting the height offset calculation to work correctly for `SolarEventSequence`. I hope to eventually resolve that but didn't think it should block an alpha release. It's something I want for the future `1.0` release.
236267

237-
I would also like to add additional KMP targets. I recently added various Apple targets. I am currently looking into WASM targets next.
238-
239-
I am also curious to potentially make the library usable for other languages like Javascript. This library is a Kotlin Multiplatform project, but it would be cool to also have it be on npm for use in Javascript/Typescript projects or even be a Swift package (SPM) for use on iOS/Apple targets. There are some challenges to doing that (such as how the exposed API could be adapted to better fit those languages) but I plan to actively look into this as it's something I am generally curious about.
268+
I am curious to potentially make the library usable for other languages like Javascript or Swift. This library is a Kotlin Multiplatform project, but it would be cool to also have it be on npm for use in Javascript/Typescript projects or even be a Swift package (SPM) for use on iOS/Apple targets. There are some challenges to doing that (such as how the exposed API could be adapted to better fit those languages) but I plan to actively look into this as it's something I am generally curious about.
240269

241270
# References
242271
* “Blue Hour – Magic Hour.” Timeanddate.com, 2019, www.timeanddate.com/astronomy/blue-hour.html.
@@ -245,6 +274,4 @@ I am also curious to potentially make the library usable for other languages lik
245274
* Meeus, Jean. Astronomical Algorithms. Richmond, Va., Willmann-Bell, 1998.‌
246275
* Montenbruck, Oliver, and Thomas Pfleger. Astronomy on the Personal Computer. Springer, 14 Mar. 2013.
247276
* NASA. “Moon Phases | Phases, Eclipses & Supermoons.” Moon: NASA Science, https://moon.nasa.gov/moon-in-motion/phases-eclipses-supermoons/moon-phases/
248-
* US Department of Commerce, NOAA. “Definitions of Twilight.” www.weather.gov, www.weather.gov/fsd/twilight.
249-
250-
277+
* US Department of Commerce, NOAA. “Definitions of Twilight.” www.weather.gov, www.weather.gov/fsd/twilight.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</a>
4646
</div>
4747
<div class="library-version">
48-
0.2.0 </div>
48+
0.3.0 </div>
4949
</div>
5050
<div class="filter-section" id="filter-section">
5151
<button class="platform-tag platform-selector common-like" data-active="" data-filter=":dokkaHtml/commonMain">common</button>

docs/kastro/dev.jamesyox.kastro.common/-horizon-movement-state/-rising/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</a>
4646
</div>
4747
<div class="library-version">
48-
0.2.0 </div>
48+
0.3.0 </div>
4949
</div>
5050
<div class="filter-section" id="filter-section">
5151
<button class="platform-tag platform-selector common-like" data-active="" data-filter=":dokkaHtml/commonMain">common</button>

docs/kastro/dev.jamesyox.kastro.common/-horizon-movement-state/-setting/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</a>
4646
</div>
4747
<div class="library-version">
48-
0.2.0 </div>
48+
0.3.0 </div>
4949
</div>
5050
<div class="filter-section" id="filter-section">
5151
<button class="platform-tag platform-selector common-like" data-active="" data-filter=":dokkaHtml/commonMain">common</button>

docs/kastro/dev.jamesyox.kastro.common/-horizon-movement-state/entries.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</a>
4646
</div>
4747
<div class="library-version">
48-
0.2.0 </div>
48+
0.3.0 </div>
4949
</div>
5050
<div class="filter-section" id="filter-section">
5151
<button class="platform-tag platform-selector common-like" data-active="" data-filter=":dokkaHtml/commonMain">common</button>

docs/kastro/dev.jamesyox.kastro.common/-horizon-movement-state/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</a>
4646
</div>
4747
<div class="library-version">
48-
0.2.0 </div>
48+
0.3.0 </div>
4949
</div>
5050
<div class="filter-section" id="filter-section">
5151
<button class="platform-tag platform-selector common-like" data-active="" data-filter=":dokkaHtml/commonMain">common</button>

docs/kastro/dev.jamesyox.kastro.common/-horizon-movement-state/value-of.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</a>
4646
</div>
4747
<div class="library-version">
48-
0.2.0 </div>
48+
0.3.0 </div>
4949
</div>
5050
<div class="filter-section" id="filter-section">
5151
<button class="platform-tag platform-selector common-like" data-active="" data-filter=":dokkaHtml/commonMain">common</button>

docs/kastro/dev.jamesyox.kastro.common/-horizon-movement-state/values.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</a>
4646
</div>
4747
<div class="library-version">
48-
0.2.0 </div>
48+
0.3.0 </div>
4949
</div>
5050
<div class="filter-section" id="filter-section">
5151
<button class="platform-tag platform-selector common-like" data-active="" data-filter=":dokkaHtml/commonMain">common</button>

docs/kastro/dev.jamesyox.kastro.common/-horizon-state/-down/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</a>
4646
</div>
4747
<div class="library-version">
48-
0.2.0 </div>
48+
0.3.0 </div>
4949
</div>
5050
<div class="filter-section" id="filter-section">
5151
<button class="platform-tag platform-selector common-like" data-active="" data-filter=":dokkaHtml/commonMain">common</button>

0 commit comments

Comments
 (0)