Learn R Programming

oce (version 0.1-80)

sun.angle: Solar angle as function of space and time.

Description

Solar angle as function of space and time.

Usage

sun.angle(t, lat, lon)

Arguments

t
Time, a POSIXt object (must be in GMT).
lat
latitude in degrees north
lon
longitude in degrees east

Value

  • A data frame containing az, el, soldia, and soldst.

Details

Based on NASA-provided fortran program, in turn (according to comments in the code) based on "The Astromincal Almanac".

References

Uses on Fortran code retrieved from ftp://climate1.gsfc.nasa.gov/wiscombe/Solar_Rad/SunAngles/sunae.f on 2008-11-1.

Examples

Run this code
t0 <- as.POSIXct("2008-01-01 00:00:01", tz="UTC")
t1 <- as.POSIXct("2009-01-01 00:00:01", tz="UTC")
t <- seq(from=t0, to=t1, length.out=365)
lat <- rep(0, 365)
lon <- rep(0, 365)
a <- sun.angle(t, lat, lon)
par(mfrow=c(2,1))
plot(t, a$az, type='l', ylab="Azimuth [deg]")
plot(t, a$el, type='l', ylab="Elevation [deg]")

Run the code above in your browser using DataLab