photobiology (test release)

Rewrite all “astronomical” calculations using different algorithms. The interface has changed to some extent. For the solar position calculations, the returned values are slightly different, usually in the order of tenths of a degree. For day length the differences are of up to a few minutes for the twilight definition "none" which used to be the default. With the current default "sunlight", at high latitudes, days are longer than before. For latitudes < 72 degrees day length now returned are within 1 min of the true values. At higher latitudes the errors can be up to 10 min. The range of dates supported is now much wider. In addition the calculation of the times of sunrise, solar noon and sunset is many times faster than earlier. The same is true for the calculation of local solar time for any geographic coordinates. This edit was long overdue.

The main changes to the interface of the functions has to do with the changed default for twilight, and the deletion of the redundant parameters lat and lon. The geocode parameter remains, but if present the address variable is copied to the output. Multiple dates can be supplied as a vector, and multiple geocodes as a data frame with multiple rows. The tz parameter can be either a single value, or a vector of the same length as the number of rows in the geocode data frame. Vectorization is optimized for performance: only the parts of the calculations that need to be recalculated are recalculated.

Please, test and report any problems. I hope there are not many bugs after the testing done by myself already caught quite a few. However, being this a full rewrite from scratch of several functions, problems may be still lurking.

Please, report any problems you encounter, and suggest possible changes or additions to the functionality!

NOTE: These versions of the packages are available through the r4photobiology repository.

Share on

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.