Calculate Sun Position, Sunrise, Sunset, Solar Noon and Twilight

Provides a set of convenient functions for calculating sun-related information, including the sun's position (elevation and azimuth), and the times of sunrise, sunset, solar noon, and twilight for any given geographical location on Earth. These calculations are based on equations provided by the National Oceanic & Atmospheric Administration (NOAA) < https://gml.noaa.gov/grad/solcalc/calcdetails.html> as described in "Astronomical Algorithms" by Jean Meeus (1991, ISBN: 978-0-943396-35-4).


suntools

R-CMD-check

suntools provides functions for calculating the sun's position, sunrise, sunset, solar noon, and crepuscular (twilight) times for any given geographical location and time on earth. Functions in suntools used to be part of the maptools package. The functions are based on equations provided by the National Oceanic & Atmospheric Administration (NOAA).

Main package functions:

  • crepuscule(): Calculates crepuscular (twilight) times, i.e. the time of dawn or dusk.
  • sunriset(): Calculates the times of sunrise and sunset at a given location.
  • solarpos(): Calculates the solar position (elevation and azimuth) at a given location and time.
  • solarnoon(): Calculates solar noon time at a given location.

Installation

You can install the released version of suntools from CRAN with:

install.packages("suntools")

Alternatively, you can install the development version from GitHub with:

devtools::install_github("adokter/suntools")

Example

library(suntools)

#Calculate sunset in Ithaca, NY, USA on June 1, 2023

sunriset(
  matrix(c(-76.4511, 42.4800), nrow = 1),
  as.POSIXct("2023-06-01", tz = "America/New_York"),
  direction='sunset',
  POSIXct.out=TRUE
)

#  day_frac                time
#1 0.858628 2023-06-01 20:36:25

Author(s)

References

This package uses algorithms provided by the National Oceanic & Atmospheric Administration (NOAA), for more information see

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("suntools")

1.1.0 by Adriaan M. Dokter, a year ago


https://github.com/adokter/suntools/


Report a bug at https://github.com/adokter/suntools/issues


Browse source code at https://github.com/cran/suntools


Authors: Roger Bivand [aut] , Adriaan M. Dokter [ctb, cre] (ORCID: , Pieter Huybrechts [ctb] (ORCID: , Sebastian Luque [aut] , Greg Pelletier [ctb] , Alexander Tedeschi [ctb] (ORCID:


Documentation:   PDF Manual  


GPL (>= 3) license


Imports methods, sf, stats

Suggests testthat


Imported by EMbC, FLightR, LightLogR, RchivalTag, bioRad, birdscanR.

Depended on by StreamMetabolism, overlap.


See at CRAN