Exemplo n.º 1
0
        /// <summary>
        /// For a terrestrial observer, prepare star-independent astrometry
        /// parameters for transformations between CIRS and observed
        /// coordinates.  The caller supplies UTC, site coordinates, ambient air
        /// conditions and observing wavelength.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="utc1">UTC as a 2-part...</param>
        /// <param name="utc2">...quasi Julian Date (Notes 1,2)</param>
        /// <param name="dut1">UT1-UTC (seconds)</param>
        /// <param name="elong">longitude (radians, east +ve, Note 3)</param>
        /// <param name="phi">geodetic latitude (radians, Note 3)</param>
        /// <param name="hm">height above ellipsoid (m, geodetic Notes 4,6)</param>
        /// <param name="xp">polar motion coordinates (radians, Note 5)</param>
        /// <param name="yp">polar motion coordinates (radians, Note 5)</param>
        /// <param name="phpa">pressure at the observer (hPa = mB, Note 6)</param>
        /// <param name="tc">ambient temperature at the observer (deg C)</param>
        /// <param name="rh">relative humidity at the observer (range 0-1)</param>
        /// <param name="wl">wavelength (micrometers, Note 7)</param>
        /// <param name="astrom">star-independent astrometry parameters:</param>
        /// <returns></returns>
        public static int wwaApio13(double utc1, double utc2, double dut1, double elong, double phi, double hm, double xp, double yp,
                                    double phpa, double tc, double rh, double wl, ref wwaASTROM astrom)
        {
            int    j;
            double tai1 = 0, tai2 = 0, tt1 = 0, tt2 = 0, ut11 = 0, ut12 = 0, sp, theta, refa = 0, refb = 0;

            /* UTC to other time scales. */
            j = wwaUtctai(utc1, utc2, ref tai1, ref tai2);
            if (j < 0)
            {
                return(-1);
            }
            j = wwaTaitt(tai1, tai2, ref tt1, ref tt2);
            j = wwaUtcut1(utc1, utc2, dut1, ref ut11, ref ut12);
            if (j < 0)
            {
                return(-1);
            }

            /* TIO locator s'. */
            sp = wwaSp00(tt1, tt2);

            /* Earth rotation angle. */
            theta = wwaEra00(ut11, ut12);

            /* Refraction constants A and B. */
            wwaRefco(phpa, tc, rh, wl, ref refa, ref refb);

            /* CIRS <-> observed astrometry parameters. */
            wwaApio(sp, theta, elong, phi, hm, xp, yp, refa, refb, ref astrom);

            /* Return any warning status. */
            return(j);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Quick ICRS to CIRS transformation, given precomputed star-
        /// independent astrometry parameters, and assuming zero parallax and
        /// proper motion.
        ///
        /// Use of this function is appropriate when efficiency is important and
        /// where many star positions are to be transformed for one date.  The
        /// star-independent parameters can be obtained by calling one of the
        /// functions iauApci[13], iauApcg[13], wwaApco[13] or wwaApcs[13].
        ///
        /// The corresponding function for the case of non-zero parallax and
        /// proper motion is wwaAtciq.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="rc">ICRS astrometric RA,Dec (radians)</param>
        /// <param name="dc">ICRS astrometric RA,Dec (radians)</param>
        /// <param name="astrom">star-independent astrometry parameters:</param>
        /// <param name="ri">CIRS RA,Dec (radians)</param>
        /// <param name="di">CIRS RA,Dec (radians)</param>
        public static void wwaAtciqz(double rc, double dc, ref wwaASTROM astrom, ref double ri, ref double di)
        {
            double[] pco = new double[3] {
                0, 0, 0
            };
            double[] pnat = new double[3] {
                0, 0, 0
            };
            double[] ppr = new double[3] {
                0, 0, 0
            };
            double[] pi = new double[3];
            double   w  = 0;

            /* BCRS coordinate direction (unit vector). */
            wwaS2c(rc, dc, pco);

            /* Light deflection by the Sun, giving BCRS natural direction. */
            wwaLdsun(pco, astrom.eh, astrom.em, pnat);

            /* Aberration, giving GCRS proper direction. */
            wwaAb(pnat, astrom.v, astrom.em, astrom.bm1, ref ppr);

            /* Bias-precession-nutation, giving CIRS proper direction. */
            wwaRxp(astrom.bpn, ppr, pi);

            /* CIRS RA,Dec. */
            wwaC2s(pi, ref w, ref di);
            ri = wwaAnp(w);
        }
Exemplo n.º 3
0
        /// <summary>
        /// For a terrestrial observer, prepare star-independent astrometry
        /// parameters for transformations between ICRS and geocentric CIRS
        /// coordinates.  The caller supplies the date, and SOFA models are used
        /// to predict the Earth ephemeris and CIP/CIO.
        ///
        /// The parameters produced by this function are required in the
        /// parallax, light deflection, aberration, and bias-precession-nutation
        /// parts of the astrometric transformation chain.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="date1">TDB as a 2-part...</param>
        /// <param name="date2">...Julian Date (Note 1)</param>
        /// <param name="astrom">star-independent astrometry parameters</param>
        /// <param name="eo">equation of the origins (ERA-GST)</param>
        public static void wwaApci13(double date1, double date2, ref wwaASTROM astrom, ref double eo)
        {
            double[,] ehpv = new double[2, 3] {
                { 0, 0, 0 }, { 0, 0, 0 }
            };
            double[,] ebpv = new double[2, 3] {
                { 0, 0, 0 }, { 0, 0, 0 }
            };

            double[,] r = new double[3, 3];
            double x = 0, y = 0, s;

            /* Earth barycentric & heliocentric position/velocity (au, au/d). */
            wwaEpv00(date1, date2, ehpv, ebpv);

            /* Form the equinox based BPN matrix, IAU 2006/2000A. */
            wwaPnm06a(date1, date2, r);

            /* Extract CIP X,Y. */
            wwaBpn2xy(r, ref x, ref y);

            /* Obtain CIO locator s. */
            s = wwaS06(date1, date2, x, y);

            /* Compute the star-independent astrometry parameters. */
            wwaApci(date1, date2, ebpv, CopyArray(ehpv, 0), x, y, s, ref astrom);

            /* Equation of the origins. */
            eo = wwaEors(r, s);
        }
Exemplo n.º 4
0
        /// <summary>
        /// ICRS RA,Dec to observed place.  The caller supplies UTC, site
        /// coordinates, ambient air conditions and observing wavelength.
        ///
        /// SOFA models are used for the Earth ephemeris, bias-precession-
        /// nutation, Earth orientation and refraction.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="rc">ICRS right ascension at J2000.0 (radians, Note 1)</param>
        /// <param name="dc">ICRS right ascension at J2000.0 (radians, Note 1)</param>
        /// <param name="pr">RA proper motion (radians/year; Note 2)</param>
        /// <param name="pd">Dec proper motion (radians/year)</param>
        /// <param name="px">parallax (arcsec)</param>
        /// <param name="rv">radial velocity (km/s, +ve if receding)</param>
        /// <param name="utc1">UTC as a 2-part...</param>
        /// <param name="utc2">...quasi Julian Date (Notes 3-4)</param>
        /// <param name="dut1">UT1-UTC (seconds, Note 5)</param>
        /// <param name="elong">longitude (radians, east +ve, Note 6)</param>
        /// <param name="phi">latitude (geodetic, radians, Note 6)</param>
        /// <param name="hm">height above ellipsoid (m, geodetic, Notes 6,8)</param>
        /// <param name="xp">polar motion coordinates (radians, Note 7)</param>
        /// <param name="yp">polar motion coordinates (radians, Note 7)</param>
        /// <param name="phpa">pressure at the observer (hPa = mB, Note 8)</param>
        /// <param name="tc">ambient temperature at the observer (deg C)</param>
        /// <param name="rh">relative humidity at the observer (range 0-1)</param>
        /// <param name="wl">wavelength (micrometers, Note 9)</param>
        /// <param name="aob">observed azimuth (radians: N=0,E=90)</param>
        /// <param name="zob">observed zenith distance (radians)</param>
        /// <param name="hob">observed hour angle (radians)</param>
        /// <param name="dob">observed declination (radians)</param>
        /// <param name="rob">observed right ascension (CIO-based, radians)</param>
        /// <param name="eo">equation of the origins (ERA-GST)</param>
        /// <returns>status:
        /// +1 = dubious year (Note 4)
        /// 0 = OK
        /// -1 = unacceptable date
        /// </returns>
        public static int wwaAtco13(double rc, double dc, double pr, double pd, double px, double rv, double utc1, double utc2, double dut1,
                                    double elong, double phi, double hm, double xp, double yp, double phpa, double tc, double rh, double wl,
                                    ref double aob, ref double zob, ref double hob, ref double dob, ref double rob, ref double eo)
        {
            int       j;
            wwaASTROM astrom = new wwaASTROM();

            astrom.eb  = new double[3];
            astrom.eh  = new double[3];
            astrom.bpn = new double[3, 3];

            double ri = 0, di = 0;

            /* Star-independent astrometry parameters. */
            j = wwaApco13(utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl, ref astrom, ref eo);

            /* Abort if bad UTC. */
            if (j < 0)
            {
                return(j);
            }

            /* Transform ICRS to CIRS. */
            wwaAtciq(rc, dc, pr, pd, px, rv, ref astrom, ref ri, ref di);

            /* Transform CIRS to observed. */
            wwaAtioq(ri, di, ref astrom, ref aob, ref zob, ref hob, ref dob, ref rob);

            /* Return OK/warning status. */
            return(j);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Observed place at a groundbased site to to ICRS astrometric RA,Dec.
        /// The caller supplies UTC, site coordinates, ambient air conditions
        /// and observing wavelength.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="type">type of coordinates - "R", "H" or "A" (Notes 1,2)</param>
        /// <param name="ob1">observed Az, HA or RA (radians; Az is N=0,E=90)</param>
        /// <param name="ob2">observed ZD or Dec (radians)</param>
        /// <param name="utc1">UTC as a 2-part...</param>
        /// <param name="utc2">...quasi Julian Date (Notes 3,4)</param>
        /// <param name="dut1">UT1-UTC (seconds, Note 5)</param>
        /// <param name="elong">longitude (radians, east +ve, Note 6)</param>
        /// <param name="phi">geodetic latitude (radians, Note 6)</param>
        /// <param name="hm">height above ellipsoid (m, geodetic Notes 6,8)</param>
        /// <param name="xp">polar motion coordinates (radians, Note 7)</param>
        /// <param name="yp">polar motion coordinates (radians, Note 7)</param>
        /// <param name="phpa">pressure at the observer (hPa = mB, Note 8)</param>
        /// <param name="tc">ambient temperature at the observer (deg C)</param>
        /// <param name="rh">relative humidity at the observer (range 0-1)</param>
        /// <param name="wl">wavelength (micrometers, Note 9)</param>
        /// <param name="rc">ICRS astrometric RA,Dec (radians)</param>
        /// <param name="dc">ICRS astrometric RA,Dec (radians)</param>
        /// <returns></returns>
        public static int wwaAtoc13(ref char type, double ob1, double ob2, double utc1, double utc2, double dut1, double elong, double phi, double hm, double xp, double yp,
                                    double phpa, double tc, double rh, double wl, ref double rc, ref double dc)
        {
            int       j;
            wwaASTROM astrom = new wwaASTROM();

            astrom.eb  = new double[3];
            astrom.eh  = new double[3];
            astrom.bpn = new double[3, 3];

            double eo = 0, ri = 0, di = 0;

            /* Star-independent astrometry parameters. */
            j = wwaApco13(utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl, ref astrom, ref eo);

            /* Abort if bad UTC. */
            if (j < 0)
            {
                return(j);
            }

            /* Transform observed to CIRS. */
            wwaAtoiq(ref type, ob1, ob2, ref astrom, ref ri, ref di);

            /* Transform CIRS to ICRS. */
            wwaAticq(ri, di, ref astrom, ref rc, ref dc);

            /* Return OK/warning status. */
            return(j);
        }
Exemplo n.º 6
0
        /// <summary>
        /// For a terrestrial observer, prepare star-independent astrometry
        /// parameters for transformations between ICRS and observed
        /// coordinates.  The caller supplies UTC, site coordinates, ambient air
        /// conditions and observing wavelength, and SOFA models are used to
        /// obtain the Earth ephemeris, CIP/CIO and refraction constants.
        ///
        /// The parameters produced by this function are required in the
        /// parallax, light deflection, aberration, and bias-precession-nutation
        /// parts of the ICRS/CIRS transformations.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="utc1">UTC as a 2-part...</param>
        /// <param name="utc2">...quasi Julian Date (Notes 1,2)</param>
        /// <param name="dut1">UT1-UTC (seconds, Note 3)</param>
        /// <param name="elong">longitude (radians, east +ve, Note 4)</param>
        /// <param name="phi">latitude (geodetic, radians, Note 4)</param>
        /// <param name="hm">height above ellipsoid (m, geodetic, Notes 4,6)</param>
        /// <param name="xp">polar motion coordinates (radians, Note 5)</param>
        /// <param name="yp">polar motion coordinates (radians, Note 5)</param>
        /// <param name="phpa">pressure at the observer (hPa = mB, Note 6)</param>
        /// <param name="tc">ambient temperature at the observer (deg C)</param>
        /// <param name="rh">relative humidity at the observer (range 0-1)</param>
        /// <param name="wl">wavelength (micrometers, Note 7)</param>
        /// <param name="astrom">star-independent astrometry parameters</param>
        /// <param name="eo">equation of the origins (ERA-GST)</param>
        /// <returns></returns>
        public static int wwaApco13(double utc1, double utc2, double dut1, double elong, double phi, double hm, double xp, double yp, double phpa, double tc, double rh,
                                    double wl, ref wwaASTROM astrom, ref double eo)
        {
            int    j;
            double tai1 = 0, tai2 = 0, tt1 = 0, tt2 = 0, ut11 = 0, ut12 = 0, x = 0, y = 0, s, theta, sp, refa = 0, refb = 0;

            double[,] ehpv = new double[2, 3] {
                { 0, 0, 0 }, { 0, 0, 0 }
            };
            double[,] ebpv = new double[2, 3] {
                { 0, 0, 0 }, { 0, 0, 0 }
            };
            double[,] r = new double[3, 3];

            /* UTC to other time scales. */
            j = wwaUtctai(utc1, utc2, ref tai1, ref tai2);
            if (j < 0)
            {
                return(-1);
            }
            j = wwaTaitt(tai1, tai2, ref tt1, ref tt2);
            j = wwaUtcut1(utc1, utc2, dut1, ref ut11, ref ut12);
            if (j < 0)
            {
                return(-1);
            }

            /* Earth barycentric & heliocentric position/velocity (au, au/d). */
            wwaEpv00(tt1, tt2, ehpv, ebpv);

            /* Form the equinox based BPN matrix, IAU 2006/2000A. */
            wwaPnm06a(tt1, tt2, r);

            /* Extract CIP X,Y. */
            wwaBpn2xy(r, ref x, ref y);

            /* Obtain CIO locator s. */
            s = wwaS06(tt1, tt2, x, y);

            /* Earth rotation angle. */
            theta = wwaEra00(ut11, ut12);

            /* TIO locator s'. */
            sp = wwaSp00(tt1, tt2);

            /* Refraction constants A and B. */
            wwaRefco(phpa, tc, rh, wl, ref refa, ref refb);

            /* Compute the star-independent astrometry parameters. */
            wwaApco(tt1, tt2, ebpv, CopyArray(ehpv, 0), x, y, s, theta, elong, phi, hm, xp, yp, sp, refa, refb, ref astrom);

            /* Equation of the origins. */
            eo = wwaEors(r, s);

            /* Return any warning status. */
            return(j);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Transform star RA,Dec from geocentric CIRS to ICRS astrometric.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="ri">CIRS geocentric RA,Dec (radians)</param>
        /// <param name="di">CIRS geocentric RA,Dec (radians)</param>
        /// <param name="date1">TDB as a 2-part...</param>
        /// <param name="date2">...Julian Date (Note 1)</param>
        /// <param name="rc">ICRS astrometric RA,Dec (radians)</param>
        /// <param name="dc">ICRS astrometric RA,Dec (radians)</param>
        /// <param name="eo">equation of the origins (ERA-GST, Note 4)</param>
        public static void wwaAtic13(double ri, double di, double date1, double date2, ref double rc, ref double dc, ref double eo)
        {
            /* Star-independent astrometry parameters */
            wwaASTROM astrom = new wwaASTROM();

            /* Star-independent astrometry parameters. */
            wwaApci13(date1, date2, ref astrom, ref eo);

            /* CIRS to ICRS astrometric. */
            wwaAticq(ri, di, ref astrom, ref rc, ref dc);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Transform ICRS star data, epoch J2000.0, to CIRS.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="rc">ICRS right ascension at J2000.0 (radians, Note 1)</param>
        /// <param name="dc">ICRS declination at J2000.0 (radians, Note 1)</param>
        /// <param name="pr">RA proper motion (radians/year; Note 2)</param>
        /// <param name="pd">Dec proper motion (radians/year)</param>
        /// <param name="px">parallax (arcsec)</param>
        /// <param name="rv">radial velocity (km/s, +ve if receding)</param>
        /// <param name="date1">TDB as a 2-part...</param>
        /// <param name="date2">...Julian Date (Note 3)</param>
        /// <param name="ri">CIRS geocentric RA,Dec (radians)</param>
        /// <param name="di">CIRS geocentric RA,Dec (radians)</param>
        /// <param name="eo">equation of the origins (ERA-GST, Note 5)</param>
        public static void wwaAtci13(double rc, double dc, double pr, double pd, double px, double rv, double date1, double date2, ref double ri, ref double di, ref double eo)
        {
            /* Star-independent astrometry parameters */
            wwaASTROM astrom = new wwaASTROM();

            astrom.eb  = new double[3];
            astrom.eh  = new double[3];
            astrom.bpn = new double[3, 3];

            /* The transformation parameters. */
            wwaApci13(date1, date2, ref astrom, ref eo);

            /* ICRS (epoch J2000.0) to CIRS. */
            wwaAtciq(rc, dc, pr, pd, px, rv, ref astrom, ref ri, ref di);
        }
Exemplo n.º 9
0
        /// <summary>
        /// For an observer whose geocentric position and velocity are known,
        /// prepare star-independent astrometry parameters for transformations
        /// between ICRS and GCRS.  The Earth ephemeris is from SOFA models.
        ///
        /// The parameters produced by this function are required in the space
        /// motion, parallax, light deflection and aberration parts of the
        /// astrometric transformation chain.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="date1">TDB as a 2-part...</param>
        /// <param name="date2">...Julian Date (Note 1)</param>
        /// <param name="pv">observer's geocentric pos/vel (Note 3)</param>
        /// <param name="astrom">star-independent astrometry parameters</param>
        public static void wwaApcs13(double date1, double date2, double[,] pv, ref wwaASTROM astrom)
        {
            double[,] ehpv = new double[2, 3] {
                { 0, 0, 0 }, { 0, 0, 0 }
            };
            double[,] ebpv = new double[2, 3] {
                { 0, 0, 0 }, { 0, 0, 0 }
            };

            /* Earth barycentric & heliocentric position/velocity (au, au/d). */
            wwaEpv00(date1, date2, ehpv, ebpv);

            /* Compute the star-independent astrometry parameters. */
            wwaApcs(date1, date2, pv, ebpv, CopyArray(ehpv, 0), ref astrom);
        }
Exemplo n.º 10
0
        /// <summary>
        /// CIRS RA,Dec to observed place.  The caller supplies UTC, site
        /// coordinates, ambient air conditions and observing wavelength.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="ri">CIRS right ascension (CIO-based, radians)</param>
        /// <param name="di">CIRS declination (radians)</param>
        /// <param name="utc1">UTC as a 2-part...</param>
        /// <param name="utc2">...quasi Julian Date (Notes 1,2)</param>
        /// <param name="dut1">UT1-UTC (seconds, Note 3)</param>
        /// <param name="elong">longitude (radians, east +ve, Note 4)</param>
        /// <param name="phi">geodetic latitude (radians, Note 4)</param>
        /// <param name="hm">height above ellipsoid (m, geodetic Notes 4,6)</param>
        /// <param name="xp">polar motion coordinates (radians, Note 5)</param>
        /// <param name="yp">polar motion coordinates (radians, Note 5)</param>
        /// <param name="phpa">pressure at the observer (hPa = mB, Note 6)</param>
        /// <param name="tc">ambient temperature at the observer (deg C)</param>
        /// <param name="rh">relative humidity at the observer (range 0-1)</param>
        /// <param name="wl">wavelength (micrometers, Note 7)</param>
        /// <param name="aob">observed azimuth (radians: N=0,E=90)</param>
        /// <param name="zob">observed zenith distance (radians)</param>
        /// <param name="hob">observed hour angle (radians)</param>
        /// <param name="dob">observed declination (radians)</param>
        /// <param name="rob">observed right ascension (CIO-based, radians)</param>
        /// <returns>status:
        /// +1 = dubious year (Note 2)
        /// 0 = OK
        /// -1 = unacceptable date
        /// </returns>
        public static int wwaAtio13(double ri, double di, double utc1, double utc2, double dut1, double elong, double phi, double hm, double xp, double yp,
                                    double phpa, double tc, double rh, double wl, ref double aob, ref double zob, ref double hob, ref double dob, ref double rob)
        {
            int       j;
            wwaASTROM astrom = new wwaASTROM();

            /* Star-independent astrometry parameters for CIRS->observed. */
            j = wwaApio13(utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl, ref astrom);

            /* Abort if bad UTC. */
            if (j < 0)
            {
                return(j);
            }

            /* Transform CIRS to observed. */
            wwaAtioq(ri, di, ref astrom, ref aob, ref zob, ref hob, ref dob, ref rob);

            /* Return OK/warning status. */
            return(j);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Observed place to CIRS.  The caller supplies UTC, site coordinates,
        /// ambient air conditions and observing wavelength.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="type">type of coordinates - "R", "H" or "A" (Notes 1,2)</param>
        /// <param name="ob1">observed Az, HA or RA (radians; Az is N=0,E=90)</param>
        /// <param name="ob2">observed ZD or Dec (radians)</param>
        /// <param name="utc1">UTC as a 2-part...</param>
        /// <param name="utc2">...quasi Julian Date (Notes 3,4)</param>
        /// <param name="dut1">UT1-UTC (seconds, Note 5)</param>
        /// <param name="elong">longitude (radians, east +ve, Note 6)</param>
        /// <param name="phi">geodetic latitude (radians, Note 6)</param>
        /// <param name="hm">height above the ellipsoid (meters, Notes 6,8)</param>
        /// <param name="xp">polar motion coordinates (radians, Note 7)</param>
        /// <param name="yp">polar motion coordinates (radians, Note 7)</param>
        /// <param name="phpa">pressure at the observer (hPa = mB, Note 8)</param>
        /// <param name="tc">ambient temperature at the observer (deg C)</param>
        /// <param name="rh">relative humidity at the observer (range 0-1)</param>
        /// <param name="wl">wavelength (micrometers, Note 9)</param>
        /// <param name="ri">CIRS right ascension (CIO-based, radians)</param>
        /// <param name="di">CIRS declination (radians)</param>
        /// <returns>status:
        /// +1 = dubious year (Note 2)
        /// 0 = OK
        /// -1 = unacceptable date
        /// </returns>
        public static int wwaAtoi13(ref char type, double ob1, double ob2, double utc1, double utc2, double dut1,
                                    double elong, double phi, double hm, double xp, double yp, double phpa, double tc, double rh, double wl,
                                    ref double ri, ref double di)
        {
            int       j;
            wwaASTROM astrom = new wwaASTROM();

            /* Star-independent astrometry parameters for CIRS->observed. */
            j = wwaApio13(utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl, ref astrom);

            /* Abort if bad UTC. */
            if (j < 0)
            {
                return(j);
            }

            /* Transform observed to CIRS. */
            wwaAtoiq(ref type, ob1, ob2, ref astrom, ref ri, ref di);

            /* Return OK/warning status. */
            return(j);
        }
Exemplo n.º 12
0
Arquivo: apco.cs Projeto: abrudana/wwa
        /// <summary>
        /// For a terrestrial observer, prepare star-independent astrometry
        /// parameters for transformations between ICRS and observed
        /// coordinates.  The caller supplies the Earth ephemeris, the Earth
        /// rotation information and the refraction constants as well as the
        /// site coordinates.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="date1">TDB as a 2-part...</param>
        /// <param name="date2">...Julian Date (Note 1)</param>
        /// <param name="ebpv">Earth barycentric PV (au, au/day, Note 2)</param>
        /// <param name="ehp">Earth heliocentric P (au, Note 2)</param>
        /// <param name="x">CIP X,Y (components of unit vector)</param>
        /// <param name="y">CIP X,Y (components of unit vector)</param>
        /// <param name="s">the CIO locator s (radians)</param>
        /// <param name="theta">Earth rotation angle (radians)</param>
        /// <param name="elong">longitude (radians, east +ve, Note 3)</param>
        /// <param name="phi">latitude (geodetic, radians, Note 3)</param>
        /// <param name="hm">height above ellipsoid (m, geodetic, Note 3)</param>
        /// <param name="xp">polar motion coordinates (radians, Note 4)</param>
        /// <param name="yp">polar motion coordinates (radians, Note 4)</param>
        /// <param name="sp">the TIO locator s' (radians, Note 4)</param>
        /// <param name="refa">refraction constant A (radians, Note 5)</param>
        /// <param name="refb">refraction constant B (radians, Note 5)</param>
        /// <param name="astrom">star-independent astrometry parameters</param>
        public static void wwaApco(double date1, double date2, double[,] ebpv, double[] ehp, double x, double y, double s, double theta,
                                   double elong, double phi, double hm, double xp, double yp, double sp, double refa, double refb, ref wwaASTROM astrom)
        {
            double sl, cl, a, b, eral, c;

            double[,] r   = new double[3, 3];
            double[,] pvc = new double[2, 3] {
                { 0, 0, 0 }, { 0, 0, 0 }
            };
            double[,] pv = new double[2, 3] {
                { 0, 0, 0 }, { 0, 0, 0 }
            };

            /* Form the rotation matrix, CIRS to apparent [HA,Dec]. */
            wwaIr(r);
            wwaRz(theta + sp, r);
            wwaRy(-xp, r);
            wwaRx(-yp, r);
            wwaRz(elong, r);

            /* Solve for local Earth rotation angle. */
            a           = r[0, 0];
            b           = r[0, 1];
            eral        = (a != 0.0 || b != 0.0) ? Math.Atan2(b, a) : 0.0;
            astrom.eral = eral;

            /* Solve for polar motion [X,Y] with respect to local meridian. */
            a          = r[0, 0];
            c          = r[0, 2];
            astrom.xpl = Math.Atan2(c, Math.Sqrt(a * a + b * b));
            a          = r[1, 2];
            b          = r[2, 2];
            astrom.ypl = (a != 0.0 || b != 0.0) ? -Math.Atan2(a, b) : 0.0;

            /* Adjusted longitude. */
            astrom.along = wwaAnpm(eral - theta);

            /* Functions of latitude. */
            astrom.sphi = Math.Sin(phi);
            astrom.cphi = Math.Cos(phi);

            /* Refraction constants. */
            astrom.refa = refa;
            astrom.refb = refb;

            /* Disable the (redundant) diurnal aberration step. */
            astrom.diurab = 0.0;

            /* CIO based BPN matrix. */
            wwaC2ixys(x, y, s, r);

            /* Observer's geocentric position and velocity (m, m/s, CIRS). */
            wwaPvtob(elong, phi, hm, xp, yp, sp, theta, pvc);

            /* Rotate into GCRS. */
            wwaTrxpv(r, pvc, pv);

            /* ICRS <-> GCRS parameters. */
            wwaApcs(date1, date2, pv, ebpv, ehp, ref astrom);

            /* Store the CIO based BPN matrix. */
            wwaCr(r, astrom.bpn);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Quick CIRS to ICRS astrometric place transformation, given the star-
        /// independent astrometry parameters plus a list of light-deflecting bodies.
        ///
        /// Use of this function is appropriate when efficiency is important and
        /// where many star positions are all to be transformed for one date.
        /// The star-independent astrometry parameters can be obtained by
        /// calling one of the functions iauApci[13], iauApcg[13], wwaApco[13]
        /// or wwaApcs[13].
        ///
        /// If the only light-deflecting body to be taken into account is the
        /// Sun, the wwaAticq function can be used instead.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="ri">CIRS RA,Dec (radians)</param>
        /// <param name="di">CIRS RA,Dec (radians)</param>
        /// <param name="astrom">star-independent astrometry parameters:</param>
        /// <param name="n">number of bodies (Note 3)</param>
        /// <param name="b">data for each of the n bodies (Notes 3,4):</param>
        /// <param name="rc">ICRS astrometric RA,Dec (radians)</param>
        /// <param name="dc">ICRS astrometric RA,Dec (radians)</param>
        public static void wwaAticqn(double ri, double di, ref wwaASTROM astrom, int n, wwaLDBODY[] b, ref double rc, ref double dc)
        {
            int j, i;

            double[] pi = new double[3] {
                0, 0, 0
            };
            double[] ppr = new double[3] {
                0, 0, 0
            };
            double[] pnat = new double[3] {
                0, 0, 0
            };
            double[] pco = new double[3] {
                0, 0, 0
            };
            double[] d = new double[3] {
                0, 0, 0
            };
            double[] before = new double[3] {
                0, 0, 0
            };
            double[] after = new double[3] {
                0, 0, 0
            };
            double r2, r, w = 0;

            /* CIRS RA,Dec to Cartesian. */
            wwaS2c(ri, di, pi);

            /* Bias-precession-nutation, giving GCRS proper direction. */
            wwaTrxp(astrom.bpn, pi, ppr);

            /* Aberration, giving GCRS natural direction. */
            wwaZp(d);
            for (j = 0; j < 2; j++)
            {
                r2 = 0.0;
                for (i = 0; i < 3; i++)
                {
                    w         = ppr[i] - d[i];
                    before[i] = w;
                    r2       += w * w;
                }
                r = Math.Sqrt(r2);
                for (i = 0; i < 3; i++)
                {
                    before[i] /= r;
                }
                wwaAb(before, astrom.v, astrom.em, astrom.bm1, ref after);
                r2 = 0.0;
                for (i = 0; i < 3; i++)
                {
                    d[i]    = after[i] - before[i];
                    w       = ppr[i] - d[i];
                    pnat[i] = w;
                    r2     += w * w;
                }
                r = Math.Sqrt(r2);
                for (i = 0; i < 3; i++)
                {
                    pnat[i] /= r;
                }
            }

            /* Light deflection, giving BCRS coordinate direction. */
            wwaZp(d);
            for (j = 0; j < 5; j++)
            {
                r2 = 0.0;
                for (i = 0; i < 3; i++)
                {
                    w         = pnat[i] - d[i];
                    before[i] = w;
                    r2       += w * w;
                }
                r = Math.Sqrt(r2);
                for (i = 0; i < 3; i++)
                {
                    before[i] /= r;
                }
                wwaLdn(n, b, astrom.eb, before, after);
                r2 = 0.0;
                for (i = 0; i < 3; i++)
                {
                    d[i]   = after[i] - before[i];
                    w      = pnat[i] - d[i];
                    pco[i] = w;
                    r2    += w * w;
                }
                r = Math.Sqrt(r2);
                for (i = 0; i < 3; i++)
                {
                    pco[i] /= r;
                }
            }

            /* ICRS astrometric RA,Dec. */
            wwaC2s(pco, ref w, ref dc);
            rc = wwaAnp(w);
        }
Exemplo n.º 14
0
        /// <summary>
        /// For a terrestrial observer, prepare star-independent astrometry
        /// parameters for transformations between CIRS and observed
        /// coordinates.  The caller supplies the Earth orientation information
        /// and the refraction constants as well as the site coordinates.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="sp">the TIO locator s' (radians, Note 1)</param>
        /// <param name="theta">Earth rotation angle (radians)</param>
        /// <param name="elong">longitude (radians, east +ve, Note 2)</param>
        /// <param name="phi">geodetic latitude (radians, Note 2)</param>
        /// <param name="hm">height above ellipsoid (m, geodetic Note 2)</param>
        /// <param name="xp">polar motion coordinates (radians, Note 3)</param>
        /// <param name="yp">polar motion coordinates (radians, Note 3)</param>
        /// <param name="refa">refraction constant A (radians, Note 4)</param>
        /// <param name="refb">refraction constant B (radians, Note 4)</param>
        /// <param name="astrom">star-independent astrometry parameters:</param>
        public static void wwaApio(double sp, double theta, double elong, double phi, double hm, double xp, double yp, double refa, double refb, ref wwaASTROM astrom)
        {
            double sl, cl;

            double[,] pv = new double[2, 3];

            /* Longitude with adjustment for TIO locator s'. */
            astrom.along = elong + sp;

            /* Polar motion, rotated onto the local meridian. */
            sl         = Math.Sin(astrom.along);
            cl         = Math.Cos(astrom.along);
            astrom.xpl = xp * cl - yp * sl;
            astrom.ypl = xp * sl + yp * cl;

            /* Functions of latitude. */
            astrom.sphi = Math.Sin(phi);
            astrom.cphi = Math.Cos(phi);

            /* Observer's geocentric position and velocity (m, m/s, CIRS). */
            wwaPvtob(elong, phi, hm, xp, yp, sp, theta, pv);

            /* Magnitude of diurnal aberration vector. */
            astrom.diurab = Math.Sqrt(pv[1, 0] * pv[1, 0] + pv[1, 1] * pv[1, 1]) / CMPS;

            /* Refraction constants. */
            astrom.refa = refa;
            astrom.refb = refb;

            /* Local Earth rotation angle. */
            wwaAper(theta, ref astrom);
        }
Exemplo n.º 15
0
        /// <summary>
        /// For a terrestrial observer, prepare star-independent astrometry
        /// parameters for transformations between ICRS and observed
        /// coordinates.  The caller supplies the Earth ephemeris, the Earth
        /// rotation information and the refraction constants as well as the
        /// site coordinates.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="date1">TDB as a 2-part...</param>
        /// <param name="date2">...Julian Date (Note 1)</param>
        /// <param name="ebpv">Earth barycentric PV (au, au/day, Note 2)</param>
        /// <param name="ehp">Earth heliocentric P (au, Note 2)</param>
        /// <param name="x">CIP X,Y (components of unit vector)</param>
        /// <param name="y">CIP X,Y (components of unit vector)</param>
        /// <param name="s">the CIO locator s (radians)</param>
        /// <param name="theta">Earth rotation angle (radians)</param>
        /// <param name="elong">longitude (radians, east +ve, Note 3)</param>
        /// <param name="phi">latitude (geodetic, radians, Note 3)</param>
        /// <param name="hm">height above ellipsoid (m, geodetic, Note 3)</param>
        /// <param name="xp">polar motion coordinates (radians, Note 4)</param>
        /// <param name="yp">polar motion coordinates (radians, Note 4)</param>
        /// <param name="sp">the TIO locator s' (radians, Note 4)</param>
        /// <param name="refa">refraction constant A (radians, Note 5)</param>
        /// <param name="refb">refraction constant B (radians, Note 5)</param>
        /// <param name="astrom">star-independent astrometry parameters</param>
        public static void wwaApco(double date1, double date2, double[,] ebpv, double[] ehp, double x, double y, double s, double theta,
                                   double elong, double phi, double hm, double xp, double yp, double sp, double refa, double refb, ref wwaASTROM astrom)
        {
            double sl, cl;

            double [,] r  = new double[3, 3];
            double[,] pvc = new double[2, 3] {
                { 0, 0, 0 }, { 0, 0, 0 }
            };
            double[,] pv = new double[2, 3] {
                { 0, 0, 0 }, { 0, 0, 0 }
            };

            /* Longitude with adjustment for TIO locator s'. */
            astrom.along = elong + sp;

            /* Polar motion, rotated onto the local meridian. */
            sl         = Math.Sin(astrom.along);
            cl         = Math.Cos(astrom.along);
            astrom.xpl = xp * cl - yp * sl;
            astrom.ypl = xp * sl + yp * cl;

            /* Functions of latitude. */
            astrom.sphi = Math.Sin(phi);
            astrom.cphi = Math.Cos(phi);

            /* Refraction constants. */
            astrom.refa = refa;
            astrom.refb = refb;

            /* Local Earth rotation angle. */
            wwaAper(theta, ref astrom);

            /* Disable the (redundant) diurnal aberration step. */
            astrom.diurab = 0.0;

            /* CIO based BPN matrix. */
            wwaC2ixys(x, y, s, r);

            /* Observer's geocentric position and velocity (m, m/s, CIRS). */
            wwaPvtob(elong, phi, hm, xp, yp, sp, theta, pvc);

            /* Rotate into GCRS. */
            wwaTrxpv(r, pvc, pv);

            /* ICRS <-> GCRS parameters. */
            wwaApcs(date1, date2, pv, ebpv, ehp, ref astrom);

            /* Store the CIO based BPN matrix. */
            wwaCr(r, astrom.bpn);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Quick observed place to CIRS, given the star-independent astrometry parameters.
        ///
        /// Use of this function is appropriate when efficiency is important and
        /// where many star positions are all to be transformed for one date.
        /// The star-independent astrometry parameters can be obtained by
        /// calling wwaApio[13] or wwaApco[13].
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="type">type of coordinates: "R", "H" or "A" (Note 1)</param>
        /// <param name="ob1">observed Az, HA or RA (radians; Az is N=0,E=90)</param>
        /// <param name="ob2">observed ZD or Dec (radians)</param>
        /// <param name="astrom">star-independent astrometry parameters:</param>
        /// <param name="ri">CIRS right ascension (CIO-based, radians)</param>
        /// <param name="di">CIRS declination (radians)</param>
        public static void wwaAtoiq(ref char type, double ob1, double ob2, ref wwaASTROM astrom, ref double ri, ref double di)
        {
            /* Minimum sin(alt) for refraction purposes */
            const double SELMIN = 0.05;

            int    c;
            double c1, c2, sphi, cphi, ce, xaeo, yaeo, zaeo, xmhdo, ymhdo, zmhdo, az, sz, zdo, refa, refb,
                   tz, dref, zdt, xaet, yaet, zaet, xmhda, ymhda, zmhda, f, xhd, yhd, zhd, sx, cx, sy, cy, hma = 0;

            double[] v = new double[3];

            /* Coordinate type. */
            c = (int)type;

            /* Coordinates. */
            c1 = ob1;
            c2 = ob2;

            /* Sin, cos of latitude. */
            sphi = astrom.sphi;
            cphi = astrom.cphi;

            /* Standardize coordinate type. */
            if (c == 'r' || c == 'R')
            {
                c = 'R';
            }
            else if (c == 'h' || c == 'H')
            {
                c = 'H';
            }
            else
            {
                c = 'A';
            }

            /* If Az,ZD, convert to Cartesian (S=0,E=90). */
            if (c == 'A')
            {
                ce   = Math.Sin(c2);
                xaeo = -Math.Cos(c1) * ce;
                yaeo = Math.Sin(c1) * ce;
                zaeo = Math.Cos(c2);
            }
            else
            {
                /* If RA,Dec, convert to HA,Dec. */
                if (c == 'R')
                {
                    c1 = astrom.eral - c1;
                }

                /* To Cartesian -HA,Dec. */
                wwaS2c(-c1, c2, v);
                xmhdo = v[0];
                ymhdo = v[1];
                zmhdo = v[2];

                /* To Cartesian Az,El (S=0,E=90). */
                xaeo = sphi * xmhdo - cphi * zmhdo;
                yaeo = ymhdo;
                zaeo = cphi * xmhdo + sphi * zmhdo;
            }

            /* Azimuth (S=0,E=90). */
            az = (xaeo != 0.0 || yaeo != 0.0) ? Math.Atan2(yaeo, xaeo) : 0.0;

            /* Sine of observed ZD, and observed ZD. */
            sz  = Math.Sqrt(xaeo * xaeo + yaeo * yaeo);
            zdo = Math.Atan2(sz, zaeo);

            /*
            ** Refraction
            ** ----------
            */

            /* Fast algorithm using two constant model. */
            refa = astrom.refa;
            refb = astrom.refb;
            tz   = sz / (zaeo > SELMIN ? zaeo : SELMIN);
            dref = (refa + refb * tz * tz) * tz;
            zdt  = zdo + dref;

            /* To Cartesian Az,ZD. */
            ce   = Math.Sin(zdt);
            xaet = Math.Cos(az) * ce;
            yaet = Math.Sin(az) * ce;
            zaet = Math.Cos(zdt);

            /* Cartesian Az,ZD to Cartesian -HA,Dec. */
            xmhda = sphi * xaet + cphi * zaet;
            ymhda = yaet;
            zmhda = -cphi * xaet + sphi * zaet;

            /* Diurnal aberration. */
            f   = (1.0 + astrom.diurab * ymhda);
            xhd = f * xmhda;
            yhd = f * (ymhda - astrom.diurab);
            zhd = f * zmhda;

            /* Polar motion. */
            sx   = Math.Sin(astrom.xpl);
            cx   = Math.Cos(astrom.xpl);
            sy   = Math.Sin(astrom.ypl);
            cy   = Math.Cos(astrom.ypl);
            v[0] = cx * xhd + sx * sy * yhd - sx * cy * zhd;
            v[1] = cy * yhd + sy * zhd;
            v[2] = sx * xhd - cx * sy * yhd + cx * cy * zhd;

            /* To spherical -HA,Dec. */
            wwaC2s(v, ref hma, ref di);

            /* Right ascension. */
            ri = wwaAnp(astrom.eral + hma);
        }
Exemplo n.º 17
0
        /// <summary>
        /// For an observer whose geocentric position and velocity are known,
        /// prepare star-independent astrometry parameters for transformations
        /// between ICRS and GCRS.  The Earth ephemeris is supplied by the caller.
        ///
        /// The parameters produced by this function are required in the space
        /// motion, parallax, light deflection and aberration parts of the
        /// astrometric transformation chain.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="date1">TDB as a 2-part...</param>
        /// <param name="date2">...Julian Date (Note 1)</param>
        /// <param name="pv">observer's geocentric pos/vel (m, m/s)</param>
        /// <param name="ebpv">Earth barycentric PV (au, au/day)</param>
        /// <param name="ehp">Earth heliocentric P (au)</param>
        /// <param name="astrom">star-independent astrometry parameters</param>
        public static void wwaApcs(double date1, double date2, double[,] pv, double[,] ebpv, double[] ehp, ref wwaASTROM astrom)
        {
            /* au/d to m/s */
            const double AUDMS = DAU / DAYSEC;

            /* Light time for 1 AU (day) */
            const double CR = AULT / DAYSEC;

            int    i;
            double dp, dv, v2, w;

            double[] pb = new double[3];
            double[] vb = new double[3];
            double[] ph = new double[3];

            /* Time since reference epoch, years (for proper motion calculation). */
            astrom.pmt = ((date1 - DJ00) + date2) / DJY;

            /* Adjust Earth ephemeris to observer. */
            for (i = 0; i < 3; i++)
            {
                dp    = pv[0, i] / DAU;
                dv    = pv[1, i] / AUDMS;
                pb[i] = ebpv[0, i] + dp;
                vb[i] = ebpv[1, i] + dv;
                ph[i] = ehp[i] + dp;
            }

            /* Barycentric position of observer (au). */
            wwaCp(pb, astrom.eb);

            /* Heliocentric direction and distance (unit vector and au). */
            wwaPn(ph, ref astrom.em, astrom.eh);

            /* Barycentric vel. in units of c, and reciprocal of Lorenz factor. */
            v2 = 0.0;

            if (astrom.v == null)
            {
                astrom.v = new double[3];
            }

            for (i = 0; i < 3; i++)
            {
                w           = vb[i] * CR;
                astrom.v[i] = w;
                v2         += w * w;
            }
            astrom.bm1 = Math.Sqrt(1.0 - v2);

            /* Reset the NPB matrix. */
            wwaIr(astrom.bpn);
        }
Exemplo n.º 18
0
        /// <summary>
        /// For a terrestrial observer, prepare star-independent astrometry
        /// parameters for transformations between ICRS and geocentric CIRS
        /// coordinates.  The Earth ephemeris and CIP/CIO are supplied by the
        /// caller.
        ///
        /// The parameters produced by this function are required in the
        /// parallax, light deflection, aberration, and bias-precession-nutation
        /// parts of the astrometric transformation chain.
        /// </summary>
        ///
        /// /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="date1">TDB as a 2-part...</param>
        /// <param name="date2">...Julian Date (Note 1)</param>
        /// <param name="ebpv">Earth barycentric position/velocity (au, au/day)</param>
        /// <param name="ehp">Earth heliocentric position (au)</param>
        /// <param name="x">CIP X,Y (components of unit vector)</param>
        /// <param name="y">CIP X,Y (components of unit vector)</param>
        /// <param name="s"></param>
        /// <param name="astrom">the CIO locator s (radians)</param>
        public static void wwaApci(double date1, double date2, double[,] ebpv, double[] ehp, double x, double y, double s, ref wwaASTROM astrom)
        {
            /* Star-independent astrometry parameters for geocenter. */
            wwaApcg(date1, date2, ebpv, ehp, ref astrom);

            /* CIO based BPN matrix. */
            wwaC2ixys(x, y, s, astrom.bpn);
        }
Exemplo n.º 19
0
Arquivo: apio.cs Projeto: abrudana/wwa
        /// <summary>
        /// For a terrestrial observer, prepare star-independent astrometry
        /// parameters for transformations between CIRS and observed
        /// coordinates.  The caller supplies the Earth orientation information
        /// and the refraction constants as well as the site coordinates.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="sp">the TIO locator s' (radians, Note 1)</param>
        /// <param name="theta">Earth rotation angle (radians)</param>
        /// <param name="elong">longitude (radians, east +ve, Note 2)</param>
        /// <param name="phi">geodetic latitude (radians, Note 2)</param>
        /// <param name="hm">height above ellipsoid (m, geodetic Note 2)</param>
        /// <param name="xp">polar motion coordinates (radians, Note 3)</param>
        /// <param name="yp">polar motion coordinates (radians, Note 3)</param>
        /// <param name="refa">refraction constant A (radians, Note 4)</param>
        /// <param name="refb">refraction constant B (radians, Note 4)</param>
        /// <param name="astrom">star-independent astrometry parameters:</param>
        public static void wwaApio(double sp, double theta, double elong, double phi, double hm, double xp, double yp, double refa, double refb, ref wwaASTROM astrom)
        {
            double[,] r = new double[3, 3];
            double a, b, eral, c;

            double[,] pv = new double[2, 3];


            /* Form the rotation matrix, CIRS to apparent [HA,Dec]. */
            wwaIr(r);
            wwaRz(theta + sp, r);
            wwaRy(-xp, r);
            wwaRx(-yp, r);
            wwaRz(elong, r);

            /* Solve for local Earth rotation angle. */
            a           = r[0, 0];
            b           = r[0, 1];
            eral        = (a != 0.0 || b != 0.0) ? Math.Atan2(b, a) : 0.0;
            astrom.eral = eral;

            /* Solve for polar motion [X,Y] with respect to local meridian. */
            a          = r[0, 0];
            c          = r[0, 2];
            astrom.xpl = Math.Atan2(c, Math.Sqrt(a * a + b * b));
            a          = r[1, 2];
            b          = r[2, 2];
            astrom.ypl = (a != 0.0 || b != 0.0) ? -Math.Atan2(a, b) : 0.0;

            /* Adjusted longitude. */
            astrom.along = wwaAnpm(eral - theta);

            /* Functions of latitude. */
            astrom.sphi = Math.Sin(phi);
            astrom.cphi = Math.Cos(phi);

            /* Observer's geocentric position and velocity (m, m/s, CIRS). */
            wwaPvtob(elong, phi, hm, xp, yp, sp, theta, pv);

            /* Magnitude of diurnal aberration vector. */
            astrom.diurab = Math.Sqrt(pv[1, 0] * pv[1, 0] + pv[1, 1] * pv[1, 1]) / CMPS;

            /* Refraction constants. */
            astrom.refa = refa;
            astrom.refb = refb;
        }
Exemplo n.º 20
0
 /// <summary>
 /// In the star-independent astrometry parameters, update only the
 /// Earth rotation angle, supplied by the caller explicitly.
 /// </summary>
 ///
 /// <remarks>
 /// World Wide Astronomy - WWA
 /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
 ///
 /// This program is derived from the International Astronomical Union's
 /// SOFA (Standards of Fundamental Astronomy) software collection.
 /// http://www.iausofa.org
 ///
 /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
 /// This version is intended to retain identical functionality to the SOFA library, but
 /// made distinct through different function names (prefixes) and C# language specific
 /// modifications in code.
 ///
 /// Contributor
 /// Attila Abrudán
 ///
 /// Please read the ReadMe.1st text file for more information.
 /// </remarks>
 /// <param name="theta">Earth rotation angle (radians, Note 2)</param>
 /// <param name="astrom">star-independent astrometry parameters:</param>
 public static void wwaAper(double theta, ref wwaASTROM astrom)
 {
     astrom.eral = theta + astrom.along;
 }
Exemplo n.º 21
0
 /// <summary>
 /// In the star-independent astrometry parameters, update only the
 /// Earth rotation angle.  The caller provides UT1, (n.b. not UTC).
 /// </summary>
 ///
 /// <remarks>
 /// World Wide Astronomy - WWA
 /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
 ///
 /// This program is derived from the International Astronomical Union's
 /// SOFA (Standards of Fundamental Astronomy) software collection.
 /// http://www.iausofa.org
 ///
 /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
 /// This version is intended to retain identical functionality to the SOFA library, but
 /// made distinct through different function names (prefixes) and C# language specific
 /// modifications in code.
 ///
 /// Contributor
 /// Attila Abrudán
 ///
 /// Please read the ReadMe.1st text file for more information.
 /// </remarks>
 /// <param name="ut11">UT1 as a 2-part...</param>
 /// <param name="ut12">...Julian Date (Note 1)</param>
 /// <param name="astrom">star-independent astrometry parameters</param>
 public static void wwaAper13(double ut11, double ut12, ref wwaASTROM astrom)
 {
     wwaAper(wwaEra00(ut11, ut12), ref astrom);
 }
Exemplo n.º 22
0
        /// <summary>
        /// Quick ICRS, epoch J2000.0, to CIRS transformation, given precomputed
        /// star-independent astrometry parameters plus a list of light-
        /// deflecting bodies.
        ///
        /// Use of this function is appropriate when efficiency is important and
        /// where many star positions are to be transformed for one date.  The
        /// star-independent parameters can be obtained by calling one of the
        /// functions iauApci[13], iauApcg[13], wwaApco[13] or wwaApcs[13].
        ///
        /// If the only light-deflecting body to be taken into account is the
        /// Sun, the wwaAtciq function can be used instead.  If in addition the
        /// parallax and proper motions are zero, the wwaAtciqz function can be used.
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="rc">ICRS RA,Dec at J2000.0 (radians)</param>
        /// <param name="dc">ICRS RA,Dec at J2000.0 (radians)</param>
        /// <param name="pr">RA proper motion (radians/year; Note 3)</param>
        /// <param name="pd">Dec proper motion (radians/year)</param>
        /// <param name="px">parallax (arcsec)</param>
        /// <param name="rv">radial velocity (km/s, +ve if receding)</param>
        /// <param name="astrom">star-independent astrometry parameters:</param>
        /// <param name="n">number of bodies (Note 3)</param>
        /// <param name="b">data for each of the n bodies (Notes 3,4):</param>
        /// <param name="ri">CIRS RA,Dec (radians)</param>
        /// <param name="di">CIRS RA,Dec (radians)</param>
        public static void wwaAtciqn(double rc, double dc, double pr, double pd, double px, double rv, ref wwaASTROM astrom, int n, wwaLDBODY[] b, ref double ri, ref double di)
        {
            double[] pco = new double[3] {
                0, 0, 0
            };
            double[] pnat = new double[3] {
                0, 0, 0
            };
            double[] ppr = new double[3] {
                0, 0, 0
            };
            double[] pi = new double[3];
            double   w  = 0;

            /* Proper motion and parallax, giving BCRS coordinate direction. */
            wwaPmpx(rc, dc, pr, pd, px, rv, astrom.pmt, astrom.eb, pco);

            /* Light deflection, giving BCRS natural direction. */
            wwaLdn(n, b, astrom.eb, pco, pnat);

            /* Aberration, giving GCRS proper direction. */
            wwaAb(pnat, astrom.v, astrom.em, astrom.bm1, ref ppr);

            /* Bias-precession-nutation, giving CIRS proper direction. */
            wwaRxp(astrom.bpn, ppr, pi);

            /* CIRS RA,Dec. */
            wwaC2s(pi, ref w, ref di);
            ri = wwaAnp(w);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Quick CIRS to observed place transformation.
        ///
        /// Use of this function is appropriate when efficiency is important and
        /// where many star positions are all to be transformed for one date.
        /// The star-independent astrometry parameters can be obtained by
        /// calling wwaApio[13] or wwaApco[13].
        /// </summary>
        ///
        /// <remarks>
        /// World Wide Astronomy - WWA
        /// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
        ///
        /// This program is derived from the International Astronomical Union's
        /// SOFA (Standards of Fundamental Astronomy) software collection.
        /// http://www.iausofa.org
        ///
        /// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
        /// This version is intended to retain identical functionality to the SOFA library, but
        /// made distinct through different function names (prefixes) and C# language specific
        /// modifications in code.
        ///
        /// Contributor
        /// Attila Abrudán
        ///
        /// Please read the ReadMe.1st text file for more information.
        /// </remarks>
        /// <param name="ri">CIRS right ascension</param>
        /// <param name="di">CIRS declination</param>
        /// <param name="astrom">star-independent astrometry parameters:</param>
        /// <param name="aob">observed azimuth (radians: N=0,E=90)</param>
        /// <param name="zob">observed zenith distance (radians)</param>
        /// <param name="hob">observed hour angle (radians)</param>
        /// <param name="dob">observed declination (radians)</param>
        /// <param name="rob">observed right ascension (CIO-based, radians)</param>
        public static void wwaAtioq(double ri, double di, ref wwaASTROM astrom, ref double aob, ref double zob, ref double hob, ref double dob, ref double rob)
        {
            /* Minimum cos(alt) and sin(alt) for refraction purposes */
            const double CELMIN = 1e-6;
            const double SELMIN = 0.05;

            double[] v = new double[3];
            double   x, y, z, xhd, yhd, zhd, f, xhdt, yhdt, zhdt, xaet, yaet, zaet, azobs, r, tz, w, del, cosdel, xaeo, yaeo, zaeo, zdobs, hmobs = 0, dcobs = 0, raobs;

            /* CIRS RA,Dec to Cartesian -HA,Dec. */
            wwaS2c(ri - astrom.eral, di, v);
            x = v[0];
            y = v[1];
            z = v[2];

            /* Polar motion. */
            xhd = x + astrom.xpl * z;
            yhd = y - astrom.ypl * z;
            zhd = z - astrom.xpl * x + astrom.ypl * y;

            /* Diurnal aberration. */
            f    = (1.0 - astrom.diurab * yhd);
            xhdt = f * xhd;
            yhdt = f * (yhd + astrom.diurab);
            zhdt = f * zhd;

            /* Cartesian -HA,Dec to Cartesian Az,El (S=0,E=90). */
            xaet = astrom.sphi * xhdt - astrom.cphi * zhdt;
            yaet = yhdt;
            zaet = astrom.cphi * xhdt + astrom.sphi * zhdt;

            /* Azimuth (N=0,E=90). */
            azobs = (xaet != 0.0 || yaet != 0.0) ? Math.Atan2(yaet, -xaet) : 0.0;

            /* ---------- */
            /* Refraction */
            /* ---------- */

            /* Cosine and sine of altitude, with precautions. */
            r = Math.Sqrt(xaet * xaet + yaet * yaet);
            r = r > CELMIN ? r : CELMIN;
            z = zaet > SELMIN ? zaet : SELMIN;

            /* A*tan(z)+B*tan^3(z) model, with Newton-Raphson correction. */
            tz  = r / z;
            w   = astrom.refb * tz * tz;
            del = (astrom.refa + w) * tz / (1.0 + (astrom.refa + 3.0 * w) / (z * z));

            /* Apply the change, giving observed vector. */
            cosdel = 1.0 - del * del / 2.0;
            f      = cosdel - del * z / r;
            xaeo   = xaet * f;
            yaeo   = yaet * f;
            zaeo   = cosdel * zaet + del * r;

            /* Observed ZD. */
            zdobs = Math.Atan2(Math.Sqrt(xaeo * xaeo + yaeo * yaeo), zaeo);

            /* Az/El vector to HA,Dec vector (both right-handed). */
            v[0] = astrom.sphi * xaeo + astrom.cphi * zaeo;
            v[1] = yaeo;
            v[2] = -astrom.cphi * xaeo + astrom.sphi * zaeo;

            /* To spherical -HA,Dec. */
            wwaC2s(v, ref hmobs, ref dcobs);

            /* Right ascension (with respect to CIO). */
            raobs = astrom.eral + hmobs;

            /* Return the results. */
            aob = wwaAnp(azobs);
            zob = zdobs;
            hob = -hmobs;
            dob = dcobs;
            rob = wwaAnp(raobs);
        }