diff --git a/demo/browser/astronomy.browser.js b/demo/browser/astronomy.browser.js index 032b36d8..82b2da90 100644 --- a/demo/browser/astronomy.browser.js +++ b/demo/browser/astronomy.browser.js @@ -5562,7 +5562,7 @@ exports.NextPlanetApsis = NextPlanetApsis; * @brief Calculates the inverse of a rotation matrix. * * Given a rotation matrix that performs some coordinate transform, - * this function returns the matrix that reverses that trasnform. + * this function returns the matrix that reverses that transform. * * @param {RotationMatrix} rotation * The rotation matrix to be inverted. @@ -5902,7 +5902,7 @@ exports.Refraction = Refraction; * @brief Calculates the inverse of an atmospheric refraction angle. * * Given an observed altitude angle that includes atmospheric refraction, - * calculate the negative angular correction to obtain the unrefracted + * calculates the negative angular correction to obtain the unrefracted * altitude. This is useful for cases where observed horizontal * coordinates are to be converted to another orientation system, * but refraction first must be removed from the observed position. @@ -6140,7 +6140,7 @@ exports.Rotation_HOR_EQD = Rotation_HOR_EQD; * A location near the Earth's mean sea level that defines the observer's horizon. * * @returns {RotationMatrix} - * A rotation matrix that converts HOR to EQD at `time` and for `observer`. + * A rotation matrix that converts HOR to EQJ at `time` and for `observer`. */ function Rotation_HOR_EQJ(time, observer) { time = MakeTime(time); @@ -7302,7 +7302,7 @@ exports.Constellation = Constellation; * Returned by {@link SearchLunarEclipse} or {@link NextLunarEclipse} * to report information about a lunar eclipse event. * When a lunar eclipse is found, it is classified as penumbral, partial, or total. - * Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + * Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed * by the Earth's penumbra; no part of the Moon touches the Earth's umbra. * Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. * Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -7596,9 +7596,6 @@ exports.SearchLunarEclipse = SearchLunarEclipse; * Returned by {@link SearchGlobalSolarEclipse} or {@link NextGlobalSolarEclipse} * to report information about a solar eclipse event. * - * Field `peak` holds the date and time of the peak of the eclipse, defined as - * the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - * * The eclipse is classified as partial, annular, or total, depending on the * maximum amount of the Sun's disc obscured, as seen at the peak location * on the surface of the Earth. @@ -7620,8 +7617,8 @@ exports.SearchLunarEclipse = SearchLunarEclipse; * One of the following string values: `"partial"`, `"annular"`, `"total"`. * * @property {AstroTime} peak - * The date and time of the peak of the eclipse, defined as the instant - * when the axis of the Moon's shadow cone passes closest to the Earth's center. + * The date and time when the solar eclipse is darkest. + * This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. * * @property {number} distance * The distance in kilometers between the axis of the Moon's shadow cone @@ -7820,7 +7817,7 @@ exports.NextGlobalSolarEclipse = NextGlobalSolarEclipse; * (a "local" solar eclipse), a series of events occur. In addition * to the time of each event, it is important to know the altitude of the Sun, * because each event may be invisible to the observer if the Sun is below - * the horizon (i.e. it at night). + * the horizon. * * If `altitude` is negative, the event is theoretical only; it would be * visible if the Earth were transparent, but the observer cannot actually see it. diff --git a/demo/nodejs/astronomy.js b/demo/nodejs/astronomy.js index 498dd34a..008a1db9 100644 --- a/demo/nodejs/astronomy.js +++ b/demo/nodejs/astronomy.js @@ -5561,7 +5561,7 @@ exports.NextPlanetApsis = NextPlanetApsis; * @brief Calculates the inverse of a rotation matrix. * * Given a rotation matrix that performs some coordinate transform, - * this function returns the matrix that reverses that trasnform. + * this function returns the matrix that reverses that transform. * * @param {RotationMatrix} rotation * The rotation matrix to be inverted. @@ -5901,7 +5901,7 @@ exports.Refraction = Refraction; * @brief Calculates the inverse of an atmospheric refraction angle. * * Given an observed altitude angle that includes atmospheric refraction, - * calculate the negative angular correction to obtain the unrefracted + * calculates the negative angular correction to obtain the unrefracted * altitude. This is useful for cases where observed horizontal * coordinates are to be converted to another orientation system, * but refraction first must be removed from the observed position. @@ -6139,7 +6139,7 @@ exports.Rotation_HOR_EQD = Rotation_HOR_EQD; * A location near the Earth's mean sea level that defines the observer's horizon. * * @returns {RotationMatrix} - * A rotation matrix that converts HOR to EQD at `time` and for `observer`. + * A rotation matrix that converts HOR to EQJ at `time` and for `observer`. */ function Rotation_HOR_EQJ(time, observer) { time = MakeTime(time); @@ -7301,7 +7301,7 @@ exports.Constellation = Constellation; * Returned by {@link SearchLunarEclipse} or {@link NextLunarEclipse} * to report information about a lunar eclipse event. * When a lunar eclipse is found, it is classified as penumbral, partial, or total. - * Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + * Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed * by the Earth's penumbra; no part of the Moon touches the Earth's umbra. * Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. * Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -7595,9 +7595,6 @@ exports.SearchLunarEclipse = SearchLunarEclipse; * Returned by {@link SearchGlobalSolarEclipse} or {@link NextGlobalSolarEclipse} * to report information about a solar eclipse event. * - * Field `peak` holds the date and time of the peak of the eclipse, defined as - * the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - * * The eclipse is classified as partial, annular, or total, depending on the * maximum amount of the Sun's disc obscured, as seen at the peak location * on the surface of the Earth. @@ -7619,8 +7616,8 @@ exports.SearchLunarEclipse = SearchLunarEclipse; * One of the following string values: `"partial"`, `"annular"`, `"total"`. * * @property {AstroTime} peak - * The date and time of the peak of the eclipse, defined as the instant - * when the axis of the Moon's shadow cone passes closest to the Earth's center. + * The date and time when the solar eclipse is darkest. + * This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. * * @property {number} distance * The distance in kilometers between the axis of the Moon's shadow cone @@ -7819,7 +7816,7 @@ exports.NextGlobalSolarEclipse = NextGlobalSolarEclipse; * (a "local" solar eclipse), a series of events occur. In addition * to the time of each event, it is important to know the altitude of the Sun, * because each event may be invisible to the observer if the Sun is below - * the horizon (i.e. it at night). + * the horizon. * * If `altitude` is negative, the event is theoretical only; it would be * visible if the Earth were transparent, but the observer cannot actually see it. diff --git a/demo/nodejs/calendar/astronomy.ts b/demo/nodejs/calendar/astronomy.ts index 43990850..68df29ef 100644 --- a/demo/nodejs/calendar/astronomy.ts +++ b/demo/nodejs/calendar/astronomy.ts @@ -6148,7 +6148,7 @@ export function NextPlanetApsis(body: Body, apsis: Apsis): Apsis { * @brief Calculates the inverse of a rotation matrix. * * Given a rotation matrix that performs some coordinate transform, - * this function returns the matrix that reverses that trasnform. + * this function returns the matrix that reverses that transform. * * @param {RotationMatrix} rotation * The rotation matrix to be inverted. @@ -6510,7 +6510,7 @@ export function Refraction(refraction: string, altitude: number): number { * @brief Calculates the inverse of an atmospheric refraction angle. * * Given an observed altitude angle that includes atmospheric refraction, - * calculate the negative angular correction to obtain the unrefracted + * calculates the negative angular correction to obtain the unrefracted * altitude. This is useful for cases where observed horizontal * coordinates are to be converted to another orientation system, * but refraction first must be removed from the observed position. @@ -6780,7 +6780,7 @@ export function Rotation_HOR_EQD(time: FlexibleDateTime, observer: Observer): Ro * A location near the Earth's mean sea level that defines the observer's horizon. * * @returns {RotationMatrix} - * A rotation matrix that converts HOR to EQD at `time` and for `observer`. + * A rotation matrix that converts HOR to EQJ at `time` and for `observer`. */ export function Rotation_HOR_EQJ(time: FlexibleDateTime, observer: Observer): RotationMatrix { time = MakeTime(time); @@ -7518,7 +7518,7 @@ export function Constellation(ra: number, dec: number): ConstellationInfo { * Returned by {@link SearchLunarEclipse} or {@link NextLunarEclipse} * to report information about a lunar eclipse event. * When a lunar eclipse is found, it is classified as penumbral, partial, or total. - * Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + * Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed * by the Earth's penumbra; no part of the Moon touches the Earth's umbra. * Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. * Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -7853,9 +7853,6 @@ export function SearchLunarEclipse(date: FlexibleDateTime): LunarEclipseInfo { * Returned by {@link SearchGlobalSolarEclipse} or {@link NextGlobalSolarEclipse} * to report information about a solar eclipse event. * - * Field `peak` holds the date and time of the peak of the eclipse, defined as - * the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - * * The eclipse is classified as partial, annular, or total, depending on the * maximum amount of the Sun's disc obscured, as seen at the peak location * on the surface of the Earth. @@ -7877,8 +7874,8 @@ export function SearchLunarEclipse(date: FlexibleDateTime): LunarEclipseInfo { * One of the following string values: `"partial"`, `"annular"`, `"total"`. * * @property {AstroTime} peak - * The date and time of the peak of the eclipse, defined as the instant - * when the axis of the Moon's shadow cone passes closest to the Earth's center. + * The date and time when the solar eclipse is darkest. + * This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. * * @property {number} distance * The distance in kilometers between the axis of the Moon's shadow cone @@ -8102,7 +8099,7 @@ export function NextGlobalSolarEclipse(prevEclipseTime: FlexibleDateTime): Globa * (a "local" solar eclipse), a series of events occur. In addition * to the time of each event, it is important to know the altitude of the Sun, * because each event may be invisible to the observer if the Sun is below - * the horizon (i.e. it at night). + * the horizon. * * If `altitude` is negative, the event is theoretical only; it would be * visible if the Earth were transparent, but the observer cannot actually see it. diff --git a/demo/python/astronomy.py b/demo/python/astronomy.py index 58a2223f..0a01fe76 100644 --- a/demo/python/astronomy.py +++ b/demo/python/astronomy.py @@ -5080,7 +5080,7 @@ def InverseRefractionAngle(refraction, bent_altitude): """Calculates the inverse of an atmospheric refraction angle. Given an observed altitude angle that includes atmospheric refraction, - calculate the negative angular correction to obtain the unrefracted + calculates the negative angular correction to obtain the unrefracted altitude. This is useful for cases where observed horizontal coordinates are to be converted to another orientation system, but refraction first must be removed from the observed position. @@ -6995,7 +6995,7 @@ def InverseRotation(rotation): """Calculates the inverse of a rotation matrix. Given a rotation matrix that performs some coordinate transform, - this function returns the matrix that reverses that trasnform. + this function returns the matrix that reverses that transform. Parameters ---------- @@ -7376,7 +7376,7 @@ def Rotation_HOR_EQJ(time, observer): Returns ------- RotationMatrix - A rotation matrix that converts HOR to EQD at `time` and for `observer`. + A rotation matrix that converts HOR to EQJ at `time` and for `observer`. """ hor_eqd = Rotation_HOR_EQD(time, observer) eqd_eqj = Rotation_EQD_EQJ(time) @@ -8272,7 +8272,7 @@ class LunarEclipseInfo: Returned by #SearchLunarEclipse or #NextLunarEclipse to report information about a lunar eclipse event. When a lunar eclipse is found, it is classified as penumbral, partial, or total. - Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed by the Earth's penumbra; no part of the Moon touches the Earth's umbra. Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -8324,9 +8324,6 @@ class GlobalSolarEclipseInfo: Returned by #SearchGlobalSolarEclipse or #NextGlobalSolarEclipse to report information about a solar eclipse event. - Field `peak` holds the date and time of the peak of the eclipse, defined as - the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - The eclipse is classified as partial, annular, or total, depending on the maximum amount of the Sun's disc obscured, as seen at the peak location on the surface of the Earth. @@ -8349,7 +8346,8 @@ class GlobalSolarEclipseInfo: kind : EclipseKind The type of solar eclipse: `EclipseKind.Partial`, `EclipseKind.Annular`, or `EclipseKind.Total`. peak : Time - The date and time of the eclipse at its peak. + The date and time when the solar eclipse is darkest. + This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. distance : float The distance between the Sun/Moon shadow axis and the center of the Earth, in kilometers. latitude : float @@ -8381,7 +8379,7 @@ class EclipseEvent: (a "local" solar eclipse), a series of events occur. In addition to the time of each event, it is important to know the altitude of the Sun, because each event may be invisible to the observer if the Sun is below - the horizon (i.e. it at night). + the horizon. If `altitude` is negative, the event is theoretical only; it would be visible if the Earth were transparent, but the observer cannot actually see it. diff --git a/generate/diffcalc b/generate/diffcalc index b8a5675d..af8d5d09 100755 --- a/generate/diffcalc +++ b/generate/diffcalc @@ -5,7 +5,7 @@ echo "diffcalc: dotnet $(dotnet --version)" echo "diffcalc: Node.js $(node --version)" echo "diffcalc: $(python3 --version)" -./ctest $1 diff 3.1e-15 temp/c_check.txt dotnet/csharp_test/csharp_check.txt || exit $? +./ctest $1 diff 4.9e-15 temp/c_check.txt dotnet/csharp_test/csharp_check.txt || exit $? ./ctest $1 diff 6.7e-15 temp/{c,js}_check.txt || exit $? ./ctest $1 diff 3.1e-15 temp/{c,py}_check.txt || exit $? ./ctest $1 diff 6.7e-15 temp/{js,py}_check.txt || exit $? diff --git a/generate/diffcalc.bat b/generate/diffcalc.bat index eb0d14ac..901b660d 100644 --- a/generate/diffcalc.bat +++ b/generate/diffcalc.bat @@ -9,7 +9,7 @@ if not exist !CTESTEXE! ( echo.Diffing calculations. -!CTESTEXE! diff 7.9e-17 temp\c_check.txt dotnet\csharp_test\csharp_check.txt +!CTESTEXE! diff 4.9e-15 temp\c_check.txt dotnet\csharp_test\csharp_check.txt if errorlevel 1 (exit /b 1) !CTESTEXE! diff 5.6e-15 temp\c_check.txt temp\js_check.txt diff --git a/generate/template/astronomy.c b/generate/template/astronomy.c index a46d445a..c316ba06 100644 --- a/generate/template/astronomy.c +++ b/generate/template/astronomy.c @@ -2927,8 +2927,14 @@ static astro_state_vector_t CalcJupiterMoon(astro_time_t time, int mindex) * * To convert to heliocentric position vectors, call #Astronomy_HelioVector * with `BODY_JUPITER` to get Jupiter's heliocentric position, then - * add the jovicentric positions. Likewise, you can call #Astronomy_GeoVector + * add the jovicentric positions. + * + * Likewise, you can call #Astronomy_GeoVector * with `BODY_JUPITER` to convert to geocentric positions. + * However, you will have to manually correct for light travel time + * from the Jupiter system to Earth to figure out what time to pass + * to `Astronomy_JupiterMoons` to get an accurate picture + * of how Jupiter and its moons look from Earth. * * @param time The date and time for which to calculate the position vectors. * @return Position vectors of Jupiter's largest 4 moons, as described above. @@ -6789,7 +6795,7 @@ astro_apsis_t Astronomy_NextPlanetApsis(astro_body_t body, astro_apsis_t apsis) * @brief Calculates the inverse of a rotation matrix. * * Given a rotation matrix that performs some coordinate transform, - * this function returns the matrix that reverses that trasnform. + * this function returns the matrix that reverses that transform. * * @param rotation * The rotation matrix to be inverted. @@ -7248,7 +7254,7 @@ double Astronomy_Refraction(astro_refraction_t refraction, double altitude) * Calculates the inverse of an atmospheric refraction angle. * * Given an observed altitude angle that includes atmospheric refraction, - * calculate the negative angular correction to obtain the unrefracted + * calculates the negative angular correction to obtain the unrefracted * altitude. This is useful for cases where observed horizontal * coordinates are to be converted to another orientation system, * but refraction first must be removed from the observed position. @@ -7557,7 +7563,7 @@ astro_rotation_t Astronomy_Rotation_HOR_EQD(astro_time_t *time, astro_observer_t * A location near the Earth's mean sea level that defines the observer's horizon. * * @return - * A rotation matrix that converts HOR to EQD at `time` and for `observer`. + * A rotation matrix that converts HOR to EQJ at `time` and for `observer`. */ astro_rotation_t Astronomy_Rotation_HOR_EQJ(astro_time_t *time, astro_observer_t observer) { diff --git a/generate/template/astronomy.cs b/generate/template/astronomy.cs index 137ecf4e..cfdcb722 100644 --- a/generate/template/astronomy.cs +++ b/generate/template/astronomy.cs @@ -273,7 +273,7 @@ namespace CosineKitty /// /// Converts this `AstroTime` to ISO 8601 format, expressed in UTC with millisecond resolution. /// - /// Example: "2019-08-30T17:45:22.763". + /// Example: "2019-08-30T17:45:22.763Z". public override string ToString() { return ToUtcDateTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); @@ -602,7 +602,7 @@ namespace CosineKitty } /// - /// Contains a rotation matrix that can be used to transform one coordinate system to another. + /// A rotation matrix that can be used to transform one coordinate system to another. /// public struct RotationMatrix { @@ -1155,7 +1155,7 @@ namespace CosineKitty /// Returned by #Astronomy.SearchLunarEclipse or #Astronomy.NextLunarEclipse /// to report information about a lunar eclipse event. /// When a lunar eclipse is found, it is classified as penumbral, partial, or total. - /// Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + /// Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed /// by the Earth's penumbra; no part of the Moon touches the Earth's umbra. /// Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. /// Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -1206,9 +1206,6 @@ namespace CosineKitty /// Returned by #Astronomy.SearchGlobalSolarEclipse or #Astronomy.NextGlobalSolarEclipse /// to report information about a solar eclipse event. /// - /// Field `peak` holds the date and time of the peak of the eclipse, defined as - /// the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - /// /// The eclipse is classified as partial, annular, or total, depending on the /// maximum amount of the Sun's disc obscured, as seen at the peak location /// on the surface of the Earth. @@ -1231,7 +1228,10 @@ namespace CosineKitty /// The type of solar eclipse: `EclipseKind.Partial`, `EclipseKind.Annular`, or `EclipseKind.Total`. public EclipseKind kind; - /// The date and time of the eclipse at its peak. + /// + /// The date and time when the solar eclipse is at its darkest. + /// This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. + /// public AstroTime peak; /// The distance between the Sun/Moon shadow axis and the center of the Earth, in kilometers. @@ -1253,7 +1253,7 @@ namespace CosineKitty /// (a "local" solar eclipse), a series of events occur. In addition /// to the time of each event, it is important to know the altitude of the Sun, /// because each event may be invisible to the observer if the Sun is below - /// the horizon (i.e. it at night). + /// the horizon. /// /// If `altitude` is negative, the event is theoretical only; it would be /// visible if the Earth were transparent, but the observer cannot actually see it. @@ -1912,20 +1912,14 @@ namespace CosineKitty -64E-9 * Sine(0.39943-5.37511*T); } - private readonly int[] I = new int[4]; - void Term(int p, int q, int r, int s, out double x, out double y) { - I[0] = p; - I[1] = q; - I[2] = r; - I[3] = s; x = 1.0; y = 0.0; - - for (int k=1; k<=4; ++k) - if (I[k-1] != 0.0) - AddThe(x, y, CO[I[k-1], k], SI[I[k-1], k], out x, out y); + if (p != 0) AddThe(x, y, CO[p, 1], SI[p, 1], out x, out y); + if (q != 0) AddThe(x, y, CO[q, 2], SI[q, 2], out x, out y); + if (r != 0) AddThe(x, y, CO[r, 3], SI[r, 3], out x, out y); + if (s != 0) AddThe(x, y, CO[s, 4], SI[s, 4], out x, out y); } void AddSol( @@ -1946,27 +1940,26 @@ namespace CosineKitty SINPI += coeffp*x; } - void ADDN(double coeffn, int p, int q, int r, int s, out double x, out double y) + void ADDN(double coeffn, int p, int q, int r, int s) { + double x, y; Term(p, q, r, s, out x, out y); N += coeffn * y; } void SolarN() { - double x, y; - N = 0.0; - ADDN(-526.069, 0, 0,1,-2, out x, out y); - ADDN( -3.352, 0, 0,1,-4, out x, out y); - ADDN( +44.297,+1, 0,1,-2, out x, out y); - ADDN( -6.000,+1, 0,1,-4, out x, out y); - ADDN( +20.599,-1, 0,1, 0, out x, out y); - ADDN( -30.598,-1, 0,1,-2, out x, out y); - ADDN( -24.649,-2, 0,1, 0, out x, out y); - ADDN( -2.000,-2, 0,1,-2, out x, out y); - ADDN( -22.571, 0,+1,1,-2, out x, out y); - ADDN( +10.985, 0,-1,1,-2, out x, out y); + ADDN(-526.069, 0, 0, 1, -2); + ADDN( -3.352, 0, 0, 1, -4); + ADDN( +44.297, +1, 0, 1, -2); + ADDN( -6.000, +1, 0, 1, -4); + ADDN( +20.599, -1, 0, 1, 0); + ADDN( -30.598, -1, 0, 1, -2); + ADDN( -24.649, -2, 0, 1, 0); + ADDN( -2.000, -2, 0, 1, -2); + ADDN( -22.571, 0,+1, 1, -2); + ADDN( +10.985, 0,-1, 1, -2); } void Planetary() @@ -1991,7 +1984,7 @@ namespace CosineKitty DLAM = 0; DS = 0; GAM1C = 0; - SINPI = 3422.7000; + SINPI = 3422.7; LongPeriodic(); L0 = Astronomy.PI2*Frac(0.60643382+1336.85522467*T-0.00000313*T2) + DL0/Astronomy.ARC; L = Astronomy.PI2*Frac(0.37489701+1325.55240982*T+0.00002565*T2) + DL /Astronomy.ARC; @@ -2153,22 +2146,22 @@ $ASTRO_ADDSOL() // https://ssd.jpl.nasa.gov/?sat_phys_par /// - /// The The mean radius of Jupiter's moon Io, expressed in kilometers. + /// The mean radius of Jupiter's moon Io, expressed in kilometers. /// public const double IO_RADIUS_KM = 1821.6; /// - /// The The mean radius of Jupiter's moon Europa, expressed in kilometers. + /// The mean radius of Jupiter's moon Europa, expressed in kilometers. /// public const double EUROPA_RADIUS_KM = 1560.8; /// - /// The The mean radius of Jupiter's moon Ganymede, expressed in kilometers. + /// The mean radius of Jupiter's moon Ganymede, expressed in kilometers. /// public const double GANYMEDE_RADIUS_KM = 2631.2; /// - /// The The mean radius of Jupiter's moon Callisto, expressed in kilometers. + /// The mean radius of Jupiter's moon Callisto, expressed in kilometers. /// public const double CALLISTO_RADIUS_KM = 2410.3; @@ -2838,8 +2831,8 @@ $ASTRO_PLUTO_TABLE(); seg[i].a = (1 - ramp)*seg[i].a + ramp*reverse[i].a; } } + return cache[seg_index]; } - return cache[seg_index]; } private static body_grav_calc_t CalcPlutoOneWay( @@ -3037,7 +3030,10 @@ $ASTRO_JUPITER_MOONS(); /// To convert to heliocentric position vectors, call #Astronomy.HelioVector /// with `Body.Jupiter` to get Jupiter's heliocentric position, then /// add the jovicentric positions. Likewise, you can call #Astronomy.GeoVector - /// to convert to geocentric positions. + /// to convert to geocentric positions; however, you will have to manually + /// correct for light travel time from the Jupiter system to Earth to + /// figure out what time to pass to `jupiterMoons` to get an accurate picture + /// of how Jupiter and its moons look from Earth. /// /// The date and time for which to calculate the position vectors. /// Position and velocity vectors of Jupiter's largest 4 moons. @@ -3139,15 +3135,15 @@ $ASTRO_JUPITER_MOONS(); return new RotationMatrix(rot); } - private static AstroVector precession(AstroVector pos, AstroTime time, PrecessDirection dir) + private static AstroVector precession(AstroVector pos, PrecessDirection dir) { - RotationMatrix r = precession_rot(time, dir); + RotationMatrix r = precession_rot(pos.t, dir); return RotateVector(r, pos); } - private static StateVector precession_posvel(StateVector state, AstroTime time, PrecessDirection dir) + private static StateVector precession_posvel(StateVector state, PrecessDirection dir) { - RotationMatrix rot = precession_rot(time, dir); + RotationMatrix rot = precession_rot(state.t, dir); return RotateState(rot, state); } @@ -3290,7 +3286,7 @@ $ASTRO_IAU_DATA() double eqeq = 15.0 * e_tilt(time).ee; /* Replace with eqeq=0 to get GMST instead of GAST (if we ever need it) */ double theta = era(time.ut); double st = (eqeq + 0.014506 + - (((( - 0.0000000368 * t + (((( - 0.0000000368 * t - 0.000029956 ) * t - 0.00000044 ) * t + 1.3915817 ) * t @@ -3305,7 +3301,7 @@ $ASTRO_IAU_DATA() return time.st; // return sidereal hours in the half-open range [0, 24). } - static Observer inverse_terra(AstroVector ovec, double st) + private static Observer inverse_terra(AstroVector ovec) { double lon_deg, lat_deg, height_km; @@ -3326,6 +3322,7 @@ $ASTRO_IAU_DATA() else { double stlocl = Math.Atan2(y, x); + double st = SiderealTime(ovec.t); /* Calculate exact longitude. */ lon_deg = RAD2DEG*stlocl - (15.0 * st); /* Normalize longitude to the range (-180, +180]. */ @@ -3359,7 +3356,7 @@ $ASTRO_IAU_DATA() } /* We now have a solution for the latitude in radians. */ lat_deg = lat * RAD2DEG; - /* Solve for exact height in meters. */ + /* Solve for exact height in kilometers. */ /* There are two formulas I can use. Use whichever has the less risky denominator. */ double adjust = EARTH_EQUATORIAL_RADIUS_KM / denom; if (Math.Abs(s) > Math.Abs(c)) @@ -3374,8 +3371,7 @@ $ASTRO_IAU_DATA() private static StateVector terra(Observer observer, AstroTime time) { double st = SiderealTime(time); - double df = 1.0 - 0.003352819697896; /* flattening of the Earth */ - double df2 = df * df; + double df2 = EARTH_FLATTENING * EARTH_FLATTENING; double phi = observer.latitude * DEG2RAD; double sinphi = Math.Sin(phi); double cosphi = Math.Cos(phi); @@ -3459,81 +3455,42 @@ $ASTRO_IAU_DATA() } - private static AstroVector nutation(AstroVector pos, AstroTime time, PrecessDirection dir) + private static AstroVector nutation(AstroVector pos, PrecessDirection dir) { - RotationMatrix rot = nutation_rot(time, dir); + RotationMatrix rot = nutation_rot(pos.t, dir); return RotateVector(rot, pos); } - private static StateVector nutation_posvel(StateVector state, AstroTime time, PrecessDirection dir) + private static StateVector nutation_posvel(StateVector state, PrecessDirection dir) { - RotationMatrix rot = nutation_rot(time, dir); + RotationMatrix rot = nutation_rot(state.t, dir); return RotateState(rot, state); } - - private static Equatorial vector2radec(AstroVector pos) - { - double ra, dec, dist; - double xyproj; - - xyproj = pos.x*pos.x + pos.y*pos.y; - dist = Math.Sqrt(xyproj + pos.z*pos.z); - if (xyproj == 0.0) - { - if (pos.z == 0.0) - { - /* Indeterminate coordinates; pos vector has zero length. */ - throw new ArgumentException("Bad vector"); - } - - if (pos.z < 0) - { - ra = 0.0; - dec = -90.0; - } - else - { - ra = 0.0; - dec = +90.0; - } - } - else - { - ra = RAD2HOUR * Math.Atan2(pos.y, pos.x); - if (ra < 0) - ra += 24.0; - - dec = RAD2DEG * Math.Atan2(pos.z, Math.Sqrt(xyproj)); - } - - return new Equatorial(ra, dec, dist, pos); - } - - private static AstroVector gyration(AstroVector pos, AstroTime time, PrecessDirection dir) + private static AstroVector gyration(AstroVector pos, PrecessDirection dir) { // Combine nutation and precession into a single operation I call "gyration". // The order they are composed depends on the direction, // because both directions are mutual inverse functions. return (dir == PrecessDirection.Into2000) ? - precession(nutation(pos, time, dir), time, dir) : - nutation(precession(pos, time, dir), time, dir); + precession(nutation(pos, dir), dir) : + nutation(precession(pos, dir), dir); } - private static StateVector gyration_posvel(StateVector state, AstroTime time, PrecessDirection dir) + private static StateVector gyration_posvel(StateVector state, PrecessDirection dir) { // Combine nutation and precession into a single operation I call "gyration". // The order they are composed depends on the direction, // because both directions are mutual inverse functions. return (dir == PrecessDirection.Into2000) ? - precession_posvel(nutation_posvel(state, time, dir), time, dir) : - nutation_posvel(precession_posvel(state, time, dir), time, dir); + precession_posvel(nutation_posvel(state, dir), dir) : + nutation_posvel(precession_posvel(state, dir), dir); } private static AstroVector geo_pos(AstroTime time, Observer observer) { AstroVector pos = terra(observer, time).Position(); - return gyration(pos, time, PrecessDirection.Into2000); + return gyration(pos, PrecessDirection.Into2000); } private static AstroVector spin(double angle, AstroVector pos) @@ -3549,9 +3506,9 @@ $ASTRO_IAU_DATA() ); } - private static AstroVector ecl2equ_vec(AstroTime time, AstroVector ecl) + private static AstroVector ecl2equ_vec(AstroVector ecl) { - double obl = mean_obliq(time.tt) * DEG2RAD; + double obl = mean_obliq(ecl.t.tt) * DEG2RAD; double cos_obl = Math.Cos(obl); double sin_obl = Math.Sin(obl); @@ -3559,7 +3516,7 @@ $ASTRO_IAU_DATA() ecl.x, ecl.y*cos_obl - ecl.z*sin_obl, ecl.y*sin_obl + ecl.z*cos_obl, - time + ecl.t ); } @@ -3591,10 +3548,10 @@ $ASTRO_IAU_DATA() ); /* Convert ecliptic coordinates to equatorial coordinates, both in mean equinox of date. */ - AstroVector mpos1 = ecl2equ_vec(time, gepos); + AstroVector mpos1 = ecl2equ_vec(gepos); /* Convert from mean equinox of date to J2000. */ - AstroVector mpos2 = precession(mpos1, time, PrecessDirection.Into2000); + AstroVector mpos2 = precession(mpos1, PrecessDirection.Into2000); return mpos2; } @@ -3858,9 +3815,12 @@ $ASTRO_IAU_DATA() /// The position is not corrected for light travel time or aberration. /// This is different from the behavior of #Astronomy.GeoVector. /// - /// If given an invalid value for `body`, this function will throw an `ArgumentException`. + /// If given an invalid value for `body`, this function will throw an #InvalidBodyException. /// - /// A body for which to calculate a heliocentric position: the Sun, Moon, EMB, SSB, or any of the planets. + /// + /// A body for which to calculate a heliocentric position: + /// the Sun, Moon, EMB, SSB, or any of the planets. + /// /// The date and time for which to calculate the position. /// A heliocentric position vector of the center of the given body. public static AstroVector HelioVector(Body body, AstroTime time) @@ -3909,14 +3869,14 @@ $ASTRO_IAU_DATA() /// /// /// Given a date and time, this function calculates the distance between - /// the center of `body` and the center of the Sun. + /// the center of `body` and the center of the Sun, expressed in AU. /// For the planets Mercury through Neptune, this function is significantly /// more efficient than calling #Astronomy.HelioVector followed by taking the length /// of the resulting vector. /// /// /// A body for which to calculate a heliocentric distance: - /// the Sun, Moon, or any of the planets. + /// the Sun, Moon, EMB, SSB, or any of the planets. /// /// /// The date and time for which to calculate the heliocentric distance. @@ -4254,11 +4214,11 @@ $ASTRO_IAU_DATA() switch (equdate) { case EquatorEpoch.OfDate: - AstroVector datevect = gyration(j2000, time, PrecessDirection.From2000); - return vector2radec(datevect); + AstroVector datevect = gyration(j2000, PrecessDirection.From2000); + return EquatorFromVector(datevect); case EquatorEpoch.J2000: - return vector2radec(j2000); + return EquatorFromVector(j2000); default: throw new ArgumentException(string.Format("Unsupported equator epoch {0}", equdate)); @@ -4367,7 +4327,7 @@ $ASTRO_IAU_DATA() return state; if (equdate == EquatorEpoch.J2000) - return gyration_posvel(state, time, PrecessDirection.Into2000); + return gyration_posvel(state, PrecessDirection.Into2000); throw new ArgumentException(string.Format("Unsupported equator epoch {0}", equdate)); } @@ -4406,10 +4366,9 @@ $ASTRO_IAU_DATA() AstroVector vector, EquatorEpoch equdate) { - double gast = SiderealTime(vector.t); if (equdate == EquatorEpoch.J2000) - vector = gyration(vector, vector.t, PrecessDirection.From2000); - return inverse_terra(vector, gast); + vector = gyration(vector, PrecessDirection.From2000); + return inverse_terra(vector); } /// @@ -4642,7 +4601,7 @@ $ASTRO_IAU_DATA() AstroVector sun2000 = new AstroVector(-earth2000.x, -earth2000.y, -earth2000.z, adjusted_time); /* Convert to equatorial Cartesian coordinates of date. */ - AstroVector sun_ofdate = gyration(sun2000, adjusted_time, PrecessDirection.From2000); + AstroVector sun_ofdate = gyration(sun2000, PrecessDirection.From2000); /* Convert equatorial coordinates to ecliptic coordinates. */ double true_obliq = DEG2RAD * e_tilt(adjusted_time).tobl; @@ -7608,7 +7567,7 @@ $ASTRO_IAU_DATA() /// Calculates the inverse of a rotation matrix. /// /// Given a rotation matrix that performs some coordinate transform, - /// this function returns the matrix that reverses that trasnform. + /// this function returns the matrix that reverses that transform. /// /// The rotation matrix to be inverted. /// A rotation matrix that performs the opposite transformation. @@ -8004,40 +7963,12 @@ $ASTRO_IAU_DATA() return refr; } - private static AxisInfo EarthRotationAxis(AstroTime time) - { - AxisInfo axis; - - // Unlike the other planets, we have a model of precession and nutation - // for the Earth's axis that provides a north pole vector. - // So calculate the vector first, then derive the (RA,DEC) angles from the vector. - - // Start with a north pole vector in equator-of-date coordinates: (0,0,1). - var pos1 = new AstroVector(0.0, 0.0, 1.0, time); - - // Convert the vector into J2000 coordinates. - AstroVector pos2 = nutation(pos1, time, PrecessDirection.Into2000); - axis.north = precession(pos2, time, PrecessDirection.Into2000); - - // Derive angular values: right ascension and declination. - Equatorial equ = Astronomy.EquatorFromVector(axis.north); - axis.ra = equ.ra; - axis.dec = equ.dec; - - // Use a modified version of the era() function that does not trim to 0..360 degrees. - // This expression is also corrected to give the correct angle at the J2000 epoch. - axis.spin = 190.41375788700253 + (360.9856122880876 * time.ut); - - return axis; - } - - /// /// Calculates the inverse of an atmospheric refraction angle. /// /// /// Given an observed altitude angle that includes atmospheric refraction, - /// calculate the negative angular correction to obtain the unrefracted + /// calculates the negative angular correction to obtain the unrefracted /// altitude. This is useful for cases where observed horizontal /// coordinates are to be converted to another orientation system, /// but refraction first must be removed from the observed position. @@ -8072,6 +8003,35 @@ $ASTRO_IAU_DATA() } } + + private static AxisInfo EarthRotationAxis(AstroTime time) + { + AxisInfo axis; + + // Unlike the other planets, we have a model of precession and nutation + // for the Earth's axis that provides a north pole vector. + // So calculate the vector first, then derive the (RA,DEC) angles from the vector. + + // Start with a north pole vector in equator-of-date coordinates: (0,0,1). + var pos1 = new AstroVector(0.0, 0.0, 1.0, time); + + // Convert the vector into J2000 coordinates. + AstroVector pos2 = nutation(pos1, PrecessDirection.Into2000); + axis.north = precession(pos2, PrecessDirection.Into2000); + + // Derive angular values: right ascension and declination. + Equatorial equ = Astronomy.EquatorFromVector(axis.north); + axis.ra = equ.ra; + axis.dec = equ.dec; + + // Use a modified version of the era() function that does not trim to 0..360 degrees. + // This expression is also corrected to give the correct angle at the J2000 epoch. + axis.spin = 190.41375788700253 + (360.9856122880876 * time.ut); + + return axis; + } + + /// /// Calculates information about a body's rotation axis at a given time. /// @@ -8477,7 +8437,7 @@ $ASTRO_IAU_DATA() /// A location near the Earth's mean sea level that defines the observer's horizon. /// /// - /// A rotation matrix that converts HOR to EQD at `time` and for `observer`. + /// A rotation matrix that converts HOR to EQJ at `time` and for `observer`. /// public static RotationMatrix Rotation_HOR_EQJ(AstroTime time, Observer observer) { @@ -8724,10 +8684,10 @@ $ASTRO_IAU_DATA() /// constellation that contains that point. /// /// - /// The right ascension (RA) of a point in the sky, using the J2000 equatorial system. + /// The right ascension (RA) of a point in the sky, using the J2000 equatorial system (EQJ). /// /// - /// The declination (DEC) of a point in the sky, using the J2000 equatorial system. + /// The declination (DEC) of a point in the sky, using the J2000 equatorial system (EQJ). /// /// /// A structure that contains the 3-letter abbreviation and full name @@ -8782,7 +8742,7 @@ $ASTRO_IAU_DATA() return new ConstellationInfo(ConstelNames[b.index].symbol, ConstelNames[b.index].name, equ1875.ra, equ1875.dec); // This should never happen! - throw new Exception("Unable to find constellation for given coordinates."); + throw new Exception($"Unable to find constellation for coordinates: RA={ra}, DEC={dec}"); } $ASTRO_CONSTEL() diff --git a/generate/template/astronomy.py b/generate/template/astronomy.py index f09c23a7..8f9486a1 100644 --- a/generate/template/astronomy.py +++ b/generate/template/astronomy.py @@ -3038,7 +3038,7 @@ def InverseRefractionAngle(refraction, bent_altitude): """Calculates the inverse of an atmospheric refraction angle. Given an observed altitude angle that includes atmospheric refraction, - calculate the negative angular correction to obtain the unrefracted + calculates the negative angular correction to obtain the unrefracted altitude. This is useful for cases where observed horizontal coordinates are to be converted to another orientation system, but refraction first must be removed from the observed position. @@ -4953,7 +4953,7 @@ def InverseRotation(rotation): """Calculates the inverse of a rotation matrix. Given a rotation matrix that performs some coordinate transform, - this function returns the matrix that reverses that trasnform. + this function returns the matrix that reverses that transform. Parameters ---------- @@ -5334,7 +5334,7 @@ def Rotation_HOR_EQJ(time, observer): Returns ------- RotationMatrix - A rotation matrix that converts HOR to EQD at `time` and for `observer`. + A rotation matrix that converts HOR to EQJ at `time` and for `observer`. """ hor_eqd = Rotation_HOR_EQD(time, observer) eqd_eqj = Rotation_EQD_EQJ(time) @@ -5779,7 +5779,7 @@ class LunarEclipseInfo: Returned by #SearchLunarEclipse or #NextLunarEclipse to report information about a lunar eclipse event. When a lunar eclipse is found, it is classified as penumbral, partial, or total. - Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed by the Earth's penumbra; no part of the Moon touches the Earth's umbra. Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -5831,9 +5831,6 @@ class GlobalSolarEclipseInfo: Returned by #SearchGlobalSolarEclipse or #NextGlobalSolarEclipse to report information about a solar eclipse event. - Field `peak` holds the date and time of the peak of the eclipse, defined as - the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - The eclipse is classified as partial, annular, or total, depending on the maximum amount of the Sun's disc obscured, as seen at the peak location on the surface of the Earth. @@ -5856,7 +5853,8 @@ class GlobalSolarEclipseInfo: kind : EclipseKind The type of solar eclipse: `EclipseKind.Partial`, `EclipseKind.Annular`, or `EclipseKind.Total`. peak : Time - The date and time of the eclipse at its peak. + The date and time when the solar eclipse is darkest. + This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. distance : float The distance between the Sun/Moon shadow axis and the center of the Earth, in kilometers. latitude : float @@ -5888,7 +5886,7 @@ class EclipseEvent: (a "local" solar eclipse), a series of events occur. In addition to the time of each event, it is important to know the altitude of the Sun, because each event may be invisible to the observer if the Sun is below - the horizon (i.e. it at night). + the horizon. If `altitude` is negative, the event is theoretical only; it would be visible if the Earth were transparent, but the observer cannot actually see it. diff --git a/generate/template/astronomy.ts b/generate/template/astronomy.ts index 60269c99..2cf5d1f8 100644 --- a/generate/template/astronomy.ts +++ b/generate/template/astronomy.ts @@ -5142,7 +5142,7 @@ export function NextPlanetApsis(body: Body, apsis: Apsis): Apsis { * @brief Calculates the inverse of a rotation matrix. * * Given a rotation matrix that performs some coordinate transform, - * this function returns the matrix that reverses that trasnform. + * this function returns the matrix that reverses that transform. * * @param {RotationMatrix} rotation * The rotation matrix to be inverted. @@ -5504,7 +5504,7 @@ export function Refraction(refraction: string, altitude: number): number { * @brief Calculates the inverse of an atmospheric refraction angle. * * Given an observed altitude angle that includes atmospheric refraction, - * calculate the negative angular correction to obtain the unrefracted + * calculates the negative angular correction to obtain the unrefracted * altitude. This is useful for cases where observed horizontal * coordinates are to be converted to another orientation system, * but refraction first must be removed from the observed position. @@ -5774,7 +5774,7 @@ export function Rotation_HOR_EQD(time: FlexibleDateTime, observer: Observer): Ro * A location near the Earth's mean sea level that defines the observer's horizon. * * @returns {RotationMatrix} - * A rotation matrix that converts HOR to EQD at `time` and for `observer`. + * A rotation matrix that converts HOR to EQJ at `time` and for `observer`. */ export function Rotation_HOR_EQJ(time: FlexibleDateTime, observer: Observer): RotationMatrix { time = MakeTime(time); @@ -6061,7 +6061,7 @@ export function Constellation(ra: number, dec: number): ConstellationInfo { * Returned by {@link SearchLunarEclipse} or {@link NextLunarEclipse} * to report information about a lunar eclipse event. * When a lunar eclipse is found, it is classified as penumbral, partial, or total. - * Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + * Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed * by the Earth's penumbra; no part of the Moon touches the Earth's umbra. * Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. * Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -6396,9 +6396,6 @@ export function SearchLunarEclipse(date: FlexibleDateTime): LunarEclipseInfo { * Returned by {@link SearchGlobalSolarEclipse} or {@link NextGlobalSolarEclipse} * to report information about a solar eclipse event. * - * Field `peak` holds the date and time of the peak of the eclipse, defined as - * the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - * * The eclipse is classified as partial, annular, or total, depending on the * maximum amount of the Sun's disc obscured, as seen at the peak location * on the surface of the Earth. @@ -6420,8 +6417,8 @@ export function SearchLunarEclipse(date: FlexibleDateTime): LunarEclipseInfo { * One of the following string values: `"partial"`, `"annular"`, `"total"`. * * @property {AstroTime} peak - * The date and time of the peak of the eclipse, defined as the instant - * when the axis of the Moon's shadow cone passes closest to the Earth's center. + * The date and time when the solar eclipse is darkest. + * This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. * * @property {number} distance * The distance in kilometers between the axis of the Moon's shadow cone @@ -6645,7 +6642,7 @@ export function NextGlobalSolarEclipse(prevEclipseTime: FlexibleDateTime): Globa * (a "local" solar eclipse), a series of events occur. In addition * to the time of each event, it is important to know the altitude of the Sun, * because each event may be invisible to the observer if the Sun is below - * the horizon (i.e. it at night). + * the horizon. * * If `altitude` is negative, the event is theoretical only; it would be * visible if the Earth were transparent, but the observer cannot actually see it. diff --git a/source/c/README.md b/source/c/README.md index a92fda7d..328882d0 100644 --- a/source/c/README.md +++ b/source/c/README.md @@ -947,7 +947,7 @@ When the body is Saturn, the returned structure contains a field `ring_tilt` tha -Given an observed altitude angle that includes atmospheric refraction, calculate the negative angular correction to obtain the unrefracted altitude. This is useful for cases where observed horizontal coordinates are to be converted to another orientation system, but refraction first must be removed from the observed position. +Given an observed altitude angle that includes atmospheric refraction, calculates the negative angular correction to obtain the unrefracted altitude. This is useful for cases where observed horizontal coordinates are to be converted to another orientation system, but refraction first must be removed from the observed position. @@ -972,7 +972,7 @@ Given an observed altitude angle that includes atmospheric refraction, calculate -Given a rotation matrix that performs some coordinate transform, this function returns the matrix that reverses that trasnform. +Given a rotation matrix that performs some coordinate transform, this function returns the matrix that reverses that transform. @@ -998,7 +998,9 @@ Given a rotation matrix that performs some coordinate transform, this function r Calculates position and velocity vectors for Jupiter's moons Io, Europa, Ganymede, and Callisto, at the given date and time. The vectors are jovicentric (relative to the center of Jupiter). Their orientation is the Earth's equatorial system at the J2000 epoch (EQJ). The position components are expressed in astronomical units (AU), and the velocity components are in AU/day. -To convert to heliocentric position vectors, call [`Astronomy_HelioVector`](#Astronomy_HelioVector) with `BODY_JUPITER` to get Jupiter's heliocentric position, then add the jovicentric positions. Likewise, you can call [`Astronomy_GeoVector`](#Astronomy_GeoVector) with `BODY_JUPITER` to convert to geocentric positions. +To convert to heliocentric position vectors, call [`Astronomy_HelioVector`](#Astronomy_HelioVector) with `BODY_JUPITER` to get Jupiter's heliocentric position, then add the jovicentric positions. + +Likewise, you can call [`Astronomy_GeoVector`](#Astronomy_GeoVector) with `BODY_JUPITER` to convert to geocentric positions. However, you will have to manually correct for light travel time from the Jupiter system to Earth to figure out what time to pass to `Astronomy_JupiterMoons` to get an accurate picture of how Jupiter and its moons look from Earth. @@ -1994,7 +1996,7 @@ This is one of the family of functions that returns a rotation matrix for conver -**Returns:** A rotation matrix that converts HOR to EQD at `time` and for `observer`. +**Returns:** A rotation matrix that converts HOR to EQJ at `time` and for `observer`. diff --git a/source/c/astronomy.c b/source/c/astronomy.c index 4cdd6956..f04aee29 100644 --- a/source/c/astronomy.c +++ b/source/c/astronomy.c @@ -4166,8 +4166,14 @@ static astro_state_vector_t CalcJupiterMoon(astro_time_t time, int mindex) * * To convert to heliocentric position vectors, call #Astronomy_HelioVector * with `BODY_JUPITER` to get Jupiter's heliocentric position, then - * add the jovicentric positions. Likewise, you can call #Astronomy_GeoVector + * add the jovicentric positions. + * + * Likewise, you can call #Astronomy_GeoVector * with `BODY_JUPITER` to convert to geocentric positions. + * However, you will have to manually correct for light travel time + * from the Jupiter system to Earth to figure out what time to pass + * to `Astronomy_JupiterMoons` to get an accurate picture + * of how Jupiter and its moons look from Earth. * * @param time The date and time for which to calculate the position vectors. * @return Position vectors of Jupiter's largest 4 moons, as described above. @@ -8028,7 +8034,7 @@ astro_apsis_t Astronomy_NextPlanetApsis(astro_body_t body, astro_apsis_t apsis) * @brief Calculates the inverse of a rotation matrix. * * Given a rotation matrix that performs some coordinate transform, - * this function returns the matrix that reverses that trasnform. + * this function returns the matrix that reverses that transform. * * @param rotation * The rotation matrix to be inverted. @@ -8487,7 +8493,7 @@ double Astronomy_Refraction(astro_refraction_t refraction, double altitude) * Calculates the inverse of an atmospheric refraction angle. * * Given an observed altitude angle that includes atmospheric refraction, - * calculate the negative angular correction to obtain the unrefracted + * calculates the negative angular correction to obtain the unrefracted * altitude. This is useful for cases where observed horizontal * coordinates are to be converted to another orientation system, * but refraction first must be removed from the observed position. @@ -8796,7 +8802,7 @@ astro_rotation_t Astronomy_Rotation_HOR_EQD(astro_time_t *time, astro_observer_t * A location near the Earth's mean sea level that defines the observer's horizon. * * @return - * A rotation matrix that converts HOR to EQD at `time` and for `observer`. + * A rotation matrix that converts HOR to EQJ at `time` and for `observer`. */ astro_rotation_t Astronomy_Rotation_HOR_EQJ(astro_time_t *time, astro_observer_t observer) { diff --git a/source/csharp/README.md b/source/csharp/README.md index 4dfad74c..0cbe96c7 100644 --- a/source/csharp/README.md +++ b/source/csharp/README.md @@ -172,7 +172,7 @@ these are used in function and type names. ### `const double Astronomy.CALLISTO_RADIUS_KM = 2410.3;` -**The The mean radius of Jupiter's moon Callisto, expressed in kilometers.** +**The mean radius of Jupiter's moon Callisto, expressed in kilometers.** --- @@ -188,7 +188,7 @@ these are used in function and type names. ### `const double Astronomy.EUROPA_RADIUS_KM = 1560.8;` -**The The mean radius of Jupiter's moon Europa, expressed in kilometers.** +**The mean radius of Jupiter's moon Europa, expressed in kilometers.** --- @@ -196,7 +196,7 @@ these are used in function and type names. ### `const double Astronomy.GANYMEDE_RADIUS_KM = 2631.2;` -**The The mean radius of Jupiter's moon Ganymede, expressed in kilometers.** +**The mean radius of Jupiter's moon Ganymede, expressed in kilometers.** --- @@ -212,7 +212,7 @@ these are used in function and type names. ### `const double Astronomy.IO_RADIUS_KM = 1821.6;` -**The The mean radius of Jupiter's moon Io, expressed in kilometers.** +**The mean radius of Jupiter's moon Io, expressed in kilometers.** --- @@ -343,8 +343,8 @@ constellation that contains that point. | Type | Parameter | Description | | --- | --- | --- | -| `double` | `ra` | The right ascension (RA) of a point in the sky, using the J2000 equatorial system. | -| `double` | `dec` | The declination (DEC) of a point in the sky, using the J2000 equatorial system. | +| `double` | `ra` | The right ascension (RA) of a point in the sky, using the J2000 equatorial system (EQJ). | +| `double` | `dec` | The declination (DEC) of a point in the sky, using the J2000 equatorial system (EQJ). | **Returns:** A structure that contains the 3-letter abbreviation and full name of the constellation that contains the given (ra,dec), along with the converted B1875 (ra,dec) for that point. @@ -574,14 +574,14 @@ movement of the Earth with respect to the rays of light coming from that body. **Calculates the distance between a body and the Sun at a given time.** Given a date and time, this function calculates the distance between -the center of `body` and the center of the Sun. +the center of `body` and the center of the Sun, expressed in AU. For the planets Mercury through Neptune, this function is significantly more efficient than calling [`Astronomy.HelioVector`](#Astronomy.HelioVector) followed by taking the length of the resulting vector. | Type | Parameter | Description | | --- | --- | --- | -| [`Body`](#Body) | `body` | A body for which to calculate a heliocentric distance: the Sun, Moon, or any of the planets. | +| [`Body`](#Body) | `body` | A body for which to calculate a heliocentric distance: the Sun, Moon, EMB, SSB, or any of the planets. | | [`AstroTime`](#AstroTime) | `time` | The date and time for which to calculate the heliocentric distance. | **Returns:** The heliocentric distance in AU. @@ -621,7 +621,7 @@ of the Earth at noon UTC on 1 January 2000. The position is not corrected for light travel time or aberration. This is different from the behavior of [`Astronomy.GeoVector`](#Astronomy.GeoVector). -If given an invalid value for `body`, this function will throw an `ArgumentException`. +If given an invalid value for `body`, this function will throw an [`InvalidBodyException`](#InvalidBodyException). | Type | Parameter | Description | | --- | --- | --- | @@ -747,7 +747,7 @@ the rings appear edge-on, and are thus nearly invisible from the Earth. The `rin **Calculates the inverse of an atmospheric refraction angle.** Given an observed altitude angle that includes atmospheric refraction, -calculate the negative angular correction to obtain the unrefracted +calculates the negative angular correction to obtain the unrefracted altitude. This is useful for cases where observed horizontal coordinates are to be converted to another orientation system, but refraction first must be removed from the observed position. @@ -765,7 +765,7 @@ but refraction first must be removed from the observed position. **Calculates the inverse of a rotation matrix.** Given a rotation matrix that performs some coordinate transform, -this function returns the matrix that reverses that trasnform. +this function returns the matrix that reverses that transform. | Type | Parameter | Description | | --- | --- | --- | @@ -788,7 +788,10 @@ velocity components are in AU/day. To convert to heliocentric position vectors, call [`Astronomy.HelioVector`](#Astronomy.HelioVector) with `Body.Jupiter` to get Jupiter's heliocentric position, then add the jovicentric positions. Likewise, you can call [`Astronomy.GeoVector`](#Astronomy.GeoVector) -to convert to geocentric positions. +to convert to geocentric positions; however, you will have to manually +correct for light travel time from the Jupiter system to Earth to +figure out what time to pass to `jupiterMoons` to get an accurate picture +of how Jupiter and its moons look from Earth. | Type | Parameter | Description | | --- | --- | --- | @@ -1451,7 +1454,7 @@ Target: EQJ = equatorial system, using equator at the J2000 epoch. | [`AstroTime`](#AstroTime) | `time` | The date and time of the observation. | | [`Observer`](#Observer) | `observer` | A location near the Earth's mean sea level that defines the observer's horizon. | -**Returns:** A rotation matrix that converts HOR to EQD at `time` and for `observer`. +**Returns:** A rotation matrix that converts HOR to EQJ at `time` and for `observer`. ### Astronomy.RotationAxis(body, time) ⇒ [`AxisInfo`](#AxisInfo) @@ -2189,7 +2192,7 @@ an `AstroTime` value that can be passed to Astronomy Engine functions. **Converts this `AstroTime` to ISO 8601 format, expressed in UTC with millisecond resolution.** -**Returns:** Example: "2019-08-30T17:45:22.763". +**Returns:** Example: "2019-08-30T17:45:22.763Z". ### AstroTime.ToUtcDateTime() ⇒ `DateTime` @@ -2352,7 +2355,7 @@ When reporting a solar eclipse observed at a specific location on the Earth (a "local" solar eclipse), a series of events occur. In addition to the time of each event, it is important to know the altitude of the Sun, because each event may be invisible to the observer if the Sun is below -the horizon (i.e. it at night). +the horizon. If `altitude` is negative, the event is theoretical only; it would be visible if the Earth were transparent, but the observer cannot actually see it. @@ -2464,9 +2467,6 @@ oriented with respect to the projection of the Earth's equator onto the sky. Returned by [`Astronomy.SearchGlobalSolarEclipse`](#Astronomy.SearchGlobalSolarEclipse) or [`Astronomy.NextGlobalSolarEclipse`](#Astronomy.NextGlobalSolarEclipse) to report information about a solar eclipse event. -Field `peak` holds the date and time of the peak of the eclipse, defined as -the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - The eclipse is classified as partial, annular, or total, depending on the maximum amount of the Sun's disc obscured, as seen at the peak location on the surface of the Earth. @@ -2487,7 +2487,7 @@ not be used. | Type | Name | Description | | --- | --- | --- | | [`EclipseKind`](#EclipseKind) | `kind` | The type of solar eclipse: `EclipseKind.Partial`, `EclipseKind.Annular`, or `EclipseKind.Total`. | -| [`AstroTime`](#AstroTime) | `peak` | The date and time of the eclipse at its peak. | +| [`AstroTime`](#AstroTime) | `peak` | The date and time when the solar eclipse is at its darkest. This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. | | `double` | `distance` | The distance between the Sun/Moon shadow axis and the center of the Earth, in kilometers. | | `double` | `latitude` | The geographic latitude at the center of the peak eclipse shadow. | | `double` | `longitude` | The geographic longitude at the center of the peak eclipse shadow. | @@ -2617,7 +2617,7 @@ See [`EclipseEvent`](#EclipseEvent) for more information. Returned by [`Astronomy.SearchLunarEclipse`](#Astronomy.SearchLunarEclipse) or [`Astronomy.NextLunarEclipse`](#Astronomy.NextLunarEclipse) to report information about a lunar eclipse event. When a lunar eclipse is found, it is classified as penumbral, partial, or total. -Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed +Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed by the Earth's penumbra; no part of the Moon touches the Earth's umbra. Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -2715,7 +2715,7 @@ from a particular place on the Earth. ## `struct RotationMatrix` -**Contains a rotation matrix that can be used to transform one coordinate system to another.** +**A rotation matrix that can be used to transform one coordinate system to another.** | Type | Name | Description | | --- | --- | --- | diff --git a/source/csharp/astronomy.cs b/source/csharp/astronomy.cs index 8530c589..dac6e2d2 100644 --- a/source/csharp/astronomy.cs +++ b/source/csharp/astronomy.cs @@ -273,7 +273,7 @@ namespace CosineKitty /// /// Converts this `AstroTime` to ISO 8601 format, expressed in UTC with millisecond resolution. /// - /// Example: "2019-08-30T17:45:22.763". + /// Example: "2019-08-30T17:45:22.763Z". public override string ToString() { return ToUtcDateTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); @@ -602,7 +602,7 @@ namespace CosineKitty } /// - /// Contains a rotation matrix that can be used to transform one coordinate system to another. + /// A rotation matrix that can be used to transform one coordinate system to another. /// public struct RotationMatrix { @@ -1155,7 +1155,7 @@ namespace CosineKitty /// Returned by #Astronomy.SearchLunarEclipse or #Astronomy.NextLunarEclipse /// to report information about a lunar eclipse event. /// When a lunar eclipse is found, it is classified as penumbral, partial, or total. - /// Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + /// Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed /// by the Earth's penumbra; no part of the Moon touches the Earth's umbra. /// Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. /// Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -1206,9 +1206,6 @@ namespace CosineKitty /// Returned by #Astronomy.SearchGlobalSolarEclipse or #Astronomy.NextGlobalSolarEclipse /// to report information about a solar eclipse event. /// - /// Field `peak` holds the date and time of the peak of the eclipse, defined as - /// the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - /// /// The eclipse is classified as partial, annular, or total, depending on the /// maximum amount of the Sun's disc obscured, as seen at the peak location /// on the surface of the Earth. @@ -1231,7 +1228,10 @@ namespace CosineKitty /// The type of solar eclipse: `EclipseKind.Partial`, `EclipseKind.Annular`, or `EclipseKind.Total`. public EclipseKind kind; - /// The date and time of the eclipse at its peak. + /// + /// The date and time when the solar eclipse is at its darkest. + /// This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. + /// public AstroTime peak; /// The distance between the Sun/Moon shadow axis and the center of the Earth, in kilometers. @@ -1253,7 +1253,7 @@ namespace CosineKitty /// (a "local" solar eclipse), a series of events occur. In addition /// to the time of each event, it is important to know the altitude of the Sun, /// because each event may be invisible to the observer if the Sun is below - /// the horizon (i.e. it at night). + /// the horizon. /// /// If `altitude` is negative, the event is theoretical only; it would be /// visible if the Earth were transparent, but the observer cannot actually see it. @@ -1912,20 +1912,14 @@ namespace CosineKitty -64E-9 * Sine(0.39943-5.37511*T); } - private readonly int[] I = new int[4]; - void Term(int p, int q, int r, int s, out double x, out double y) { - I[0] = p; - I[1] = q; - I[2] = r; - I[3] = s; x = 1.0; y = 0.0; - - for (int k=1; k<=4; ++k) - if (I[k-1] != 0.0) - AddThe(x, y, CO[I[k-1], k], SI[I[k-1], k], out x, out y); + if (p != 0) AddThe(x, y, CO[p, 1], SI[p, 1], out x, out y); + if (q != 0) AddThe(x, y, CO[q, 2], SI[q, 2], out x, out y); + if (r != 0) AddThe(x, y, CO[r, 3], SI[r, 3], out x, out y); + if (s != 0) AddThe(x, y, CO[s, 4], SI[s, 4], out x, out y); } void AddSol( @@ -1946,27 +1940,26 @@ namespace CosineKitty SINPI += coeffp*x; } - void ADDN(double coeffn, int p, int q, int r, int s, out double x, out double y) + void ADDN(double coeffn, int p, int q, int r, int s) { + double x, y; Term(p, q, r, s, out x, out y); N += coeffn * y; } void SolarN() { - double x, y; - N = 0.0; - ADDN(-526.069, 0, 0,1,-2, out x, out y); - ADDN( -3.352, 0, 0,1,-4, out x, out y); - ADDN( +44.297,+1, 0,1,-2, out x, out y); - ADDN( -6.000,+1, 0,1,-4, out x, out y); - ADDN( +20.599,-1, 0,1, 0, out x, out y); - ADDN( -30.598,-1, 0,1,-2, out x, out y); - ADDN( -24.649,-2, 0,1, 0, out x, out y); - ADDN( -2.000,-2, 0,1,-2, out x, out y); - ADDN( -22.571, 0,+1,1,-2, out x, out y); - ADDN( +10.985, 0,-1,1,-2, out x, out y); + ADDN(-526.069, 0, 0, 1, -2); + ADDN( -3.352, 0, 0, 1, -4); + ADDN( +44.297, +1, 0, 1, -2); + ADDN( -6.000, +1, 0, 1, -4); + ADDN( +20.599, -1, 0, 1, 0); + ADDN( -30.598, -1, 0, 1, -2); + ADDN( -24.649, -2, 0, 1, 0); + ADDN( -2.000, -2, 0, 1, -2); + ADDN( -22.571, 0,+1, 1, -2); + ADDN( +10.985, 0,-1, 1, -2); } void Planetary() @@ -1991,7 +1984,7 @@ namespace CosineKitty DLAM = 0; DS = 0; GAM1C = 0; - SINPI = 3422.7000; + SINPI = 3422.7; LongPeriodic(); L0 = Astronomy.PI2*Frac(0.60643382+1336.85522467*T-0.00000313*T2) + DL0/Astronomy.ARC; L = Astronomy.PI2*Frac(0.37489701+1325.55240982*T+0.00002565*T2) + DL /Astronomy.ARC; @@ -2258,22 +2251,22 @@ namespace CosineKitty // https://ssd.jpl.nasa.gov/?sat_phys_par /// - /// The The mean radius of Jupiter's moon Io, expressed in kilometers. + /// The mean radius of Jupiter's moon Io, expressed in kilometers. /// public const double IO_RADIUS_KM = 1821.6; /// - /// The The mean radius of Jupiter's moon Europa, expressed in kilometers. + /// The mean radius of Jupiter's moon Europa, expressed in kilometers. /// public const double EUROPA_RADIUS_KM = 1560.8; /// - /// The The mean radius of Jupiter's moon Ganymede, expressed in kilometers. + /// The mean radius of Jupiter's moon Ganymede, expressed in kilometers. /// public const double GANYMEDE_RADIUS_KM = 2631.2; /// - /// The The mean radius of Jupiter's moon Callisto, expressed in kilometers. + /// The mean radius of Jupiter's moon Callisto, expressed in kilometers. /// public const double CALLISTO_RADIUS_KM = 2410.3; @@ -3828,8 +3821,8 @@ namespace CosineKitty seg[i].a = (1 - ramp)*seg[i].a + ramp*reverse[i].a; } } + return cache[seg_index]; } - return cache[seg_index]; } private static body_grav_calc_t CalcPlutoOneWay( @@ -4171,7 +4164,10 @@ namespace CosineKitty /// To convert to heliocentric position vectors, call #Astronomy.HelioVector /// with `Body.Jupiter` to get Jupiter's heliocentric position, then /// add the jovicentric positions. Likewise, you can call #Astronomy.GeoVector - /// to convert to geocentric positions. + /// to convert to geocentric positions; however, you will have to manually + /// correct for light travel time from the Jupiter system to Earth to + /// figure out what time to pass to `jupiterMoons` to get an accurate picture + /// of how Jupiter and its moons look from Earth. /// /// The date and time for which to calculate the position vectors. /// Position and velocity vectors of Jupiter's largest 4 moons. @@ -4273,15 +4269,15 @@ namespace CosineKitty return new RotationMatrix(rot); } - private static AstroVector precession(AstroVector pos, AstroTime time, PrecessDirection dir) + private static AstroVector precession(AstroVector pos, PrecessDirection dir) { - RotationMatrix r = precession_rot(time, dir); + RotationMatrix r = precession_rot(pos.t, dir); return RotateVector(r, pos); } - private static StateVector precession_posvel(StateVector state, AstroTime time, PrecessDirection dir) + private static StateVector precession_posvel(StateVector state, PrecessDirection dir) { - RotationMatrix rot = precession_rot(time, dir); + RotationMatrix rot = precession_rot(state.t, dir); return RotateState(rot, state); } @@ -4502,7 +4498,7 @@ namespace CosineKitty double eqeq = 15.0 * e_tilt(time).ee; /* Replace with eqeq=0 to get GMST instead of GAST (if we ever need it) */ double theta = era(time.ut); double st = (eqeq + 0.014506 + - (((( - 0.0000000368 * t + (((( - 0.0000000368 * t - 0.000029956 ) * t - 0.00000044 ) * t + 1.3915817 ) * t @@ -4517,7 +4513,7 @@ namespace CosineKitty return time.st; // return sidereal hours in the half-open range [0, 24). } - static Observer inverse_terra(AstroVector ovec, double st) + private static Observer inverse_terra(AstroVector ovec) { double lon_deg, lat_deg, height_km; @@ -4538,6 +4534,7 @@ namespace CosineKitty else { double stlocl = Math.Atan2(y, x); + double st = SiderealTime(ovec.t); /* Calculate exact longitude. */ lon_deg = RAD2DEG*stlocl - (15.0 * st); /* Normalize longitude to the range (-180, +180]. */ @@ -4571,7 +4568,7 @@ namespace CosineKitty } /* We now have a solution for the latitude in radians. */ lat_deg = lat * RAD2DEG; - /* Solve for exact height in meters. */ + /* Solve for exact height in kilometers. */ /* There are two formulas I can use. Use whichever has the less risky denominator. */ double adjust = EARTH_EQUATORIAL_RADIUS_KM / denom; if (Math.Abs(s) > Math.Abs(c)) @@ -4586,8 +4583,7 @@ namespace CosineKitty private static StateVector terra(Observer observer, AstroTime time) { double st = SiderealTime(time); - double df = 1.0 - 0.003352819697896; /* flattening of the Earth */ - double df2 = df * df; + double df2 = EARTH_FLATTENING * EARTH_FLATTENING; double phi = observer.latitude * DEG2RAD; double sinphi = Math.Sin(phi); double cosphi = Math.Cos(phi); @@ -4671,81 +4667,42 @@ namespace CosineKitty } - private static AstroVector nutation(AstroVector pos, AstroTime time, PrecessDirection dir) + private static AstroVector nutation(AstroVector pos, PrecessDirection dir) { - RotationMatrix rot = nutation_rot(time, dir); + RotationMatrix rot = nutation_rot(pos.t, dir); return RotateVector(rot, pos); } - private static StateVector nutation_posvel(StateVector state, AstroTime time, PrecessDirection dir) + private static StateVector nutation_posvel(StateVector state, PrecessDirection dir) { - RotationMatrix rot = nutation_rot(time, dir); + RotationMatrix rot = nutation_rot(state.t, dir); return RotateState(rot, state); } - - private static Equatorial vector2radec(AstroVector pos) - { - double ra, dec, dist; - double xyproj; - - xyproj = pos.x*pos.x + pos.y*pos.y; - dist = Math.Sqrt(xyproj + pos.z*pos.z); - if (xyproj == 0.0) - { - if (pos.z == 0.0) - { - /* Indeterminate coordinates; pos vector has zero length. */ - throw new ArgumentException("Bad vector"); - } - - if (pos.z < 0) - { - ra = 0.0; - dec = -90.0; - } - else - { - ra = 0.0; - dec = +90.0; - } - } - else - { - ra = RAD2HOUR * Math.Atan2(pos.y, pos.x); - if (ra < 0) - ra += 24.0; - - dec = RAD2DEG * Math.Atan2(pos.z, Math.Sqrt(xyproj)); - } - - return new Equatorial(ra, dec, dist, pos); - } - - private static AstroVector gyration(AstroVector pos, AstroTime time, PrecessDirection dir) + private static AstroVector gyration(AstroVector pos, PrecessDirection dir) { // Combine nutation and precession into a single operation I call "gyration". // The order they are composed depends on the direction, // because both directions are mutual inverse functions. return (dir == PrecessDirection.Into2000) ? - precession(nutation(pos, time, dir), time, dir) : - nutation(precession(pos, time, dir), time, dir); + precession(nutation(pos, dir), dir) : + nutation(precession(pos, dir), dir); } - private static StateVector gyration_posvel(StateVector state, AstroTime time, PrecessDirection dir) + private static StateVector gyration_posvel(StateVector state, PrecessDirection dir) { // Combine nutation and precession into a single operation I call "gyration". // The order they are composed depends on the direction, // because both directions are mutual inverse functions. return (dir == PrecessDirection.Into2000) ? - precession_posvel(nutation_posvel(state, time, dir), time, dir) : - nutation_posvel(precession_posvel(state, time, dir), time, dir); + precession_posvel(nutation_posvel(state, dir), dir) : + nutation_posvel(precession_posvel(state, dir), dir); } private static AstroVector geo_pos(AstroTime time, Observer observer) { AstroVector pos = terra(observer, time).Position(); - return gyration(pos, time, PrecessDirection.Into2000); + return gyration(pos, PrecessDirection.Into2000); } private static AstroVector spin(double angle, AstroVector pos) @@ -4761,9 +4718,9 @@ namespace CosineKitty ); } - private static AstroVector ecl2equ_vec(AstroTime time, AstroVector ecl) + private static AstroVector ecl2equ_vec(AstroVector ecl) { - double obl = mean_obliq(time.tt) * DEG2RAD; + double obl = mean_obliq(ecl.t.tt) * DEG2RAD; double cos_obl = Math.Cos(obl); double sin_obl = Math.Sin(obl); @@ -4771,7 +4728,7 @@ namespace CosineKitty ecl.x, ecl.y*cos_obl - ecl.z*sin_obl, ecl.y*sin_obl + ecl.z*cos_obl, - time + ecl.t ); } @@ -4803,10 +4760,10 @@ namespace CosineKitty ); /* Convert ecliptic coordinates to equatorial coordinates, both in mean equinox of date. */ - AstroVector mpos1 = ecl2equ_vec(time, gepos); + AstroVector mpos1 = ecl2equ_vec(gepos); /* Convert from mean equinox of date to J2000. */ - AstroVector mpos2 = precession(mpos1, time, PrecessDirection.Into2000); + AstroVector mpos2 = precession(mpos1, PrecessDirection.Into2000); return mpos2; } @@ -5070,9 +5027,12 @@ namespace CosineKitty /// The position is not corrected for light travel time or aberration. /// This is different from the behavior of #Astronomy.GeoVector. /// - /// If given an invalid value for `body`, this function will throw an `ArgumentException`. + /// If given an invalid value for `body`, this function will throw an #InvalidBodyException. /// - /// A body for which to calculate a heliocentric position: the Sun, Moon, EMB, SSB, or any of the planets. + /// + /// A body for which to calculate a heliocentric position: + /// the Sun, Moon, EMB, SSB, or any of the planets. + /// /// The date and time for which to calculate the position. /// A heliocentric position vector of the center of the given body. public static AstroVector HelioVector(Body body, AstroTime time) @@ -5121,14 +5081,14 @@ namespace CosineKitty /// /// /// Given a date and time, this function calculates the distance between - /// the center of `body` and the center of the Sun. + /// the center of `body` and the center of the Sun, expressed in AU. /// For the planets Mercury through Neptune, this function is significantly /// more efficient than calling #Astronomy.HelioVector followed by taking the length /// of the resulting vector. /// /// /// A body for which to calculate a heliocentric distance: - /// the Sun, Moon, or any of the planets. + /// the Sun, Moon, EMB, SSB, or any of the planets. /// /// /// The date and time for which to calculate the heliocentric distance. @@ -5466,11 +5426,11 @@ namespace CosineKitty switch (equdate) { case EquatorEpoch.OfDate: - AstroVector datevect = gyration(j2000, time, PrecessDirection.From2000); - return vector2radec(datevect); + AstroVector datevect = gyration(j2000, PrecessDirection.From2000); + return EquatorFromVector(datevect); case EquatorEpoch.J2000: - return vector2radec(j2000); + return EquatorFromVector(j2000); default: throw new ArgumentException(string.Format("Unsupported equator epoch {0}", equdate)); @@ -5579,7 +5539,7 @@ namespace CosineKitty return state; if (equdate == EquatorEpoch.J2000) - return gyration_posvel(state, time, PrecessDirection.Into2000); + return gyration_posvel(state, PrecessDirection.Into2000); throw new ArgumentException(string.Format("Unsupported equator epoch {0}", equdate)); } @@ -5618,10 +5578,9 @@ namespace CosineKitty AstroVector vector, EquatorEpoch equdate) { - double gast = SiderealTime(vector.t); if (equdate == EquatorEpoch.J2000) - vector = gyration(vector, vector.t, PrecessDirection.From2000); - return inverse_terra(vector, gast); + vector = gyration(vector, PrecessDirection.From2000); + return inverse_terra(vector); } /// @@ -5854,7 +5813,7 @@ namespace CosineKitty AstroVector sun2000 = new AstroVector(-earth2000.x, -earth2000.y, -earth2000.z, adjusted_time); /* Convert to equatorial Cartesian coordinates of date. */ - AstroVector sun_ofdate = gyration(sun2000, adjusted_time, PrecessDirection.From2000); + AstroVector sun_ofdate = gyration(sun2000, PrecessDirection.From2000); /* Convert equatorial coordinates to ecliptic coordinates. */ double true_obliq = DEG2RAD * e_tilt(adjusted_time).tobl; @@ -8820,7 +8779,7 @@ namespace CosineKitty /// Calculates the inverse of a rotation matrix. /// /// Given a rotation matrix that performs some coordinate transform, - /// this function returns the matrix that reverses that trasnform. + /// this function returns the matrix that reverses that transform. /// /// The rotation matrix to be inverted. /// A rotation matrix that performs the opposite transformation. @@ -9216,40 +9175,12 @@ namespace CosineKitty return refr; } - private static AxisInfo EarthRotationAxis(AstroTime time) - { - AxisInfo axis; - - // Unlike the other planets, we have a model of precession and nutation - // for the Earth's axis that provides a north pole vector. - // So calculate the vector first, then derive the (RA,DEC) angles from the vector. - - // Start with a north pole vector in equator-of-date coordinates: (0,0,1). - var pos1 = new AstroVector(0.0, 0.0, 1.0, time); - - // Convert the vector into J2000 coordinates. - AstroVector pos2 = nutation(pos1, time, PrecessDirection.Into2000); - axis.north = precession(pos2, time, PrecessDirection.Into2000); - - // Derive angular values: right ascension and declination. - Equatorial equ = Astronomy.EquatorFromVector(axis.north); - axis.ra = equ.ra; - axis.dec = equ.dec; - - // Use a modified version of the era() function that does not trim to 0..360 degrees. - // This expression is also corrected to give the correct angle at the J2000 epoch. - axis.spin = 190.41375788700253 + (360.9856122880876 * time.ut); - - return axis; - } - - /// /// Calculates the inverse of an atmospheric refraction angle. /// /// /// Given an observed altitude angle that includes atmospheric refraction, - /// calculate the negative angular correction to obtain the unrefracted + /// calculates the negative angular correction to obtain the unrefracted /// altitude. This is useful for cases where observed horizontal /// coordinates are to be converted to another orientation system, /// but refraction first must be removed from the observed position. @@ -9284,6 +9215,35 @@ namespace CosineKitty } } + + private static AxisInfo EarthRotationAxis(AstroTime time) + { + AxisInfo axis; + + // Unlike the other planets, we have a model of precession and nutation + // for the Earth's axis that provides a north pole vector. + // So calculate the vector first, then derive the (RA,DEC) angles from the vector. + + // Start with a north pole vector in equator-of-date coordinates: (0,0,1). + var pos1 = new AstroVector(0.0, 0.0, 1.0, time); + + // Convert the vector into J2000 coordinates. + AstroVector pos2 = nutation(pos1, PrecessDirection.Into2000); + axis.north = precession(pos2, PrecessDirection.Into2000); + + // Derive angular values: right ascension and declination. + Equatorial equ = Astronomy.EquatorFromVector(axis.north); + axis.ra = equ.ra; + axis.dec = equ.dec; + + // Use a modified version of the era() function that does not trim to 0..360 degrees. + // This expression is also corrected to give the correct angle at the J2000 epoch. + axis.spin = 190.41375788700253 + (360.9856122880876 * time.ut); + + return axis; + } + + /// /// Calculates information about a body's rotation axis at a given time. /// @@ -9689,7 +9649,7 @@ namespace CosineKitty /// A location near the Earth's mean sea level that defines the observer's horizon. /// /// - /// A rotation matrix that converts HOR to EQD at `time` and for `observer`. + /// A rotation matrix that converts HOR to EQJ at `time` and for `observer`. /// public static RotationMatrix Rotation_HOR_EQJ(AstroTime time, Observer observer) { @@ -9936,10 +9896,10 @@ namespace CosineKitty /// constellation that contains that point. /// /// - /// The right ascension (RA) of a point in the sky, using the J2000 equatorial system. + /// The right ascension (RA) of a point in the sky, using the J2000 equatorial system (EQJ). /// /// - /// The declination (DEC) of a point in the sky, using the J2000 equatorial system. + /// The declination (DEC) of a point in the sky, using the J2000 equatorial system (EQJ). /// /// /// A structure that contains the 3-letter abbreviation and full name @@ -9994,7 +9954,7 @@ namespace CosineKitty return new ConstellationInfo(ConstelNames[b.index].symbol, ConstelNames[b.index].name, equ1875.ra, equ1875.dec); // This should never happen! - throw new Exception("Unable to find constellation for given coordinates."); + throw new Exception($"Unable to find constellation for coordinates: RA={ra}, DEC={dec}"); } private static readonly constel_info_t[] ConstelNames = new constel_info_t[] diff --git a/source/js/README.md b/source/js/README.md index d1bba6aa..30610a60 100644 --- a/source/js/README.md +++ b/source/js/README.md @@ -593,7 +593,7 @@ For the Moon orbiting the Earth, apsis is a perigee or apogee, respectively. Returned by [SearchLunarEclipse](#SearchLunarEclipse) or [NextLunarEclipse](#NextLunarEclipse) to report information about a lunar eclipse event. When a lunar eclipse is found, it is classified as penumbral, partial, or total. -Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed +Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed by the Earth's penumbra; no part of the Moon touches the Earth's umbra. Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -630,9 +630,6 @@ may determine the date and time of the beginning/end of each eclipse phase. Returned by [SearchGlobalSolarEclipse](#SearchGlobalSolarEclipse) or [NextGlobalSolarEclipse](#NextGlobalSolarEclipse) to report information about a solar eclipse event. -Field `peak` holds the date and time of the peak of the eclipse, defined as -the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - The eclipse is classified as partial, annular, or total, depending on the maximum amount of the Sun's disc obscured, as seen at the peak location on the surface of the Earth. @@ -654,7 +651,7 @@ not be used. | Name | Type | Description | | --- | --- | --- | | kind | string | One of the following string values: `"partial"`, `"annular"`, `"total"`. | -| peak | [AstroTime](#AstroTime) | The date and time of the peak of the eclipse, defined as the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. | +| peak | [AstroTime](#AstroTime) | The date and time when the solar eclipse is darkest. This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. | | distance | number | The distance in kilometers between the axis of the Moon's shadow cone and the center of the Earth at the time indicated by `peak`. | | latitude | number \| undefined | If `kind` holds `"total"`, the geographic latitude in degrees where the center of the Moon's shadow falls on the Earth at the time indicated by `peak`; otherwise, `latitude` holds `undefined`. | | longitude | number \| undefined | If `kind` holds `"total"`, the geographic longitude in degrees where the center of the Moon's shadow falls on the Earth at the time indicated by `peak`; otherwise, `longitude` holds `undefined`. | @@ -672,7 +669,7 @@ When reporting a solar eclipse observed at a specific location on the Earth (a "local" solar eclipse), a series of events occur. In addition to the time of each event, it is important to know the altitude of the Sun, because each event may be invisible to the observer if the Sun is below -the horizon (i.e. it at night). +the horizon. If `altitude` is negative, the event is theoretical only; it would be visible if the Earth were transparent, but the observer cannot actually see it. @@ -2022,7 +2019,7 @@ See [SearchPlanetApsis](#SearchPlanetApsis) for more details. **Brief**: Calculates the inverse of a rotation matrix. Given a rotation matrix that performs some coordinate transform, -this function returns the matrix that reverses that trasnform. +this function returns the matrix that reverses that transform. | Param | Type | Description | | --- | --- | --- | @@ -2216,7 +2213,7 @@ due to the lensing of the Earth's atmosphere. **Brief**: Calculates the inverse of an atmospheric refraction angle. Given an observed altitude angle that includes atmospheric refraction, -calculate the negative angular correction to obtain the unrefracted +calculates the negative angular correction to obtain the unrefracted altitude. This is useful for cases where observed horizontal coordinates are to be converted to another orientation system, but refraction first must be removed from the observed position. @@ -2382,7 +2379,7 @@ Target: EQD = equatorial system, using equator of the specified date/time. ## Rotation\_HOR\_EQJ(time, observer) ⇒ [RotationMatrix](#RotationMatrix) **Kind**: global function -**Returns**: [RotationMatrix](#RotationMatrix) - A rotation matrix that converts HOR to EQD at `time` and for `observer`. +**Returns**: [RotationMatrix](#RotationMatrix) - A rotation matrix that converts HOR to EQJ at `time` and for `observer`. **Brief**: Calculates a rotation matrix from horizontal (HOR) to J2000 equatorial (EQJ). This is one of the family of functions that returns a rotation matrix diff --git a/source/js/astronomy.browser.js b/source/js/astronomy.browser.js index 032b36d8..82b2da90 100644 --- a/source/js/astronomy.browser.js +++ b/source/js/astronomy.browser.js @@ -5562,7 +5562,7 @@ exports.NextPlanetApsis = NextPlanetApsis; * @brief Calculates the inverse of a rotation matrix. * * Given a rotation matrix that performs some coordinate transform, - * this function returns the matrix that reverses that trasnform. + * this function returns the matrix that reverses that transform. * * @param {RotationMatrix} rotation * The rotation matrix to be inverted. @@ -5902,7 +5902,7 @@ exports.Refraction = Refraction; * @brief Calculates the inverse of an atmospheric refraction angle. * * Given an observed altitude angle that includes atmospheric refraction, - * calculate the negative angular correction to obtain the unrefracted + * calculates the negative angular correction to obtain the unrefracted * altitude. This is useful for cases where observed horizontal * coordinates are to be converted to another orientation system, * but refraction first must be removed from the observed position. @@ -6140,7 +6140,7 @@ exports.Rotation_HOR_EQD = Rotation_HOR_EQD; * A location near the Earth's mean sea level that defines the observer's horizon. * * @returns {RotationMatrix} - * A rotation matrix that converts HOR to EQD at `time` and for `observer`. + * A rotation matrix that converts HOR to EQJ at `time` and for `observer`. */ function Rotation_HOR_EQJ(time, observer) { time = MakeTime(time); @@ -7302,7 +7302,7 @@ exports.Constellation = Constellation; * Returned by {@link SearchLunarEclipse} or {@link NextLunarEclipse} * to report information about a lunar eclipse event. * When a lunar eclipse is found, it is classified as penumbral, partial, or total. - * Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + * Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed * by the Earth's penumbra; no part of the Moon touches the Earth's umbra. * Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. * Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -7596,9 +7596,6 @@ exports.SearchLunarEclipse = SearchLunarEclipse; * Returned by {@link SearchGlobalSolarEclipse} or {@link NextGlobalSolarEclipse} * to report information about a solar eclipse event. * - * Field `peak` holds the date and time of the peak of the eclipse, defined as - * the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - * * The eclipse is classified as partial, annular, or total, depending on the * maximum amount of the Sun's disc obscured, as seen at the peak location * on the surface of the Earth. @@ -7620,8 +7617,8 @@ exports.SearchLunarEclipse = SearchLunarEclipse; * One of the following string values: `"partial"`, `"annular"`, `"total"`. * * @property {AstroTime} peak - * The date and time of the peak of the eclipse, defined as the instant - * when the axis of the Moon's shadow cone passes closest to the Earth's center. + * The date and time when the solar eclipse is darkest. + * This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. * * @property {number} distance * The distance in kilometers between the axis of the Moon's shadow cone @@ -7820,7 +7817,7 @@ exports.NextGlobalSolarEclipse = NextGlobalSolarEclipse; * (a "local" solar eclipse), a series of events occur. In addition * to the time of each event, it is important to know the altitude of the Sun, * because each event may be invisible to the observer if the Sun is below - * the horizon (i.e. it at night). + * the horizon. * * If `altitude` is negative, the event is theoretical only; it would be * visible if the Earth were transparent, but the observer cannot actually see it. diff --git a/source/js/astronomy.d.ts b/source/js/astronomy.d.ts index fc3d3f5f..61980d06 100644 --- a/source/js/astronomy.d.ts +++ b/source/js/astronomy.d.ts @@ -1817,7 +1817,7 @@ export declare function NextPlanetApsis(body: Body, apsis: Apsis): Apsis; * @brief Calculates the inverse of a rotation matrix. * * Given a rotation matrix that performs some coordinate transform, - * this function returns the matrix that reverses that trasnform. + * this function returns the matrix that reverses that transform. * * @param {RotationMatrix} rotation * The rotation matrix to be inverted. @@ -2002,7 +2002,7 @@ export declare function Refraction(refraction: string, altitude: number): number * @brief Calculates the inverse of an atmospheric refraction angle. * * Given an observed altitude angle that includes atmospheric refraction, - * calculate the negative angular correction to obtain the unrefracted + * calculates the negative angular correction to obtain the unrefracted * altitude. This is useful for cases where observed horizontal * coordinates are to be converted to another orientation system, * but refraction first must be removed from the observed position. @@ -2166,7 +2166,7 @@ export declare function Rotation_HOR_EQD(time: FlexibleDateTime, observer: Obser * A location near the Earth's mean sea level that defines the observer's horizon. * * @returns {RotationMatrix} - * A rotation matrix that converts HOR to EQD at `time` and for `observer`. + * A rotation matrix that converts HOR to EQJ at `time` and for `observer`. */ export declare function Rotation_HOR_EQJ(time: FlexibleDateTime, observer: Observer): RotationMatrix; /** @@ -2337,7 +2337,7 @@ export declare function Constellation(ra: number, dec: number): ConstellationInf * Returned by {@link SearchLunarEclipse} or {@link NextLunarEclipse} * to report information about a lunar eclipse event. * When a lunar eclipse is found, it is classified as penumbral, partial, or total. - * Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + * Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed * by the Earth's penumbra; no part of the Moon touches the Earth's umbra. * Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. * Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -2399,9 +2399,6 @@ export declare function SearchLunarEclipse(date: FlexibleDateTime): LunarEclipse * Returned by {@link SearchGlobalSolarEclipse} or {@link NextGlobalSolarEclipse} * to report information about a solar eclipse event. * - * Field `peak` holds the date and time of the peak of the eclipse, defined as - * the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - * * The eclipse is classified as partial, annular, or total, depending on the * maximum amount of the Sun's disc obscured, as seen at the peak location * on the surface of the Earth. @@ -2423,8 +2420,8 @@ export declare function SearchLunarEclipse(date: FlexibleDateTime): LunarEclipse * One of the following string values: `"partial"`, `"annular"`, `"total"`. * * @property {AstroTime} peak - * The date and time of the peak of the eclipse, defined as the instant - * when the axis of the Moon's shadow cone passes closest to the Earth's center. + * The date and time when the solar eclipse is darkest. + * This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. * * @property {number} distance * The distance in kilometers between the axis of the Moon's shadow cone @@ -2501,7 +2498,7 @@ export declare function NextGlobalSolarEclipse(prevEclipseTime: FlexibleDateTime * (a "local" solar eclipse), a series of events occur. In addition * to the time of each event, it is important to know the altitude of the Sun, * because each event may be invisible to the observer if the Sun is below - * the horizon (i.e. it at night). + * the horizon. * * If `altitude` is negative, the event is theoretical only; it would be * visible if the Earth were transparent, but the observer cannot actually see it. diff --git a/source/js/astronomy.js b/source/js/astronomy.js index 498dd34a..008a1db9 100644 --- a/source/js/astronomy.js +++ b/source/js/astronomy.js @@ -5561,7 +5561,7 @@ exports.NextPlanetApsis = NextPlanetApsis; * @brief Calculates the inverse of a rotation matrix. * * Given a rotation matrix that performs some coordinate transform, - * this function returns the matrix that reverses that trasnform. + * this function returns the matrix that reverses that transform. * * @param {RotationMatrix} rotation * The rotation matrix to be inverted. @@ -5901,7 +5901,7 @@ exports.Refraction = Refraction; * @brief Calculates the inverse of an atmospheric refraction angle. * * Given an observed altitude angle that includes atmospheric refraction, - * calculate the negative angular correction to obtain the unrefracted + * calculates the negative angular correction to obtain the unrefracted * altitude. This is useful for cases where observed horizontal * coordinates are to be converted to another orientation system, * but refraction first must be removed from the observed position. @@ -6139,7 +6139,7 @@ exports.Rotation_HOR_EQD = Rotation_HOR_EQD; * A location near the Earth's mean sea level that defines the observer's horizon. * * @returns {RotationMatrix} - * A rotation matrix that converts HOR to EQD at `time` and for `observer`. + * A rotation matrix that converts HOR to EQJ at `time` and for `observer`. */ function Rotation_HOR_EQJ(time, observer) { time = MakeTime(time); @@ -7301,7 +7301,7 @@ exports.Constellation = Constellation; * Returned by {@link SearchLunarEclipse} or {@link NextLunarEclipse} * to report information about a lunar eclipse event. * When a lunar eclipse is found, it is classified as penumbral, partial, or total. - * Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + * Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed * by the Earth's penumbra; no part of the Moon touches the Earth's umbra. * Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. * Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -7595,9 +7595,6 @@ exports.SearchLunarEclipse = SearchLunarEclipse; * Returned by {@link SearchGlobalSolarEclipse} or {@link NextGlobalSolarEclipse} * to report information about a solar eclipse event. * - * Field `peak` holds the date and time of the peak of the eclipse, defined as - * the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - * * The eclipse is classified as partial, annular, or total, depending on the * maximum amount of the Sun's disc obscured, as seen at the peak location * on the surface of the Earth. @@ -7619,8 +7616,8 @@ exports.SearchLunarEclipse = SearchLunarEclipse; * One of the following string values: `"partial"`, `"annular"`, `"total"`. * * @property {AstroTime} peak - * The date and time of the peak of the eclipse, defined as the instant - * when the axis of the Moon's shadow cone passes closest to the Earth's center. + * The date and time when the solar eclipse is darkest. + * This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. * * @property {number} distance * The distance in kilometers between the axis of the Moon's shadow cone @@ -7819,7 +7816,7 @@ exports.NextGlobalSolarEclipse = NextGlobalSolarEclipse; * (a "local" solar eclipse), a series of events occur. In addition * to the time of each event, it is important to know the altitude of the Sun, * because each event may be invisible to the observer if the Sun is below - * the horizon (i.e. it at night). + * the horizon. * * If `altitude` is negative, the event is theoretical only; it would be * visible if the Earth were transparent, but the observer cannot actually see it. diff --git a/source/js/astronomy.ts b/source/js/astronomy.ts index 43990850..68df29ef 100644 --- a/source/js/astronomy.ts +++ b/source/js/astronomy.ts @@ -6148,7 +6148,7 @@ export function NextPlanetApsis(body: Body, apsis: Apsis): Apsis { * @brief Calculates the inverse of a rotation matrix. * * Given a rotation matrix that performs some coordinate transform, - * this function returns the matrix that reverses that trasnform. + * this function returns the matrix that reverses that transform. * * @param {RotationMatrix} rotation * The rotation matrix to be inverted. @@ -6510,7 +6510,7 @@ export function Refraction(refraction: string, altitude: number): number { * @brief Calculates the inverse of an atmospheric refraction angle. * * Given an observed altitude angle that includes atmospheric refraction, - * calculate the negative angular correction to obtain the unrefracted + * calculates the negative angular correction to obtain the unrefracted * altitude. This is useful for cases where observed horizontal * coordinates are to be converted to another orientation system, * but refraction first must be removed from the observed position. @@ -6780,7 +6780,7 @@ export function Rotation_HOR_EQD(time: FlexibleDateTime, observer: Observer): Ro * A location near the Earth's mean sea level that defines the observer's horizon. * * @returns {RotationMatrix} - * A rotation matrix that converts HOR to EQD at `time` and for `observer`. + * A rotation matrix that converts HOR to EQJ at `time` and for `observer`. */ export function Rotation_HOR_EQJ(time: FlexibleDateTime, observer: Observer): RotationMatrix { time = MakeTime(time); @@ -7518,7 +7518,7 @@ export function Constellation(ra: number, dec: number): ConstellationInfo { * Returned by {@link SearchLunarEclipse} or {@link NextLunarEclipse} * to report information about a lunar eclipse event. * When a lunar eclipse is found, it is classified as penumbral, partial, or total. - * Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + * Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed * by the Earth's penumbra; no part of the Moon touches the Earth's umbra. * Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. * Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -7853,9 +7853,6 @@ export function SearchLunarEclipse(date: FlexibleDateTime): LunarEclipseInfo { * Returned by {@link SearchGlobalSolarEclipse} or {@link NextGlobalSolarEclipse} * to report information about a solar eclipse event. * - * Field `peak` holds the date and time of the peak of the eclipse, defined as - * the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - * * The eclipse is classified as partial, annular, or total, depending on the * maximum amount of the Sun's disc obscured, as seen at the peak location * on the surface of the Earth. @@ -7877,8 +7874,8 @@ export function SearchLunarEclipse(date: FlexibleDateTime): LunarEclipseInfo { * One of the following string values: `"partial"`, `"annular"`, `"total"`. * * @property {AstroTime} peak - * The date and time of the peak of the eclipse, defined as the instant - * when the axis of the Moon's shadow cone passes closest to the Earth's center. + * The date and time when the solar eclipse is darkest. + * This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. * * @property {number} distance * The distance in kilometers between the axis of the Moon's shadow cone @@ -8102,7 +8099,7 @@ export function NextGlobalSolarEclipse(prevEclipseTime: FlexibleDateTime): Globa * (a "local" solar eclipse), a series of events occur. In addition * to the time of each event, it is important to know the altitude of the Sun, * because each event may be invisible to the observer if the Sun is below - * the horizon (i.e. it at night). + * the horizon. * * If `altitude` is negative, the event is theoretical only; it would be * visible if the Earth were transparent, but the observer cannot actually see it. diff --git a/source/js/esm/astronomy.js b/source/js/esm/astronomy.js index b3ddaba4..24cf5219 100644 --- a/source/js/esm/astronomy.js +++ b/source/js/esm/astronomy.js @@ -5491,7 +5491,7 @@ export function NextPlanetApsis(body, apsis) { * @brief Calculates the inverse of a rotation matrix. * * Given a rotation matrix that performs some coordinate transform, - * this function returns the matrix that reverses that trasnform. + * this function returns the matrix that reverses that transform. * * @param {RotationMatrix} rotation * The rotation matrix to be inverted. @@ -5821,7 +5821,7 @@ export function Refraction(refraction, altitude) { * @brief Calculates the inverse of an atmospheric refraction angle. * * Given an observed altitude angle that includes atmospheric refraction, - * calculate the negative angular correction to obtain the unrefracted + * calculates the negative angular correction to obtain the unrefracted * altitude. This is useful for cases where observed horizontal * coordinates are to be converted to another orientation system, * but refraction first must be removed from the observed position. @@ -6050,7 +6050,7 @@ export function Rotation_HOR_EQD(time, observer) { * A location near the Earth's mean sea level that defines the observer's horizon. * * @returns {RotationMatrix} - * A rotation matrix that converts HOR to EQD at `time` and for `observer`. + * A rotation matrix that converts HOR to EQJ at `time` and for `observer`. */ export function Rotation_HOR_EQJ(time, observer) { time = MakeTime(time); @@ -7202,7 +7202,7 @@ export function Constellation(ra, dec) { * Returned by {@link SearchLunarEclipse} or {@link NextLunarEclipse} * to report information about a lunar eclipse event. * When a lunar eclipse is found, it is classified as penumbral, partial, or total. - * Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + * Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed * by the Earth's penumbra; no part of the Moon touches the Earth's umbra. * Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. * Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -7494,9 +7494,6 @@ export function SearchLunarEclipse(date) { * Returned by {@link SearchGlobalSolarEclipse} or {@link NextGlobalSolarEclipse} * to report information about a solar eclipse event. * - * Field `peak` holds the date and time of the peak of the eclipse, defined as - * the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - * * The eclipse is classified as partial, annular, or total, depending on the * maximum amount of the Sun's disc obscured, as seen at the peak location * on the surface of the Earth. @@ -7518,8 +7515,8 @@ export function SearchLunarEclipse(date) { * One of the following string values: `"partial"`, `"annular"`, `"total"`. * * @property {AstroTime} peak - * The date and time of the peak of the eclipse, defined as the instant - * when the axis of the Moon's shadow cone passes closest to the Earth's center. + * The date and time when the solar eclipse is darkest. + * This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. * * @property {number} distance * The distance in kilometers between the axis of the Moon's shadow cone @@ -7714,7 +7711,7 @@ export function NextGlobalSolarEclipse(prevEclipseTime) { * (a "local" solar eclipse), a series of events occur. In addition * to the time of each event, it is important to know the altitude of the Sun, * because each event may be invisible to the observer if the Sun is below - * the horizon (i.e. it at night). + * the horizon. * * If `altitude` is negative, the event is theoretical only; it would be * visible if the Earth were transparent, but the observer cannot actually see it. diff --git a/source/python/README.md b/source/python/README.md index f467c3b3..d4a72d43 100644 --- a/source/python/README.md +++ b/source/python/README.md @@ -339,7 +339,7 @@ When reporting a solar eclipse observed at a specific location on the Earth (a "local" solar eclipse), a series of events occur. In addition to the time of each event, it is important to know the altitude of the Sun, because each event may be invisible to the observer if the Sun is below -the horizon (i.e. it at night). +the horizon. If `altitude` is negative, the event is theoretical only; it would be visible if the Earth were transparent, but the observer cannot actually see it. If `altitude` is positive but less than a few degrees, visibility will be impaired by @@ -411,8 +411,6 @@ equator projected onto the sky. Returned by [`SearchGlobalSolarEclipse`](#SearchGlobalSolarEclipse) or [`NextGlobalSolarEclipse`](#NextGlobalSolarEclipse) to report information about a solar eclipse event. -Field `peak` holds the date and time of the peak of the eclipse, defined as -the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. The eclipse is classified as partial, annular, or total, depending on the maximum amount of the Sun's disc obscured, as seen at the peak location on the surface of the Earth. @@ -431,7 +429,7 @@ not be used. | Type | Attribute | Description | | --- | --- | --- | | [`EclipseKind`](#EclipseKind) | `kind` | The type of solar eclipse: `EclipseKind.Partial`, `EclipseKind.Annular`, or `EclipseKind.Total`. | -| [`Time`](#Time) | `peak` | The date and time of the eclipse at its peak. | +| [`Time`](#Time) | `peak` | The date and time when the solar eclipse is darkest. This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. | | `float` | `distance` | The distance between the Sun/Moon shadow axis and the center of the Earth, in kilometers. | | `float` | `latitude` | The geographic latitude at the center of the peak eclipse shadow. | | `float` | `longitude` | The geographic longitude at the center of the peak eclipse shadow. | @@ -576,7 +574,7 @@ See [`EclipseEvent`](#EclipseEvent) for more information. Returned by [`SearchLunarEclipse`](#SearchLunarEclipse) or [`NextLunarEclipse`](#NextLunarEclipse) to report information about a lunar eclipse event. When a lunar eclipse is found, it is classified as penumbral, partial, or total. -Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed +Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed by the Earth's penumbra; no part of the Moon touches the Earth's umbra. Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -1617,7 +1615,7 @@ the rings appear edge-on, and are thus nearly invisible from the Earth. The `rin **Calculates the inverse of an atmospheric refraction angle.** Given an observed altitude angle that includes atmospheric refraction, -calculate the negative angular correction to obtain the unrefracted +calculates the negative angular correction to obtain the unrefracted altitude. This is useful for cases where observed horizontal coordinates are to be converted to another orientation system, but refraction first must be removed from the observed position. @@ -1640,7 +1638,7 @@ This will be less than or equal to zero. **Calculates the inverse of a rotation matrix.** Given a rotation matrix that performs some coordinate transform, -this function returns the matrix that reverses that trasnform. +this function returns the matrix that reverses that transform. | Type | Parameter | Description | | --- | --- | --- | @@ -2455,7 +2453,7 @@ Target: EQJ = equatorial system, using equator at the J2000 epoch. | [`Observer`](#Observer) | `observer` | A location near the Earth's mean sea level that define's the observer's horizon. | ### Returns: [`RotationMatrix`](#RotationMatrix) -A rotation matrix that converts HOR to EQD at `time` and for `observer`. +A rotation matrix that converts HOR to EQJ at `time` and for `observer`. --- diff --git a/source/python/astronomy/astronomy.py b/source/python/astronomy/astronomy.py index 58a2223f..0a01fe76 100644 --- a/source/python/astronomy/astronomy.py +++ b/source/python/astronomy/astronomy.py @@ -5080,7 +5080,7 @@ def InverseRefractionAngle(refraction, bent_altitude): """Calculates the inverse of an atmospheric refraction angle. Given an observed altitude angle that includes atmospheric refraction, - calculate the negative angular correction to obtain the unrefracted + calculates the negative angular correction to obtain the unrefracted altitude. This is useful for cases where observed horizontal coordinates are to be converted to another orientation system, but refraction first must be removed from the observed position. @@ -6995,7 +6995,7 @@ def InverseRotation(rotation): """Calculates the inverse of a rotation matrix. Given a rotation matrix that performs some coordinate transform, - this function returns the matrix that reverses that trasnform. + this function returns the matrix that reverses that transform. Parameters ---------- @@ -7376,7 +7376,7 @@ def Rotation_HOR_EQJ(time, observer): Returns ------- RotationMatrix - A rotation matrix that converts HOR to EQD at `time` and for `observer`. + A rotation matrix that converts HOR to EQJ at `time` and for `observer`. """ hor_eqd = Rotation_HOR_EQD(time, observer) eqd_eqj = Rotation_EQD_EQJ(time) @@ -8272,7 +8272,7 @@ class LunarEclipseInfo: Returned by #SearchLunarEclipse or #NextLunarEclipse to report information about a lunar eclipse event. When a lunar eclipse is found, it is classified as penumbral, partial, or total. - Penumbral eclipses are difficult to observe, because the moon is only slightly dimmed + Penumbral eclipses are difficult to observe, because the Moon is only slightly dimmed by the Earth's penumbra; no part of the Moon touches the Earth's umbra. Partial eclipses occur when part, but not all, of the Moon touches the Earth's umbra. Total eclipses occur when the entire Moon passes into the Earth's umbra. @@ -8324,9 +8324,6 @@ class GlobalSolarEclipseInfo: Returned by #SearchGlobalSolarEclipse or #NextGlobalSolarEclipse to report information about a solar eclipse event. - Field `peak` holds the date and time of the peak of the eclipse, defined as - the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. - The eclipse is classified as partial, annular, or total, depending on the maximum amount of the Sun's disc obscured, as seen at the peak location on the surface of the Earth. @@ -8349,7 +8346,8 @@ class GlobalSolarEclipseInfo: kind : EclipseKind The type of solar eclipse: `EclipseKind.Partial`, `EclipseKind.Annular`, or `EclipseKind.Total`. peak : Time - The date and time of the eclipse at its peak. + The date and time when the solar eclipse is darkest. + This is the instant when the axis of the Moon's shadow cone passes closest to the Earth's center. distance : float The distance between the Sun/Moon shadow axis and the center of the Earth, in kilometers. latitude : float @@ -8381,7 +8379,7 @@ class EclipseEvent: (a "local" solar eclipse), a series of events occur. In addition to the time of each event, it is important to know the altitude of the Sun, because each event may be invisible to the observer if the Sun is below - the horizon (i.e. it at night). + the horizon. If `altitude` is negative, the event is theoretical only; it would be visible if the Earth were transparent, but the observer cannot actually see it.