[R] sunrise, sunset calculation

Martin Maechler maechler at stat.math.ethz.ch
Mon Jun 21 11:58:06 CEST 2004


>>>>> "Mike" == Mike Sumner <mdsumner at utas.edu.au>
>>>>>     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?

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




More information about the R-help mailing list