sunAngle(t, latitude, longitude, useRefraction=FALSE)
TRUE
to apply a correction for atmospheric
refractionMichalsky, J., 1988: The Astronomical Almanac's algorithm for approximate solar position (1950-2050), Solar Energy 40, 227-235
The Astronomical Almanac, U.S. Gov't Printing Office, Washington, D.C. (published every year).
The code comments suggest that the appendix in Michalsky (1988) contains errors, and declares the use of the following formulae in the 1995 version the Almanac:
The code lists authors as Dr. Joe Michalsky and Dr. Lee Harrison (State University of New York), with modifications by Dr. Warren Wiscombe (NASA Goddard Space Flight Center).
moonAngle
.rise <- as.POSIXct("2011-03-03 06:49:00", tz="UTC") + 4*3600
set <- as.POSIXct("2011-03-03 18:04:00", tz="UTC") + 4*3600
mismatch <- function(latlon)
{
sunAngle(rise, latlon[1], latlon[2])$altitude^2 +
sunAngle(set, latlon[1], latlon[2])$altitude^2
}
result <- optim(c(1,1), mismatch)
lat.hfx <- 44.65
lon.hfx <- (-63.55274)
dist <- geodDist(result$par[1], result$par[2], lat.hfx, lon.hfx)
cat(sprintf("Infer Halifax latitude %.2f and longitude %.2f; distance mismatch %.0f km",
result$par[1], result$par[2], dist))
Run the code above in your browser using DataLab