Using the Quick TUV Calculator

Importing simulated solar spectrum data into R

solar spectrum

Pedro J. Aphalo






Instructions for running solar spectrum simulations in the Quick TUV web inferface, downloading the files and importing them into R, using packages ‘photobiology’ and ‘photobiologyInOut’. Example R code and a screnn capture video are included.


photobiologyInOut pkg, TUV model

1 Importing the output from TUV

As package ‘photobiologyInOut’ (versions >= 0.4.15) provides a function for the automatic import of the files returned by the Quick TUV Calculator, we show here how to produce such files, and link to an example showing how to import and plot them in R.

The TUV model is a well known model of atmospheric chemistry that also simulates the solar spectrum within the atmosphere or at ground level using a radiation transfer approach. The model is written in FORTRAN and available for local use. When one needs just to compute a few spectra with no special conditions, it is possible to use the on-line interface provided by the National Centre of Atmospheric Research (NCAR) under the name of Quick TUV Calculator.

This interface is easy to use once one understands the different options and required input data. (This video, authored by Pedro J. Aphalo is published with the express permission of Sasha Madronich, creator of the TUV model.)

This video is hosted at Vimeo.

2 Exploring sunlight with the Quick TUV model and R

I published an article describing how to import and plot the data from Quick TUV using R (Aphalo, 2018). A supplementary file to the article gives additional examples demonstrating how the solar spectrum is affected by variation in the atmospheric composition, solar elevation and observer elevation is available for reading and/or download. The R code used in embedded in the supplementary HTML file.

3 Alternatives

The TUV model can be run on the local computer obtaining output files similar, but not identical, to those saved from the Quick TUV on-line calculator. Package ‘photobiologyInOut’ provides two functions to import these files. This would be preferable when the number of spectral simulations to do is large.

R package ‘foqat’ provides functions for calling on-line or locally the TUV model to produce batches of spectral simulations. The output is not directly compatible with the classes defined in package ‘photobiology’ to store spectra. In a future update to ‘photobiologyInOut’ I plan to add a wrapper on these functions.