Title: | A Simple Sky Illuminance Model |
---|---|
Description: | A tool to calculate sky illuminance values (in lux) for both sun and moon. The model is a verbatim translation of the code by Janiczek and DeYoung (1987) <https://archive.org/details/DTIC_ADA182110>. |
Authors: | Koen Hufkens [aut, cre] , BlueGreen Labs [cph, fnd] |
Maintainer: | Koen Hufkens <[email protected]> |
License: | AGPL-3 |
Version: | 1.2 |
Built: | 2025-01-21 04:56:19 UTC |
Source: | https://github.com/bluegreen-labs/skylight |
Function returns sky illuminance parameters for both the sun and the moon, in addition to some ancillary parameters such as sun and moon azimuth and altitude.
skylight(.data, longitude, latitude, date, sky_condition = 1)
skylight(.data, longitude, latitude, date, sky_condition = 1)
.data |
A data frame or data frame extension (e.g. a tibble) with named columns: longitude, latitude, date and optionally sky_condition |
longitude |
decimal longitude (single value or vector of values) |
latitude |
decimal latitude (single value or vector of values) |
date |
date and time in POSIXct format with GMT/UTC as time zone (single value or vector of values) |
sky_condition |
a positive value (>=1) with which to scale illuminance values (1 = cloud cover < 30 3 = average clouds, 10 = dark stratus clouds). By and large this can be considered a scaling factor, substituting it with the (inverse) slope parameter of an empirical fit should render more accurate results. (this can be a single value or vector of values) |
The code is almost verbatim transcription of the work "Computer Programs for Sun and Moon Illuminance With Contingent Tables and Diagrams by Janiczek and DeYoung" and published in the US Naval observatory circular nr. 171, 1987.
Required parameters are a location (in longitude, latitude), and a date in POSIXct format set to the GMT/UTC time zone. Conversions to GMT/UTC should be done externally, errors are not trapped.
The original code has been vectorized, as such vectors of location, time and/or sky conditions can be provided.
Sun and moon illuminance values (in lux), as well as their respective location in the sky (altitude, azimuth).
df <- skylight( longitude = -135.8, latitude = -23.4, date = as.POSIXct("1986-12-18 21:00:00", tz = "GMT"), sky_condition = 1 ) print(df)
df <- skylight( longitude = -135.8, latitude = -23.4, date = as.POSIXct("1986-12-18 21:00:00", tz = "GMT"), sky_condition = 1 ) print(df)