suncalc: Sunrise and Sunset calculations

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

View source: R/pkgAtmosphere.R

Description

Calculation of Sunrise and Sunset for a specific Julian day of the year, latitude and Longitude

Usage

1
suncalc(d, Lat = 0, Long = 0, UTC = TRUE)

Arguments

d

d is the day of year

Lat

Lat is latitude in decimal degrees

Long

Long is longitude in decimal degrees (negative == West)

UTC

logical value, FALSE if local time, TRUE if in UTC Default TRUE

Value

The output is a list containing two fields: "sunrise" time for sunrise, "sunset" time in decimals for sunset. Both are expressed with the timezone defined by the keyword UTC

Warning

For extreme latitudes in certain time of the year one can expect to do not have any sunset or sunrise. The function will provide NaN values and generate warnings.

Author(s)

Gionata Biavati

References

Teets, D.A. 2003. Predicting sunrise and sunset times. The College Mathematics Journal 34(4):317-321. http://aa.usno.navy.mil/data/docs/RS_OneYear.php

See Also

SZA

Examples

1
2
3
4
5
6
7
8
9
t<-Sys.time()+seq(-3600*12,3600*12,,by=600)
t0=as.POSIXlt(Sys.time(),tz='UTC')
plot(t,90-SZA(t,Lat=0,Lon=0),main='SZA',xlab='Time',ylab='El [°deg]')
sun=suncalc(t0[['yday']],UTC=TRUE)
t0[['hour']]<-0;t0[['min']]<-0
t1<-t0;t2<-t0
t1[['hour']]=sun[['sunrise']]
t2[['hour']]=sun[['sunset']]
abline(v=as.numeric(c(t1,t2)),col=3,lwd=4)

RAtmosphere documentation built on May 29, 2017, 12:08 p.m.