Add true solar time calculation module for BaZi with longitude and equation-of-time corrections, DST support, and tests#2
Open
cto-new[bot] wants to merge 1 commit intoPvfrom
Conversation
…with timezone, DST, and equation-of-time support Implements a solar time correction module for BaZi astrology, essential for accurately converting civil birth times to true solar times. This is needed to support both longitude and astronomical equation-of-time corrections as practiced in modern BaZi calculation. - Adds `bazi.solar_time` module with `corrected_birth_time` API supporting custom longitude, timezone, DST detection, and defaults for Shanghai. - Uses NOAA equation-of-time; supports arbitrary IANA timezones via zoneinfo; handles DST transitions for historical accuracy. - Public API returns all intermediate values in a `SolarTimeResult` dataclass. - Comprehensive pytest suite with modern, Shanghai, and DST test cases. - Adds documentation covering algorithm, assumptions, and usage notes.
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.
Summary
This PR adds a new Python module that accurately converts civil birth times to true solar times for BaZi astrology, handling longitude correction, equation-of-time, and historical DST for Asia/Shanghai with a robust test suite.
Details
bazi.solar_time.corrected_birth_timeAPI handling civil-to-solar time conversion, customizable longitude and timezone, and Shanghai defaults.Warning: Task VM test is not passing, cto.new will perform much better if you fix the setup