Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Feb 27, 2023

Bumps astronomy-engine from 2.1.12 to 2.1.16.

Release notes

Sourced from astronomy-engine's releases.

Support for extreme year values, string helpers for C#.

Extreme year values

When converting Gregorian calendar dates to day values and back, I have been using an algorithm by Fliegel and Van Flandern that was published in October 1968. It is a wonderful formula because it doesn't use any conditional logic to handle all the leap year rules. Rather, it uses simple integer arithmetic to work in an almost magic way.

However, I recently discovered a few problems for extreme year values, especially years before 4317 BC, the Julian Day epoch. These caused the formulas to fail due to quirks of negative numbers in the calculations. I also had concerns about using 32-bit integers to do the calculations.

So I decided to write unit tests that require year values to work over a nearly 2-million year span: the range of years from −999999 to +999999. I did this for all languages except JavaScript, where I don't use Fliegel / Van Flandern formulas because the built-in type Date effortlessly supports years from −199999 to +199999:

> new Date('+199999-01-01T00:00:00Z')
+199999-01-01T00:00:00.000Z
> new Date('-199999-01-01T00:00:00Z')
-199999-01-01T00:00:00.000Z

Then I worked until I got all the tests to pass. This work mainly consisted of

  • Adjusting Fliegel / Van Flandern to avoid negative values over the wider year range.
  • In other parts of the code, handling Python's different idea of integer division when numbers are negative. In Python, 10 // 3 == 3, but -10 // 3 == -4.
  • In C, casting a floating point number to an integer causes it to be rounded toward zero, when I needed it to be rounded down, whether positive or negative. So I had to change (long)x to (long)floor(x).

Now all the languages except JavaScript have consistent logic for handling calendar dates that passes all the tests.

String helpers for C#

In the C# version of Astronomy Engine, I added ToString methods for the types AstroVector, StateVector, and Observer. These are not only helpful for easy printing of values, but are handy while using the debugger. Just hover your mouse over a variable and you can see what's in it!

I added TryParse functions for AstroTime and AstroVector to parse the string representations back into a time or vector.

Python type hints

This release adds type hints to the Python version of Astronomy Engine.

Type hints provide better documentation to developers about all the function parameter types and return values. They also enable static type-checking of the Python code using the mypy tool. The automated test suite now requires passing mypy --strict when each change is pushed to GitHub. This extra step will help maintain a high standard of code quality for future development. The intention is to prevent bugs before they happen, both inside Astronomy Engine and in code that uses it.

Many thanks to @​ris-tlp for volunteering to help in this effort!

Hour Angle

This release of Astronomy Engine includes a new function HourAngle. It calculates the hour angle of a solar system body for a given geographic location at a given time.

This release also includes demo programs to calculate true solar time from the Sun's hour angle.

True ecliptic coordinates of date

This release changes the Ecliptic functions to return true ecliptic coordinates of date instead of coordinates referenced to the mean equinox of J2000. This matters because ecliptic coordinates are often significant for physical phenomena such as eclipses, transits, lunar phases, etc.

So-called "true" coordinates correct for the following 3 variables in the orientation system:

  • Large scale precession of the Earth's axis. This is a gyrating movement over a period of approximately 26000 years.
  • Small scale nutation of the Earth's axis. This small wobbling movement has a primary periodic component of 18.6 years.
  • Obliquity drift. This is a slow change of the angle between the Earth's orbital plane and the Earth's equatorial plane. Currently the angle between the planes is decreasing at a rate of 47 arcseconds per century.

... (truncated)

Commits
  • 543ffa3 Version 2.1.16
  • 1de31cf C#: Implemented Observer.ToString().
  • 2fcaf27 Python: verify several thousand calendar dates.
  • ce0acf6 Kotlin: support calendar dates for years -999999 to +999999.
  • 16727b8 C: force use of 64-bit integers in calendar functions.
  • 7e196a3 Fixed Windows batch files ignoring negative integer failure codes.
  • 503538d PY: Fixed calendar/time conversion functions for extreme year values.
  • e7d48c6 C#: Fixed bugs with calendar dates with extreme year values.
  • 1ac4ab2 C: Fixed more problems with calendar date calculations.
  • 7e17705 PY: Fixed calendar calculations for extreme year values.
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [astronomy-engine](https://github.com/cosinekitty/astronomy) from 2.1.12 to 2.1.16.
- [Release notes](https://github.com/cosinekitty/astronomy/releases)
- [Commits](cosinekitty/astronomy@v2.1.12...v2.1.16)

---
updated-dependencies:
- dependency-name: astronomy-engine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant