Your example is not reproducible. For example you don't indicate what lat
and lon values you are using.
Nor do you specify what time zone you are working in. These are all crucial to
obtain consistency.
I have no experience using the insol package, and had no luck trying it just
now, but the maptools package can do the job. You may need to correspond with
the insol package maintainer with a reproducible example to figure out if the
package is buggy or not.
library(maptools)
Sys.setenv( "Etc/GMT+5" ) # US Eastern no daylight savings
lat <- 40
lon <- -80
dtm <- as.POSIXct( "2014-10-30 10:00:00" )
site <- SpatialPoints( matrix( c( lon, lat ), nrow=1 )
azel <- solarpos( site, dtm )
# 145.2686 28.96532
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live
Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
On October 30, 2014 5:00:40 PM PDT, Alemu Tadesse <alemu.tadesse at
gmail.com> wrote:>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 at 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.