Class Astronomy


  • public class Astronomy
    extends java.lang.Object
    Astronomical Calculations
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Astronomy.Coor
      set of variables for sun calculations
      static class  Astronomy.Riseset
      set of variables for sunrise calculations
      static class  Astronomy.Time
      time calculations
    • Constructor Summary

      Constructors 
      Constructor Description
      Astronomy()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double calcJD​(int day, int month, int year)  
      static Astronomy.Coor ecl2Equ​(Astronomy.Coor coor, double TDT)
      Transform ecliptical coordinates (lon/lat) to equatorial coordinates (RA/dec)
      static Astronomy.Coor equ2Altaz​(Astronomy.Coor coor, double TDT, double geolat, double lmst)
      Transform equatorial coordinates (RA/Dec) to horizonal coordinates (azimuth/altitude) Refraction is ignored
      static Astronomy.Coor equPolar2Cart​(double lon, double lat, double distance)
      Calculate cartesian from polar coordinates
      static double frac​(double x)  
      static Astronomy.Coor geoEqu2TopoEqu​(Astronomy.Coor coor, Astronomy.Coor observer, double lmst)
      Transform geocentric equatorial coordinates (RA/Dec) to topocentric equatorial coordinates
      static double gMST​(double JD)  
      static double gMST2LMST​(double gmst, double lon)  
      static double gMST2UT​(double JD, double gmst)  
      static int Int​(double x)  
      static double mod​(double a, double b)  
      static double mod2Pi​(double x)  
      static Astronomy.Coor moonPosition​(Astronomy.Coor sunCoor, double TDT)
      Calculate data and coordinates for the Moon Coordinates are accurate to about 1/5 degree (in ecliptic coordinates)
      static Astronomy.Coor moonPosition​(Astronomy.Coor sunCoor, double TDT, Astronomy.Coor observer, double lmst)  
      static Astronomy.Riseset moonRise​(double JD, double deltaT, double lon, double lat, double zone, boolean recursive)
      Find local time of moonrise and moonset JD is the Julian Date of 0h local time (midnight) Accurate to about 5 minutes or better recursive: 1 - calculate rise/set in UTC recursive: 0 - find rise/set on the current local day (set could also be first) returns 0.000000000 for moonrise/set does not occur on selected day
      static Astronomy.Coor observer2EquCart​(double lon, double lat, double height, double gmst)
      Calculate observers cartesian equatorial coordinates (x,y,z in celestial frame) from geodetic coordinates (longitude, latitude, height above WGS84 ellipsoid) Currently only used to calculate distance of a body from the observer
      static double refraction​(double alt)
      Rough refraction formula using standard atmosphere: 1015 mbar and 10°C Input true altitude in radians, Output: increase in altitude in degrees
      static double round10​(double x)  
      static double round100​(double x)  
      static double round1000​(double x)  
      static double round10000​(double x)  
      static double round100000​(double x)  
      static double round1000000​(double x)  
      static java.lang.String sign​(double lon)  
      static double sqr​(double x)  
      static Astronomy.Coor sunPosition​(double TDT)
      Calculate coordinates for Sun Coordinates are accurate to about 10s (right ascension) and a few minutes of arc (declination)
      static Astronomy.Coor sunPosition​(double TDT, double geolat, double lmst)  
      static Astronomy.Riseset sunRise​(double JD, double deltaT, double lon, double lat, double zone, boolean recursive)
      Find (local) time of sunrise and sunset, and twilights JD is the Julian Date of 0h local time (midnight) Accurate to about 1-2 minutes recursive: 1 - calculate rise/set in UTC in a second run recursive: 0 - find rise/set on the current local day.
      static java.lang.String timeHHMM​(double hh)  
      static java.lang.String timeHHMMdec​(double hh)  
      static java.lang.String timeHHMMSS​(double hh)  
      static java.lang.String timeHHMMSSdec​(double hh)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Astronomy

        public Astronomy()
    • Method Detail

      • Int

        public static int Int​(double x)
      • sqr

        public static double sqr​(double x)
      • frac

        public static double frac​(double x)
      • mod

        public static double mod​(double a,
                                 double b)
      • mod2Pi

        public static double mod2Pi​(double x)
      • round1000000

        public static double round1000000​(double x)
      • round100000

        public static double round100000​(double x)
      • round10000

        public static double round10000​(double x)
      • round1000

        public static double round1000​(double x)
      • round100

        public static double round100​(double x)
      • round10

        public static double round10​(double x)
      • timeHHMMSS

        public static java.lang.String timeHHMMSS​(double hh)
        Parameters:
        hh - Decimal Time
        Returns:
        a String of decimal Time HH:MM:SS
      • timeHHMMSSdec

        public static java.lang.String timeHHMMSSdec​(double hh)
        Parameters:
        hh - Decimal Time
        Returns:
        a String of decimal Time HH:MM:SS = Decimal Time
      • timeHHMMdec

        public static java.lang.String timeHHMMdec​(double hh)
        Parameters:
        hh - Decimal Time
        Returns:
        a String of decimal Time HH:MM = Decimal Time
      • timeHHMM

        public static java.lang.String timeHHMM​(double hh)
        Parameters:
        hh - Decimal Time
        Returns:
        a String of decimal Time HH:MM
      • sign

        public static java.lang.String sign​(double lon)
        Parameters:
        lon - geographical longitude in degree
        Returns:
        the name String of a sign
      • calcJD

        public static double calcJD​(int day,
                                    int month,
                                    int year)
        Parameters:
        day -
        month -
        year -
        Returns:
        Julian date: valid only from 1.3.1901 to 28.2.2100
      • gMST

        public static double gMST​(double JD)
        Parameters:
        JD - Julian Date
        Returns:
        Julian Date converted to Greenwich Mean Sidereal Time
      • gMST2UT

        public static double gMST2UT​(double JD,
                                     double gmst)
        Parameters:
        JD - Julian Date
        gmst - Greenwich mean sidereal
        Returns:
        convert Greenweek mean sidereal time to UT
      • gMST2LMST

        public static double gMST2LMST​(double gmst,
                                       double lon)
        Parameters:
        gmst - Greenwich mean sidereal
        lon - geographical longitude in radians, East is positive
        Returns:
        Local Mean Sidereal Time
      • ecl2Equ

        public static Astronomy.Coor ecl2Equ​(Astronomy.Coor coor,
                                             double TDT)
        Transform ecliptical coordinates (lon/lat) to equatorial coordinates (RA/dec)
        Parameters:
        coor -
        TDT -
        Returns:
        equatorial coordinate (RA/dec)
      • equ2Altaz

        public static Astronomy.Coor equ2Altaz​(Astronomy.Coor coor,
                                               double TDT,
                                               double geolat,
                                               double lmst)
        Transform equatorial coordinates (RA/Dec) to horizonal coordinates (azimuth/altitude) Refraction is ignored
        Parameters:
        coor -
        TDT -
        geolat -
        lmst -
        Returns:
        horizonal coordinates (azimuth/altitude)
      • geoEqu2TopoEqu

        public static Astronomy.Coor geoEqu2TopoEqu​(Astronomy.Coor coor,
                                                    Astronomy.Coor observer,
                                                    double lmst)
        Transform geocentric equatorial coordinates (RA/Dec) to topocentric equatorial coordinates
        Parameters:
        coor -
        observer -
        lmst -
        Returns:
        topocentric equatorial coordinates
      • equPolar2Cart

        public static Astronomy.Coor equPolar2Cart​(double lon,
                                                   double lat,
                                                   double distance)
        Calculate cartesian from polar coordinates
        Parameters:
        lon -
        lat -
        distance -
        Returns:
        cartesian
      • observer2EquCart

        public static Astronomy.Coor observer2EquCart​(double lon,
                                                      double lat,
                                                      double height,
                                                      double gmst)
        Calculate observers cartesian equatorial coordinates (x,y,z in celestial frame) from geodetic coordinates (longitude, latitude, height above WGS84 ellipsoid) Currently only used to calculate distance of a body from the observer
        Parameters:
        lon -
        lat -
        height -
        gmst -
        Returns:
        observers cartesian equatorial coordinates
      • sunPosition

        public static Astronomy.Coor sunPosition​(double TDT)
        Calculate coordinates for Sun Coordinates are accurate to about 10s (right ascension) and a few minutes of arc (declination)
        Parameters:
        TDT -
        Returns:
        coordinates for Sun
      • sunPosition

        public static Astronomy.Coor sunPosition​(double TDT,
                                                 double geolat,
                                                 double lmst)
        Parameters:
        TDT -
        geolat -
        lmst -
        Returns:
        coordinates for Sun
      • moonPosition

        public static Astronomy.Coor moonPosition​(Astronomy.Coor sunCoor,
                                                  double TDT)
        Calculate data and coordinates for the Moon Coordinates are accurate to about 1/5 degree (in ecliptic coordinates)
        Parameters:
        sunCoor -
        TDT -
        Returns:
        data and coordinates for the Moon
      • moonPosition

        public static Astronomy.Coor moonPosition​(Astronomy.Coor sunCoor,
                                                  double TDT,
                                                  Astronomy.Coor observer,
                                                  double lmst)
        Parameters:
        sunCoor -
        TDT -
        observer -
        lmst -
        Returns:
        data and coordinates for the Moon
      • refraction

        public static double refraction​(double alt)
        Rough refraction formula using standard atmosphere: 1015 mbar and 10°C Input true altitude in radians, Output: increase in altitude in degrees
        Parameters:
        alt -
        Returns:
        increase in altitude in degrees
      • sunRise

        public static Astronomy.Riseset sunRise​(double JD,
                                                double deltaT,
                                                double lon,
                                                double lat,
                                                double zone,
                                                boolean recursive)
        Find (local) time of sunrise and sunset, and twilights JD is the Julian Date of 0h local time (midnight) Accurate to about 1-2 minutes recursive: 1 - calculate rise/set in UTC in a second run recursive: 0 - find rise/set on the current local day. This is set when doing the first call to this function
        Parameters:
        JD -
        deltaT -
        lon -
        lat -
        zone -
        recursive -
        Returns:
        (local) time of sunrise and sunset, and twilights
      • moonRise

        public static Astronomy.Riseset moonRise​(double JD,
                                                 double deltaT,
                                                 double lon,
                                                 double lat,
                                                 double zone,
                                                 boolean recursive)
        Find local time of moonrise and moonset JD is the Julian Date of 0h local time (midnight) Accurate to about 5 minutes or better recursive: 1 - calculate rise/set in UTC recursive: 0 - find rise/set on the current local day (set could also be first) returns 0.000000000 for moonrise/set does not occur on selected day
        Parameters:
        JD -
        deltaT -
        lon -
        lat -
        zone -
        recursive -
        Returns:
        local time of moonrise and moonset