Documentation / @interstellar-tools/equations / sunInSky
Function: sunInSky()
ts
function sunInSky(
place: PlanetocentricPointInterface,
subsolar: PlanetocentricPointInterface
): SunInSkyInterface;Defined in: cartography/sun-in-sky.ts:107
Where the Sun is in a place's sky: its elevation, its azimuth and the local solar time, from where on the body it is overhead, the subsolarPoint.
Where:
and are the place's latitude and east longitude, and and the subsolar point's is the Sun's hour angle, west of the place's meridian is the elevation, the azimuth clockwise from north, and the local true solar time in hours
Units
- Inputs and angles out in degrees; the time in the body's hours, 24 to its solar day.
Notes
- The body is taken as a sphere, with latitudes planetocentric, and the Sun as a point far away: its disc, and the place's height, are left out.
- On Mars this is the local true solar time: a sundial's. The local mean solar time, which mission clocks keep, differs from it by Mars's equation of time, up to about 50 minutes.
- Light bending in an atmosphere, which on Earth lifts the Sun about half a degree at the horizon, is left out.
In practicePerseverance's landing, Jezero Crater
37.0° up, at 15:26 local solar time
The Sun over Jezero at 20:55 UTC on 18 February 2021, as Perseverance landed
Mars24, NASA's Mars clock, gives a local true solar time of 15.44 hours and the Sun 37.0° up at the landing site then: an afternoon Sun, in the west.
ts
import { PLANETS } from '@interstellar-tools/constants';
import {
stateAt,
subsolarPoint,
sunInSky
} from '@interstellar-tools/equations';
import type { DegreesType } from '@interstellar-tools/types';
const mars = PLANETS.find(({ id }) => id === 'mars')!;
const landed = new Date('2021-02-18T20:55:00Z');
const { r } = stateAt(mars.orbit!, landed);
const subsolar = subsolarPoint(
mars.rotation!.iau!,
[-r[0], -r[1], -r[2]],
landed
);
sunInSky(
{ latitude: 18.4447 as DegreesType, longitude: 77.4508 as DegreesType },
subsolar
); // elevation ≈ 37.0°, azimuth ≈ 259°, localSolarTime ≈ 15.44Parameters
| Parameter | Type | Description |
|---|---|---|
place | PlanetocentricPointInterface | The place: planetocentric latitude (in [−90°, 90°]) and east longitude (finite), in degrees. |
subsolar | PlanetocentricPointInterface | Where the Sun is overhead, as subsolarPoint gives it, in degrees. |
Returns
The Sun's elevation and azimuth, and the local solar time.
Throws
- If a latitude or longitude is not finite.
- If a latitude is outside [−90°, 90°].
Example
ts
// A quarter turn east of where the Sun is overhead, it's setting in the west
sunInSky(
{ latitude: 0 as DegreesType, longitude: 90 as DegreesType },
{ latitude: 0 as DegreesType, longitude: 0 as DegreesType }
); // elevation 0°, azimuth 270°, localSolarTime 18