sunAngle: Solar Angle as Function of Space and Time Based on...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/quality_control.R

Description

Solar Angle as Function of Space and Time Based on NASA-provided Fortran program, in turn (according to comments in the code) based on "The Astronomical Almanac".

Usage

1
sunAngle(t, longitude = 0, latitude = 0, useRefraction = FALSE)

Arguments

t

time, a POSIXt object (converted to timezone "UTC", if it is not already in that timezone), or a numeric value that corresponds to such a time.

longitude

observer longitude in degrees east

latitude

observer latitude in degrees north

useRefraction

boolean, set to TRUE to apply a correction for atmospheric refraction

Value

A list containing the following.

time

time

azimuth

azimuth, in degrees eastward of north, from 0 to 360. (See diagram below.)

altitude

altitude, in degrees above the horizon, ranging from -90 to 90. (See diagram below.)

diameter

solar diameter, in degrees

distance

distance to sun, in astronomical units

starCoords.png

Author(s)

Dan Kelley

References

Based on Fortran code retrieved from ftp://climate1.gsfc.nasa.gov/wiscombe/Solar_Rad/SunAngles/sunae.f on 2009-11-1. Comments in that code list as references: Michalsky, 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).

See Also

The equivalent function for the moon is moonAngle.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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(lonlat)
{
    sunAngle(rise, lonlat[1], lonlat[2])$altitude^2 + sunAngle(set, lonlat[1], lonlat[2])$altitude^2
}
result <- optim(c(1,1), mismatch)
lon.hfx <- (-63.55274)
lat.hfx <- 44.65
dist <- geodDist(result$par[1], result$par[2], lon.hfx, lat.hfx)
cat(sprintf("Infer Halifax latitude %.2f and longitude %.2f; distance mismatch %.0f km",
            result$par[2], result$par[1], dist))

MariekeDirk/wrdc documentation built on Nov. 19, 2019, 10:44 p.m.