https://github.com/bluegreen-labs/skylight
A Simple Sky Illuminance Model
Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.8%) to scientific vocabulary
Keywords
Repository
A Simple Sky Illuminance Model
Basic Info
- Host: GitHub
- Owner: bluegreen-labs
- License: agpl-3.0
- Language: R
- Default Branch: main
- Homepage: https://bluegreen-labs.github.io/skylight/
- Size: 6.58 MB
Statistics
- Stars: 5
- Watchers: 0
- Forks: 1
- Open Issues: 1
- Releases: 3
Topics
Metadata Files
README.md
Skylight 
The skylight package returns sky illuminance parameters for both the sun and
the moon, for a given date/time and location. In addition, ancillary
parameters such as sun and moon azimuth and altitude are provided. The code is
an almost verbatim transcription of the work by Janiczek and DeYoung (1987),
published in the US Naval observatory circular. An online copy of this
manuscripts can be found on the internet archive
(https://archive.org/details/DTIC_ADA182110).
Very few adjustments to the original code where made to ensure equivalency in results. As such, most of the naming of the subroutines and variables was retained. However, some changes were made to the main routine and subroutines to ensure vectorization of the code to speed up batch processing of data.
With time more detailed information will be added to all functions, including references to subroutine functions and more transparent variable names, while limiting variable recycling (a common practice in the original code base). The code delivers equivalent results with the programme certification values published in Table A of Janiczek and DeYoung (1987), as such all original limitations remain (see below).
How to cite this package in your article
Hufkens, K. et al. (2023) ‘Evaluating the effects of moonlight on the vertical flight profiles of three western palaearctic swifts’. Royal Society Proceedings B. doi: 10.1098/rspb.2023.0957, in addition reference the original work by Janiczek and DeYoung (1987, see below)
Limitations
The sky illuminance model by Janiczek and DeYoung (1987) in skylight has some limitations:
- Design specifications aimed for 0.5 degrees in angle, or two minutes of times. Last digits should be considered uncertain by one unit.
- At latitudes less than 60 degrees, the model should agree with more refined calculations to within one or two minutes of time. For latitudes above this value the model can produce errors of up to four minutes.
- In some circumstances calculated illuminance values might differ from real light levels of a factor 10 or more.
- Strong coherence and proper time keeping is required, there is a strong requirement to provide dates in GMT, corrections based upon latitude (not civil time zone) should be executed before processing. No warnings are provided.
Yet, overall the model should provide a fast approximation where more computationally expensive models would only provide marginal benefits for most applications. For a full description of the model I refer to Janiczek and DeYoung (1987).
Installation
stable release
To install the current stable release use a CRAN repository:
r
install.packages("skylight")
library("skylight")
development release
To install the development releases of the package run the following commands:
r
if(!require(remotes)){install.packages("remotes")}
remotes::install_github("bluegreen-labs/skylight")
library("skylight")
Vignettes are not rendered by default, if you want to include additional documentation please use:
r
if(!require(remotes)){install.packages("remotes")}
remotes::install_github("bluegreen-labs/skylight", build_vignettes = TRUE)
library("skylight")
Use
Single date/time and location
skylight values can be calculated for a single point and date using the below call. This will generate a data frame with model values.
```r
load the library
library(skylight)
calculate sky illuminance values for
a single date/time and location
df <- skylight( longitude = -135.8, latitude = -23.4, date = as.POSIXct("1986-12-18 21:00:00", tz = "GMT"), sky_condition = 1 ) ```
Multiple dates/times and/or locations
The skylight function is vectorized, so you can provide vectors of input parameters instead of using a loop and the above function call.
```r
Generate a dataset with 15 minute values
for approximately two months
input <- data.frame( longitude = 0, latitude = 50, date = as.POSIXct("2020-06-18 00:00:00", tz = "GMT") + seq(0, 60243600, 900), sky_conditions = 1 )
calculate sky illuminance values for
a single date/time and location
df <- skylight( input$longitude, input$latitude, input$date, 1 )
previous results are of the same dimension (rows)
as the input data and can be bound together
for easy plotting
input <- cbind(input, df) ```
Plotting this data results in

Piped data workflow
skylight supports piped data frames with appropriatedly named columns as input
to the function. This allows for fast processing of large data frames, with the
added advantage that input parameters are returned with the calculated data.
Note that you need a data frame with the three most basic parameters: - longitude - latitude - date named as such (all lower case). The function will complain if it doesn't find the required column names. Also note that due to the priority of the piped construction over the other parameters all parameters should be named when calling the function in a conventional way.
```r
recreating the data frame with parameters
as before
input <- data.frame( longitude = 0, latitude = 50, date = as.POSIXct("2020-06-18 00:00:00", tz = "GMT") + seq(0, 1243600, 1800), sky_condition = 1 )
but now using the piped approach to calculate
all values
df <- input |> skylight() ```
Speed and other considerations
The current code, using the vectorized piped approach, is sufficiently fast to support larger data sets. For example a more advanced cloud cover correction is described in the vignettes and taking this analysis as inspiration animations of illuminance can be made (as shown below).

Licensing
The skylight package is distributed under a AGPLv3 license, while the skylight model code resides in the public domain made available by Janiczek and DeYoung (1987). The logo is in part based upon Emoji One v2.0 iconography.
References
- Janiczek and DeYoung (1997). Computer Programs for Sun and Moon Illuminance With Contingent Tables and Diagrams, US Naval observatory circular nr. 171, 1987
Owner
- Name: BlueGreen Labs
- Login: bluegreen-labs
- Kind: organization
- Email: info@bluegreenlabs.org
- Location: Melsele, Belgium
- Website: http://bluegreenlabs.org
- Repositories: 17
- Profile: https://github.com/bluegreen-labs
BlueGreen open science labs & consulting, providing environmental research infrastructure and editorial solutions.
GitHub Events
Total
- Watch event: 1
- Push event: 7
Last Year
- Watch event: 1
- Push event: 7
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Koen Hufkens | k****s@g****m | 72 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 5
- Total pull requests: 2
- Average time to close issues: about 1 year
- Average time to close pull requests: 1 day
- Total issue authors: 1
- Total pull request authors: 2
- Average comments per issue: 1.2
- Average comments per pull request: 3.5
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 2.0
- Average comments per pull request: 3.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- khufkens (5)
Pull Request Authors
- khufkens (2)
- olivroy (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 194 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 2
- Total maintainers: 1
cran.r-project.org: skylight
A Simple Sky Illuminance Model
- Homepage: https://github.com/bluegreen-labs/skylight
- Documentation: http://cran.r-project.org/web/packages/skylight/skylight.pdf
- License: AGPL-3
-
Latest release: 1.2
published over 2 years ago
Rankings
Maintainers (1)
Dependencies
- R >= 3.6 depends
- covr * suggests
- dplyr * suggests
- ggplot2 * suggests
- knitr * suggests
- ncdf4 * suggests
- rmarkdown * suggests
- rnaturalearth * suggests
- scales * suggests
- terra * suggests
- testthat * suggests
- tidyr * suggests
- actions/cache v2 composite
- actions/checkout v2 composite
- actions/upload-artifact main composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- actions/cache v2 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v1 composite