feat: improve the solar transit for the apparent hour angle in night module in @observerly/astrometry - #550
Merged
Conversation
…module in @observerly/astrometry
There was a problem hiding this comment.
🟢 Approval recommended
The behavioral change is consistently applied in the implementation and tests, and the only noted concern is a non-blocking maintainability improvement (shared helper extraction).
Pull request overview
This PR updates the night/solar-transit calculations to resolve solar transit and horizon-crossing events using the Sun’s apparent hour angle (LAST-based), aligning the night module’s behavior with how apparent solar right ascension is defined and improving conformance to SPA references.
Changes:
- Switch
getSolarTransit()/isNight()to use apparent-hour-angle-based solar altitude evaluation (including refraction correction) instead ofconvertEquatorialToHorizontal(). - Update expected timestamps in
tests/night.spec.tsto match the refined event resolution. - Tighten SPA conformance expectations for refined solar-noon residuals by reducing
MERIDIAN_TRANSIT_TOLERANCE.
File summaries
| File | Description |
|---|---|
src/night.ts |
Computes apparent solar altitude from apparent hour angle and uses it in getSolarTransit() and isNight() to refine event timing. |
tests/night.spec.ts |
Updates expected sunrise/noon/sunset/night timestamps and adjusts altitude cross-checking to match the new apparent-hour-angle basis. |
tests/conformance/spa.spec.ts |
Updates documentation and tightens the refined meridian-transit tolerance to reflect improved alignment. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+36
to
+41
| const getApparentSolarAltitude = ( | ||
| datetime: Date, | ||
| observer: GeographicCoordinate, | ||
| temperature: number, | ||
| pressure: number | ||
| ): number => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.