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]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.