Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: amend get_solar_transit() internal usage in celerity/night. #109

Merged
merged 1 commit into from
Apr 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/celerity/night.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ def get_solar_transit(
eq = get_equatorial_coordinate(date)

# Convert the equatorial coordinate to a horizontal coordinate:
hor = convert_equatorial_to_horizontal(date, observer, eq)
hz = convert_equatorial_to_horizontal(date, observer, eq)

# Correct the horizontal coordinate for atmospheric refraction:
hor = get_correction_to_horizontal_for_refraction(hor, 288.15, 101325)
hz = get_correction_to_horizontal_for_refraction(hz, 288.15, 101325)

# Find the altitude of the Sun where it crosses over the horizon:
if hor["alt"] > horizon and rise is None:
if hz["alt"] > horizon and rise is None:
rise = i

# Find the altitude of the Sun where it crosses back under the horizon:
if hor["alt"] < horizon and set is None and rise is not None:
if hz["alt"] < horizon and set is None and rise is not None:
set = i

sun.append(hor)
sun.append(hz)

# Increment the date by 1 second:
date += timedelta(minutes=1)
Expand Down Expand Up @@ -116,7 +116,8 @@ def get_night(
# Get the time of the sunrise for the following date:
sunrise, _, _ = get_solar_transit(date + timedelta(days=1), observer, horizon)

# The observer could be in perpetual daylight or perpetual night, e.g., the North Pole or South Pole:
# The observer could be in perpetual daylight or perpetual night, e.g., the
# North Pole or South Pole:
if sunset is None or sunrise is None:
return None

Expand Down
Loading