Using the Quick TUV Calculator

As the latest version (0.4.15) of our package ‘photobiologyInOut’ supports 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 of their import and plotting 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.)

An R notebook 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 this HTML file. Click on the image below to access the article. (The article is still a draft. Corrections and suggestions for improving it are most welcome.)

toc image

photobiologyInOut 0.4.15

The main changes from version 0.4.14 the previous CRAN release, are:

  • Add read_yoctopuce_csv() to read CSV files from YoctoPuce modules.
  • Add read_qtuv_txt() to read spectral data output files from the on-line Quick TUV calculator.
  • Add read_tuv_usrout2mspct() wrapper of read_tuv_usrout() and subset2mspct() useful to import multiple TUV simulations into a collection of spectra.
  • Revise read_tuv_usrout() with new formal parameter ozone.du and fix a bug in the setting of "where.measured" attribute.
  • Revise all read functions so that they store the header of the imported file as a vector of character strings to attribute "file.header".

The main changes from version 0.4.13 an earlier CRAN release, are:

  • Implement class coercion methods (“as.” methods) to complement earlier functions, tracking changes in ‘photobiology’ 0.9.20.
  • Move coercion methods from and to matrix objects to ‘photobiology’ 0.9.20.
  • Update to track API changes in ‘colorSpec’ 0.7-3.
  • Translate vignette to Rmarkdown.

Documentation web site at http://docs.r4photobiology.info/photobiologyinout/.

NOTE: The updated package is on its ways to CRAN.

Please raise issues concerning bugs or enhancements to this package through Bitbucket at https://bitbucket.org/aphalo/photobiologyinout/issues

ggpmisc 0.3.0

A major update to ‘ggpmisc’ (0.3.0) follows availability of the update of ‘ggplot2’ (3.0.0) (see release announcement) and the release of the new package ‘gginnards’ (0.0.1) (see announcement) through CRAN. Package documentation is available at https://docs.r4photobiology.info/ggpmisc/ as a web site.

Functions earlier included in ‘ggpmisc’ (< 0.3.0) related to debugging and low level manipulation of ggplot objects have been moved to package ‘gginnards’. The functions that remain in ‘ggpmisc’ (>= 0.3.0) are related to annotation of plots with fitted-model equations, fit diagnosis, ANOVA and summary tables, highlighting and labelling of peaks and valleys in curves, and local density-based highlighting or labelling in scatter plots.  Additionally specializations of the ggplot() constructor allow on-the-fly conversion of time-series and geom_table() makes it possible to add tables to plots respecting the the Grammar of Graphics paradigm.

The enhancements in this update to ‘ggpmisc’ are made possible by changes to ‘ggplot2’ (>= 3.0.0) made while adding support for sf (simple features). Not all extensions to ‘ggplot2’ have been updated yet to be compatible with the new version of ‘ggplot2’ so if you need them, you may need to wait before updating to ‘ggplot2’ (3.0.0) and consequently also before updating to this version of ‘ggpmisc’.

This time I include some example plots taken from the documentation of the package. In all cases annotations are generated automatically, but formatting is flexible. Larger plots are linked to the thumbnails.

Main changes since ‘ggpmisc’ (0.2.17) the previous CRAN release.

  • Add geom_table() a geom for adding a layer containing one or more tables to a plot panel.
  • Add stat_fit_tb() a stat that computes a tidy tabular version of the summary table or ANOVA table from a model fit.
  • Add support for "weight" aesthetic in stat_poly_eq() so that weights can be passed to lm() (fixing bug reported by S.Al-Khalidi).
  • Add support for column selection and renaming to stat_fit_tb().
  • Add new statistic stat_fmt_tb() for formatting of tibbles for addition to plots as tables.
  • Rename stat_quadrat_count() into stat_quadrant_count() (fix miss-spelling).
  • Move debug stats and geoms to package ‘gginnards’.
  • Move plot layer manipulation functions to package ‘gginnards’.
  • Revise vignettes.

NOTE: The new version of ‘ggpmisc’ is on its way to CRAN and should be available for download later in the week.