MCPcopy
hub / github.com/mourner/suncalc / getPosition

Function getPosition

index.js:85–99  ·  view source on GitHub ↗
(date, lat, lng)

Source from the content-addressed store, hash-verified

83
84// calculates sun position for a given date and latitude/longitude
85export function getPosition(date, lat, lng) {
86 const lw = rad * -lng;
87 const phi = rad * lat;
88 const d = toDays(date);
89
90 const c = sunCoords(toDaysTT(d)); // position series run on Terrestrial Time
91 const H = siderealTime(d, lw) - c.ra; // sidereal time stays on UT
92 const h = altitude(H, phi, c.dec);
93
94 return {
95 azimuth: azimuth(H, phi, c.dec),
96 // apparent (refraction-corrected) altitude in degrees
97 altitude: (h + astroRefraction(h)) / rad
98 };
99}
100
101// sun times configuration (angle, morning name, evening name)
102export const times = [

Callers

nothing calls this directly

Calls 7

toDaysFunction · 0.85
sunCoordsFunction · 0.85
toDaysTTFunction · 0.85
siderealTimeFunction · 0.85
altitudeFunction · 0.85
azimuthFunction · 0.85
astroRefractionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…