Skip to content

Commit

Permalink
Change default calculator to the NOAA (from USNO)
Browse files Browse the repository at this point in the history
This relatively significant change replaces the USNO algorithm with the NOOA (Jean Meeus) one as the default calculator. The USNO algorithm does not account for leap years, and has been replaced by the USNO by newer and not publicly published algorithms (the code used in this API are based on the published Almanac from 1989 that was designed to be accurate for the years 1950-2050). Users who would like to use the USNO algorithm can easily continue doing so.
  • Loading branch information
KosherJava committed Oct 6, 2019
1 parent 19b3bdd commit b69dc31
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/net/sourceforge/zmanim/util/AstronomicalCalculator.java
@@ -1,6 +1,6 @@
/*
* Zmanim Java API
* Copyright (C) 2004-2014 Eliyahu Hershfeld
* Copyright (C) 2004-2019 Eliyahu Hershfeld
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
Expand All @@ -19,10 +19,11 @@

/**
* An abstract class that all sun time calculating classes extend. This allows the algorithm used to be changed at
* runtime, easily allowing comparison the results of using different algorithms. TODO: consider methods that would
* allow atmospheric modeling. This can currently be adjusted by {@link #setRefraction(double) setting the refraction}.
* runtime, easily allowing comparison the results of using different algorithms.
* @todo Consider methods that would allow atmospheric modeling. This can currently be adjusted by {@link
* #setRefraction(double) setting the refraction}.
*
* @author © Eliyahu Hershfeld 2004 - 2014
* @author © Eliyahu Hershfeld 2004 - 2019
*/
public abstract class AstronomicalCalculator implements Cloneable {
/**
Expand Down Expand Up @@ -75,13 +76,14 @@ public void setEarthRadius(double earthRadius) {
private static final double GEOMETRIC_ZENITH = 90;

/**
* getDefault method returns the default sun times calculation engine.
* Returns the default class for calculating sunrise and sunset. This is currently the {@link NOAACalculator},
* but this may change.
*
* @return AstronomicalCalculator the default class for calculating sunrise and sunset. In the current
* implementation the default calculator returned is the {@link SunTimesCalculator}.
* implementation the default calculator returned is the {@link NOAACalculator}.
*/
public static AstronomicalCalculator getDefault() {
return new SunTimesCalculator();
return new NOAACalculator();
}

/**
Expand Down Expand Up @@ -175,7 +177,6 @@ public abstract double getUTCSunset(Calendar calendar, GeoLocation geoLocation,
// double elevationAdjustment = 0.0347 * Math.sqrt(elevation);
double elevationAdjustment = Math.toDegrees(Math.acos(earthRadius / (earthRadius + (elevation / 1000))));
return elevationAdjustment;

}

/**
Expand Down Expand Up @@ -227,9 +228,9 @@ public abstract double getUTCSunset(Calendar calendar, GeoLocation geoLocation,
}

/**
* A method to allow overriding the default refraction of the calculator. TODO: At some point in the future, an
* AtmosphericModel or Refraction object that models the atmosphere of different locations might be used for
* increased accuracy.
* A method to allow overriding the default refraction of the calculator.
* @todo At some point in the future, an AtmosphericModel or Refraction object that models the atmosphere of different
* locations might be used for increased accuracy.
*
* @param refraction
* The refraction in arc minutes.
Expand Down

0 comments on commit b69dc31

Please sign in to comment.