utility
Class SunAndMoon

java.lang.Object
  extended by utility.SunAndMoon

public class SunAndMoon
extends java.lang.Object

All this stuff is stolen (ported) from skycalc


Field Summary
static double ARCSEC_IN_RADIAN
           
static double DEG_IN_RADIAN
           
static java.text.DateFormat df
           
static double EIGHTH_OF_MONTH
           
static double HRS_IN_RADIAN
           
static double J2000
           
static double PERIOD
           
static double PI
           
static double SEC_IN_DAY
           
static double tzone
           
 
Constructor Summary
SunAndMoon()
           
 
Method Summary
static void aa2hd(java.util.Hashtable hash)
          converts alt-az (deg,deg) to ha-dec (hr,deg).
static double acos(double x)
           
static double adj_time(double x)
          adjusts a time (decimal hours) to be between -12 and 12, generally used for hour angles.
static double altit(double dec, double ha, double lat)
          returns altitude(deg) for dec, ha, lat (dd dec, lat, deg; dh hr)
static double asin(double x)
           
static double atan_circ(double x, double y)
          returns radian angle 0 to 2pi for coords x, y -- get that quadrant right !!
static double atan(double x)
           
static double atan(double x, double y)
           
static double azimuth(double dec, double ha, double lat)
          returns azimuth(deg) for dec, ha, lat (dd dec, lat, deg; dh hr)
static double cos(double x)
           
static double fabs(double x)
           
static double getDateOfAltRise(double alt, double jd, double ra, double dec, double lat, double longit)
          get the time when an object is rising at a given altitude
static double getDateOfAltRiseSet(double alt, double jd, double ra, double dec, double lat, double longit, boolean doRise)
          get the time when an object is rising or setting at a given altitude
static double getDateOfAltSet(double alt, double jd, double ra, double dec, double lat, double longit)
          get the time when an object is setting at a given altitude
static double getEpheremis(double jd, double dlat, double hlongit, double elev, boolean doSun, boolean doRise)
          gets the rise or set time for the sun or moon on a given day and location
static double getMoonDEC(double jd, double dlat, double hlongit)
           
static double getMoonRA(double jd, double dlat, double hlongit)
           
static double getMoonRise(double jd, double dlat, double hlongit, double elev)
           
static double getMoonSet(double jd, double dlat, double hlongit, double elev)
           
static double getRiseTime(double jd, double ra, double dec, double lat, double longit)
          Get the rise time of an object given an RA and DEC.
static double getSetTime(double jd, double ra, double dec, double lat, double longit)
          Get the set time of an object given an RA and DEC.
static double getSunDEC(double jd)
           
static double getSunRA(double jd)
           
static double getSunRise(double jd, double dlat, double hlongit, double elev)
           
static double getSunSet(double jd, double dlat, double hlongit, double elev)
           
static double ha_alt(double dec, double lat, double alt)
          returns hour angle at which object at dec is at altitude alt.
static double jd_alt(double alt, double jdguess, double lat, double longit, boolean doSun)
          returns jd at which sun or moon is at a given altitude, given jdguess as a starting point.
static double julDateOfAlt(double alt, double jdguess, double lat, double longit, double ra, double dec)
          returns jd at which object is at a given altitude, given jdguess as a starting point.
static void lpmoon(double jd, double lat, double sid, PointersSuck ps)
          ps holds ra, dec, and dist of moon.
static void lpsun(double jd, PointersSuck ps)
          Low precision formulae for the sun, from Almanac p.
static double lst(double jd, double longit)
          returns the local MEAN sidereal time (dec hrs) at julian date jd at west longitude long (decimal hours).
static void main(java.lang.String[] args)
          provides command line access to the routines
static void min_max_alt(double lat, double dec, PointersSuck ps)
          computes minimum and maximum altitude for a given dec and latitude.
static double sin(double x)
           
static double sqrt(double x)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EIGHTH_OF_MONTH

public static final double EIGHTH_OF_MONTH
See Also:
Constant Field Values

PERIOD

public static final double PERIOD
See Also:
Constant Field Values

PI

public static final double PI
See Also:
Constant Field Values

ARCSEC_IN_RADIAN

public static final double ARCSEC_IN_RADIAN
See Also:
Constant Field Values

DEG_IN_RADIAN

public static final double DEG_IN_RADIAN
See Also:
Constant Field Values

HRS_IN_RADIAN

public static final double HRS_IN_RADIAN
See Also:
Constant Field Values

J2000

public static final double J2000
See Also:
Constant Field Values

SEC_IN_DAY

public static final double SEC_IN_DAY
See Also:
Constant Field Values

tzone

public static double tzone

df

public static java.text.DateFormat df
Constructor Detail

SunAndMoon

public SunAndMoon()
Method Detail

main

public static void main(java.lang.String[] args)
provides command line access to the routines


lst

public static double lst(double jd,
                         double longit)
returns the local MEAN sidereal time (dec hrs) at julian date jd at west longitude long (decimal hours). Follows definitions in 1992 Astronomical Almanac, pp. B7 and L2. Expression for GMST at 0h ut referenced to Aoki et al, A&A 105, p.359, 1982. On workstations, accuracy (numerical only!) is about a millisecond in the 1990s.


lpmoon

public static void lpmoon(double jd,
                          double lat,
                          double sid,
                          PointersSuck ps)
ps holds ra, dec, and dist of moon.

implements "low precision" moon algorithms from Astronomical Almanac (p. D46 in 1992 version). Does apply the topocentric correction. Units are as follows jd,lat, sid; decimal hours ra, *dec, decimal hours, degrees dist; earth radii


ha_alt

public static double ha_alt(double dec,
                            double lat,
                            double alt)
returns hour angle at which object at dec is at altitude alt. If object is never at this altitude, signals with special return values 1000 (always higher) and -1000 (always lower).


min_max_alt

public static void min_max_alt(double lat,
                               double dec,
                               PointersSuck ps)
computes minimum and maximum altitude for a given dec and latitude.


adj_time

public static double adj_time(double x)
adjusts a time (decimal hours) to be between -12 and 12, generally used for hour angles.


altit

public static double altit(double dec,
                           double ha,
                           double lat)
returns altitude(deg) for dec, ha, lat (dd dec, lat, deg; dh hr)


azimuth

public static double azimuth(double dec,
                             double ha,
                             double lat)
returns azimuth(deg) for dec, ha, lat (dd dec, lat, deg; dh hr)


aa2hd

public static void aa2hd(java.util.Hashtable hash)
converts alt-az (deg,deg) to ha-dec (hr,deg). Put "altitude", "azimuth", and "latitude" entries into the Hashtable (all as Doubles in deg). Out put is "declination" and "hourAngle" in the hash (deg and hr as Double).


lpsun

public static void lpsun(double jd,
                         PointersSuck ps)
Low precision formulae for the sun, from Almanac p. C24 (1990) ra and dec are returned as decimal hours and decimal degrees.


jd_alt

public static double jd_alt(double alt,
                            double jdguess,
                            double lat,
                            double longit,
                            boolean doSun)
returns jd at which sun or moon is at a given altitude, given jdguess as a starting point.


getEpheremis

public static double getEpheremis(double jd,
                                  double dlat,
                                  double hlongit,
                                  double elev,
                                  boolean doSun,
                                  boolean doRise)
gets the rise or set time for the sun or moon on a given day and location


getSunRise

public static double getSunRise(double jd,
                                double dlat,
                                double hlongit,
                                double elev)

getSunSet

public static double getSunSet(double jd,
                               double dlat,
                               double hlongit,
                               double elev)

getMoonRise

public static double getMoonRise(double jd,
                                 double dlat,
                                 double hlongit,
                                 double elev)

getMoonSet

public static double getMoonSet(double jd,
                                double dlat,
                                double hlongit,
                                double elev)

getSunRA

public static double getSunRA(double jd)

getSunDEC

public static double getSunDEC(double jd)

getMoonRA

public static double getMoonRA(double jd,
                               double dlat,
                               double hlongit)

getMoonDEC

public static double getMoonDEC(double jd,
                                double dlat,
                                double hlongit)

julDateOfAlt

public static double julDateOfAlt(double alt,
                                  double jdguess,
                                  double lat,
                                  double longit,
                                  double ra,
                                  double dec)
returns jd at which object is at a given altitude, given jdguess as a starting point.


getRiseTime

public static double getRiseTime(double jd,
                                 double ra,
                                 double dec,
                                 double lat,
                                 double longit)
Get the rise time of an object given an RA and DEC.


getDateOfAltRise

public static double getDateOfAltRise(double alt,
                                      double jd,
                                      double ra,
                                      double dec,
                                      double lat,
                                      double longit)
get the time when an object is rising at a given altitude


getSetTime

public static double getSetTime(double jd,
                                double ra,
                                double dec,
                                double lat,
                                double longit)
Get the set time of an object given an RA and DEC.


getDateOfAltSet

public static double getDateOfAltSet(double alt,
                                     double jd,
                                     double ra,
                                     double dec,
                                     double lat,
                                     double longit)
get the time when an object is setting at a given altitude


getDateOfAltRiseSet

public static double getDateOfAltRiseSet(double alt,
                                         double jd,
                                         double ra,
                                         double dec,
                                         double lat,
                                         double longit,
                                         boolean doRise)
get the time when an object is rising or setting at a given altitude


sin

public static double sin(double x)

cos

public static double cos(double x)

asin

public static double asin(double x)

acos

public static double acos(double x)

atan

public static double atan(double x)

atan

public static double atan(double x,
                          double y)

fabs

public static double fabs(double x)

sqrt

public static double sqrt(double x)

atan_circ

public static double atan_circ(double x,
                               double y)
returns radian angle 0 to 2pi for coords x, y -- get that quadrant right !!