Martin Maechler wrote:
>>>>>> "Mike" == Mike Sumner <[EMAIL PROTECTED]>
>>>>>> on Mon, 21 Jun 2004 19:04:00 +1000 writes:
>
>
>
> Mike> At 06:26 PM 6/21/2004, Angel Lopez wrote:
> >> Are there any functions available to calculate sunrise and sunset times >> for given latitude,longitude and dates?
> >> If not, I'll appreciatte any pointers to C code I could use/port.
> >> Thanks,
> >> Angel
>
>
> Mike> Hello, I have R code for determining solar elevation
> Mike> for given lat,lon,time - they were translated from the
> Mike> Javascript on these pages.
>
> Mike> http://www.srrb.noaa.gov/highlights/sunrise/sunrise.html
> Mike> http://www.srrb.noaa.gov/highlights/sunrise/azel.html
>
> Mike> I use them in a fairly specialized way, but I can dig
> Mike> it out and probably help you get started.
>
> that might be nice to have in an R package.
> sunrise/sunset would then be the zeros [ "uniroot()" ] of the
> sun elevations?
>
Well, not always ;-) , it depends on how you define sunrise/sunset, there are various definitions (astrological, nautical, civil).
The most complete code I know of (also pointed to me by another user in private) is sunriset.c. It would be quite easy to use this C code and write a wrapper functions in R. Because it was me who asked first I'll try to do it.
However using noaa algorithms might be better, the sunriset.c gives slight differences to noaa (and to emacs sunrise-sunset), I don't know which one is better but it might be better to say that R code 'uses noaa algorithms'. Any other pointers welcomed.
Angel
> Note that ESS (and other Emacs) users have it at least at their
> finger tips: M-x sunrise-sunset
> (and there's lunar phases, holidays, dairy etc; only partly also available from [Tools] -> [Display Calendar] -> {{new menu entries when inside calendar}}
>
> So, you can also find the emacs-lisp code (in
> ..../lisp/calendar/solar.el but only when you've got a "source"
> installation of emacs).
>
> Martin Maechler
>
> .
>
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
