A library for computing moon phases
A library for computing moon phases
(angle->closest-phase rad)
Converts an angle, in radians, to the closest matching moon phase. The closest matching moon phase may not have happened yet: This means this is not a good fit for calendars to tell when the phase changes.
Converts an angle, in radians, to the closest matching moon phase. The closest matching moon phase may not have happened yet: This means this is not a good fit for calendars to tell when the phase changes.
(angle->last-phase-change rad)
Converts an angle, in radians, to the last moon phase change.
Converts an angle, in radians, to the last moon phase change.
(angle->upcoming-phase-change rad)
Converts an angle, in radians, to the upcoming moon phase change.
Converts an angle, in radians, to the upcoming moon phase change.
(closest-phase dt)
Returns the closest matching moon phase of the given datetime. The closest matching moon phase may not have happened yet: This means this is not a good fit for calendars -- use phase-change-on-date instead if this is important to you.
Returns the closest matching moon phase of the given datetime. The closest matching moon phase may not have happened yet: This means this is not a good fit for calendars -- use phase-change-on-date instead if this is important to you.
(last-phase-change dt)
Returns the last moon phase change that happened before the given datetime.
Returns the last moon phase change that happened before the given datetime.
(next-phase-time dt target-phase)
Returns the time of the first phase of type target-phase happening after dt, off by at most 30 seconds from the approximate value.
Due to calculation inaccuracies,
(let [x (next-phase-time dt phase) y (next-phase-time x phase)] (approx-equal? x y))
may or may not return true. If you want to make a sequence of the same phase, check for the next event 1 week after the current event.
Returns the time of the first phase of type target-phase happening after dt, off by at most 30 seconds from the approximate value. Due to calculation inaccuracies, (let [x (next-phase-time dt phase) y (next-phase-time x phase)] (approx-equal? x y)) may or may not return true. If you want to make a sequence of the same phase, check for the next event 1 week after the current event.
Returns the angle of a given phase
Returns the angle of a given phase
A mapping from the current phase to the next one.
A mapping from the current phase to the next one.
(phase-angle dt)
Returns the phase angle of the given datetime, in radians.
Returns the phase angle of the given datetime, in radians.
(phase-change-on-date dt)
Returns the phase we changed into on this date, if any. More precicely, this returns the transition between the start of this day and the end of this day. Returns nil if there's no phase change today.
dt must be a datetime, as this needs a time zone to know exactly when the day starts and ends. Use (.atStartOfDay date zone-id) if you have a java.time.LocalDate instead.
Returns the phase we changed into on this date, if any. More precicely, this returns the transition between the start of this day and the end of this day. Returns nil if there's no phase change today. dt must be a datetime, as this needs a time zone to know exactly when the day starts and ends. Use (.atStartOfDay date zone-id) if you have a java.time.LocalDate instead.
(phase-seq {:keys [time]})
Returns a lazy seq of all the phases happening after dt, along with their timestamp.
Values will be on the form {:time dt, :phase phase}
Returns a lazy seq of all the phases happening after dt, along with their timestamp. Values will be on the form {:time dt, :phase phase}
A list of all the phases used by this library, in their order in the lunar month. ::new is considered the start of the month.
A list of all the phases used by this library, in their order in the lunar month. ::new is considered the start of the month.
(position-equatorial-phi jd)
(upcoming-phase-change dt)
Returns the first moon phase change that will happen after the given datetime.
Returns the first moon phase change that will happen after the given datetime.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close