[R] problem with Zenith angle calculation

Alemu Tadesse alemu.tadesse at gmail.com
Fri Oct 31 01:00:40 CET 2014


Dea R users,

In the package insol
I was trying to calculate sunzenith angle. I am using two different date
formats as shown below and both give me different results. Comapring the
results from NOAA website the one below is correct.

xx<-JD(ISOdate(2010,10,1,11))
sv=sunvector(xx,lat,lon,tmz)
zenith=sunpos(sv)
azimuth<-zenith[1,1]
zenith<-zenith[1,2]
zenith
[1] 40.18603
However, the one below is not correct. I have several datetimes and either
I have to use loop to separate year, month, day hour to use the one above.
when I try insert a vector of year, month, day, hour   the formula above
doesn't work. I wish I know how to do it for several dates correctly using
the one below.


x<-JD(as.POSIXct("2010-10-01 11:00:00",tz="",format="%Y-%m-%d %H:%M:%S"))
sv=sunvector(x,lat,lon,tmz)
zenith=sunpos(sv)
azimuth<-zenith[1,1]
zenith<-zenith[1,2]
 zenith
[1] 77.79948

	[[alternative HTML version deleted]]



More information about the R-help mailing list