Skip to content

Releases: kipcole9/astro

Astro version 2.2.2

09 Jun 02:58

Choose a tag to compare

Bug Fixes

  • Fix ephemeris download failing with :failed_connect/:closed on OTP 26+, where Erlang offers TLS 1.3 by default but NASA NAIF's server has a broken TLS 1.3 handshake. Both mix astro.download_ephemeris and the runtime auto-downloader now pin to TLS 1.2 (the version curl already negotiates). Thanks to @allenwyma for the report. Closes #10.

Astro version 2.2.1

23 May 14:47

Choose a tag to compare

Bug Fixes

  • Fix date_time_from_julian_days to always return proleptic-Gregorian dates.

Astro version 2.2.0

23 May 14:49

Choose a tag to compare

Bug Fixes

  • Recover from unwriteable ephemeric download directory by attempting to write to /temp/astro

Astro version 2.1.1

24 Apr 21:56

Choose a tag to compare

Bug Fixes

  • Properly ensure tz_world is actually optional.

Astro version 2.1.0

07 Apr 02:34

Choose a tag to compare

Bug Fixes

  • Fix application startup when neither :tz nor :tzdata is configured. Astro.default_options/0 now falls back to time_zone_database: nil instead of raising CondClauseError. Calls that do not require a time zone database (e.g. time_zone: :utc) now work without any time zone library installed.

  • Fix Astro.Supervisor.start_link/2 to gracefully handle the case where :tz_world is not installed. Previously the supervisor unconditionally referenced TzWorld.Backend.DetsWithIndexCache and crashed at startup when the optional dependency was missing.

Enhancements

  • Add Astro.new_visible_crescent/3 to predict the visibility of the new crescent moon at a given location on a given date. Three published criteria are supported via the method argument:

    • :odeh (default) — Odeh (2006) empirical criterion based on 737 observations using topocentric ARCV and a Danjon limit of 6.4°.

    • :yallop — Yallop (1997) empirical criterion based on 295 observations using geocentric ARCV.

    • :schaefer — Schaefer (1988/2000) physics-based model computing the contrast between crescent brightness and twilight sky brightness against the human contrast detection threshold.

  • Add Astro.new_visible_crescent/4 accepting atmospheric options for the Schaefer method (:extinction parameter).

  • Add Astro.Ephemeris.Downloader which automatically downloads the JPL DE440s ephemeris file (~32 MB) from NASA NAIF on first application start and caches it under the user cache directory. The download URL and cache path can be overridden with the :ephemeris_url and :ephemeris application environment keys. If the download fails, Astro.Application.start/2 now returns a clear error message explaining how to install the file manually.

Astro version 2.0

13 Mar 21:32

Choose a tag to compare

Breaking changes

  • Rename Astro.Solar.solar_longitude/1 to Astro.Solar.solar_ecliptic_longitude/1 and Astro.Lunar.lunar_longitude/1 to Astro.Lunar.lunar_ecliptic_longitude/1 to use unambiguous astronomical terminology.

  • Rename Astro.Lunar.new_moon/0 to Astro.Lunar.new_moon_phase/0, Astro.Lunar.full_moon/0 to Astro.Lunar.full_moon_phase/0, Astro.Lunar.first_quarter/0 to Astro.Lunar.first_quarter_phase/0, and Astro.Lunar.last_quarter/0 to Astro.Lunar.last_quarter_phase/0 to clarify that these return phase angle constants.

  • Rename Astro.Time.utc_datetime_from_terrestrial_datetime/1 to Astro.Time.utc_datetime_from_dynamical_datetime/1 to reflect the standard "dynamical time" terminology used in modern astronomical references.

  • Rename functions in Astro.Time that had names including "datetime" and consistently use the form "date_time".

  • Astro.Time.offset_for_zone/2 now returns {:ok, offset} or raises if there is an error resolving an offset. That can happen if the time zone is unknown, if there is no time in the zone or if the result is ambiguous due to DST shift.

  • Astro.obliquity/0 now returns its value in degrees (was previously radians). The only impact is to code that directly calls this function.

  • Astro.Earth.nutation/1 now returns a 3-tuple {nutation_in_longitude, nutation_in_obliquity, obliquity} instead of a single scalar value. The first element in the tuple has the same purpose as the return value of the original function. However its value may be slightly different due to the new underlying algorithms.

  • Astro.moon_position_at/1 now returns distance to the Moon in kilometres instead of metres.

  • Astro.sunrise/3 and Astro.sunset/3 now delegate to Astro.Solar.SunRiseSet which computes solar positions from the JPL DE440s numerical ephemeris rather than the previous NOAA/Meeus analytical polynomial series, and uses a scan-and-bisect solver rather than the previous iterative analytical formula.

  • Improved ΔT (delta-T) computation now uses variable ΔT based on IERS observations (1972–2025) and Meeus polynomial approximations for historical dates, replacing the previous fixed ΔT value. This improves the accuracy of all astronomical calculations but changes computed times for equinoxes, solstices, new moons, and lunar phases by up to ~22 seconds compared to version 1.x.

  • Sunrise/sunset and moonrise/moonset bisection tolerance tightened from 1.0 second to 0.01 seconds, yielding sub-second precision.

  • Remove Astro.Solar.sun_rise_or_set/3 and Astro.Solar.utc_sun_position/4 (the old NOAA/Meeus sunrise/sunset implementation). These functions were previously @doc false and are superseded by Astro.Solar.SunRiseSet.

Enhancements

  • Add Astro.moonrise/3 and Astro.moonset/3 to compute moonrise and moonset times for a given location and date.

  • Add Astro.date_time_new_moon_nearest/1 which returns the new moon nearest to a given date or datetime.

  • Add Astro.Lunar.date_time_new_moon_nearest/1 (takes a moment parameter).

  • Add Astro.Time.date_from_julian_days/1 to convert Julian Day Numbers to Date structs.

  • Add new Astro.Solar.SunRiseSet module implementing sunrise/sunset via JPL DE440s ephemeris and scan-and-bisect solver with configurable bisection tolerance.

  • Add new Astro.Lunar.MoonRiseSet module implementing fully topocentric moonrise/moonset via JPL DE440s ephemeris and scan-and-bisect solver with configurable bisection tolerance.

  • Add new Astro.Coordinates module for coordinate system conversions.

  • Add new types Astro.radians/0, Astro.astronomical_units/0, and Astro.kilometers/0.

  • Improved documentation with greater explanation of some of the key astronomical concepts.

Astro version 1.1.2

08 Sep 21:37

Choose a tag to compare

Bug Fixes

  • Fix Astro.sunrise/3 and Astro.sunset/3 when the resolved UTC datetime is ambiguous or has a gap (typically during a daylight savings transition). Thanks to @andykent for the PR. Closes #6 and #7.

Astro version 1.1.1

20 Jun 23:14

Choose a tag to compare

Bug Fixes

  • Remove :hackney and :tzdata from :extra_applications.

Astro version 1.1.0

18 Jun 12:31

Choose a tag to compare

Breaking Change

  • :tz_world is no longer a required dependency - it is now an optional dependency. This library is used to resolve a time zone name from a given latitude and longitude. When configured, it becomes the default method of resolving time zone names from a location. However it is no possible to provide alternative implementations for this resolution using the :time_zone_resolver option.

  • To retain the previous behaviour, applications should add {:tz_world, "~> 1.0"} to their dependencies.

Enhancements

  • Adds an option :time_zone_resolver to Astro.sunrise/3 and Astro.sunset/3 that is a 1-arity function that is invoked to resolve the time zone name from a given latitude and longitude. The default is to use TzWorld.timezone_at/1 if TzWorld is configured, otherwise an error is returned.

  • The default time zone database is now detected in the following order:

    1. Application.get_env(:elixir, :time_zone_database)
    2. TzData.TimeZoneDatabase if TzData is configured
    3. Tz.TimeZoneDatabase if Tz is configured

Astro version 1.0.2

27 May 05:26

Choose a tag to compare

Bug Fixes

  • Fix sunrise/sunset calculations when the solar elevation isn't 90 degrees. Thanks to @cloud8421 for the issue. Closes #5.