Search for when a body reaches a specified altitude
Source:R/rise_set_culmination.R
astro_search_altitude.RdFinds when the center of a given body ascends or descends through a given altitude angle, as seen by an observer at the specified location on the Earth.
Usage
astro_search_altitude(
body,
time,
latitude,
longitude,
height = 0,
direction = 1L,
limit_days = 1,
altitude = 0
)Arguments
- body
Integer body code (see astro_body).
- time
A
POSIXctdate/time in UTC to start the search from.- latitude
Observer's geographic latitude in degrees.
- longitude
Observer's geographic longitude in degrees.
- height
Observer's height above sea level in metres. Default
0.- direction
1Lto find the body ascending,-1Lto find descending. Default1L(ascending).- limit_days
Maximum number of days to search. When positive, searches forward in time; when negative, searches backward. Default
1.- altitude
The desired altitude angle above (positive) or below (negative) the observer's local horizon, in degrees. Must be in the range [-90, +90].
Details
This function is useful for finding twilight times. For example:
Civil dawn:
direction = 1, altitude = -6Civil dusk:
direction = -1, altitude = -6Nautical twilight:
altitude = -12Astronomical twilight:
altitude = -18
Examples
t <- as.POSIXct("2025-06-21", tz = "UTC")
# Find civil dawn (Sun at -6 degrees)
astro_search_altitude(astro_body[["SUN"]], t,
latitude = -33.8688, longitude = 151.2093,
direction = 1L, altitude = -6)
#> [1] "2025-06-21 20:32:29 UTC"