getElevationAdjustment method

double getElevationAdjustment (
  1. double elevation

Method to return the adjustment to the zenith required to account for the elevation. Since a person at a higher elevation can see farther below the horizon, the calculation for sunrise / sunset is calculated below the horizon used at sea level. This is only used for sunrise and sunset and not times before or after it such as {@link net.sourceforge.zmanim.AstronomicalCalendar#getBeginNauticalTwilight() nautical twilight} since those calculations are based on the level of available light at the given dip below the horizon, something that is not affected by elevation, the adjustment should only made if the zenith == 90° {@link #adjustZenith adjusted} for refraction and solar radius. The algorithm used is

elevationAdjustment = Math.toDegrees(Math.acos(earthRadiusInMeters / (earthRadiusInMeters + elevationMeters)));

The source of this algorithm is Calendrical Calculations by Edward M. Reingold and Nachum Dershowitz. An alternate algorithm that produces an almost identical (but not accurate) result found in Ma'aglay Tzedek by Moishe Kosower and other sources is:

elevationAdjustment = 0.0347 * Math.sqrt(elevationMeters);

@param elevation elevation in Meters. @return the adjusted zenith


double getElevationAdjustment(double elevation) {
  // double elevationAdjustment = 0.0347 * Math.sqrt(elevation);
  double elevationAdjustment = degrees(acos(_earthRadius / (_earthRadius + (elevation / 1000))));
  return elevationAdjustment;