Sun position
SunCalc.getSunPosition
— FunctiongetSunPosition(
time::Union{DateTime,ZonedDateTime}
lat::Real,
lon::Real;
keep=[:altitude, :azimuth])
Calculate the sun position for the given time and location. Return a NamedTuple
or DataFrame
.
Available variables:
Variable | Description |
---|---|
altitude | Sun altitude above the horizon in radians, e.g. 0 at the horizon and π/2 at the zenith (straight over your head) |
azimuth | Sun azimuth in radians (direction along the horizon, measured from south to west), e.g. 0 is south and π * 3/4 is northwest |
Examples
using Dates, SunCalc
getSunPosition(DateTime(2000, 07, 01, 12, 00, 00), 54, 9)
getSunPosition(now(), 54, 9; keep=[:altitude])
Sun light times
SunCalc.getSunlightTimes
— FunctiongetSunlightTimes(
date::Date,
lat::Real,
lon::Real,
tz::TimeZone;
keep=[:solarNoon, :nadir, :sunrise, :sunset, :sunriseEnd,
:sunsetStart, :dawn, :dusk, :nauticalDawn, :nauticalDusk,
:nightEnd, :night, :goldenHourEnd, :goldenHour])
Calculate sunlight times for the given date and location. Return a NamedTuple
or DataFrame
.
Available variables:
Variable | Description |
---|---|
sunrise | Sunrise (top edge of the sun appears on the horizon) |
sunriseEnd | Sunrise ends (bottom edge of the sun touches the horizon) |
goldenHourEnd | Morning golden hour (soft light, best time for photography) ends |
solarNoon | Solar noon (sun is in the highest position) |
goldenHour | Evening golden hour starts |
sunsetStart | Sunset starts (bottom edge of the sun touches the horizon) |
sunset | Sunset (sun disappears below the horizon, evening civil twilight starts) |
dusk | Dusk (evening nautical twilight starts) |
nauticalDusk | Nautical dusk (evening astronomical twilight starts) |
night | Night starts (dark enough for astronomical observations) |
nadir | Nadir (darkest moment of the night, sun is in the lowest position) |
nightEnd | Night ends (morning astronomical twilight starts) |
nauticalDawn | Nautical dawn (morning nautical twilight starts) |
dawn | Dawn (morning nautical twilight ends, morning civil twilight starts) |
Examples
using Dates, SunCalc
getSunlightTimes(today(), 54, 9; keep=[:sunrise, :sunset])
using TimeZones
getSunlightTimes(Date(2000, 07, 01), 54, 9, tz"UTC-3")
using DataFrames
days = collect(Date(2000, 07, 01):Day(1):Date(2000, 12, 31))
getSunlightTimes(days, 54, 9)
Moon position
SunCalc.getMoonPosition
— FunctiongetMoonPosition(
time::Union{DateTime,ZonedDateTime},
lat::Real,
lon::Real;
keep=[:altitude, :azimuth, :distance, :parallacticAngle])
Calculate the sun position for the given time and location. Return a NamedTuple
or DataFrame
.
Available variables:
Variable | Description |
---|---|
altitude | Moon altitude above the horizon in radians |
azimuth | Moon azimuth in radians |
distance | Distance to moon in kilometres |
parallacticAngle | Parallactic angle of the moon in radians |
Examples
using Dates, SunCalc
getMoonPosition(DateTime(2000, 07, 01, 12, 00, 00), 54, 9)
getMoonPosition(now(), 54, 9; keep=[:altitude])
Moon illumination
SunCalc.getMoonIllumination
— FunctiongetMoonIllumination(
time::Union{Date,DateTime,ZonedDateTime};
keep=[:fraction, :phase, :angle])
Calculate moon illumination for the given time. Return a NamedTuple
or DataFrame
.
Available variables:
Variable | Description |
---|---|
fraction | Illuminated fraction of the moon; varies from 0.0 (new moon) to 1.0 (full moon) |
phase | Moon phase; varies from 0.0 to 1.0, described below |
angle | Midpoint angle in radians of the illuminated limb of the moon reckoned eastward from the north point of the disk; the moon is waxing if the angle is negative, and waning if positive |
Moon phase value should be interpreted like this:
0
: New Moon- Waxing Crescent
0.25
: First Quarter- Waxing Gibbous
0.5
: Full Moon- Waning Gibbous
0.75
: Last Quarter- Waning Crescent
Examples
using Dates, SunCalc
getMoonIllumination(Date(2000, 07, 01))
getMoonIllumination(now(), keep=[:fraction])