Description Usage Arguments Value Warning Author(s) References See Also Examples
View source: R/pkgAtmosphere.R
Calculation of Sunrise and Sunset for a specific Julian day of the year, latitude and Longitude
1 |
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 |
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
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.
Gionata Biavati
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
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.