This package, is a data only package, part of a suite, which has package 'photobiology' at its core. Please visit (https://www.r4photobiology.info/) for more details. For information on plotting spectra, please consult the documentation for package 'ggspectra', and for information on the calculation of summaries and maths operations between spectra, please, consult the documentation for package 'photobiology'.
library(photobiology) library(photobiologyWavebands) library(photobiologySun) library(lubridate) library(ggplot2) library(ggspectra) theme_set(theme_bw())
One collection of spectra,
sun_reference.mspct, contains published reference solar spectra used in model simulations and for calculations. Another collection,
gap.mspct contains a rapid sequence of spectra measured in a forest gap. Another two
time series of simulated hourly spectra
sun_hourly_august.spct, are each in the format of a single spectral object. Other measured spectra is inlcuded, as well as energy- and photon-irradiance time series from broadband sensors.
source_spct member objects in
gap.mspct can be accessed through their
names or through a numeric index. As the numeric indexes are likely to change
with updates to the package, their use is discouraged. Names as character
strings should be used instead. They can also be retrieved with method
We can use a character string as index to extract an individual
Be aware that according to R's rules, using single square brackets will return
source_mspct object possibly of length one. This statement is not equivalent
to the one in the chunk immediately above.
We can subset
sensors.mspct object by indexing with vectors of character strings. More generally one can search for matching names within the collection of spectra.
sun_reference.mspct[grep("AM0", names(sun_reference.mspct), ignore.case = TRUE)]
autoplot() methods for spectra defined in package 'ggspectra' annotated plotting is automatic. The defaults can be easily changed, please see the documentation
in package 'ggspectra'.
ggplot() method for spectra from package 'ggspectra' plus geometries
and statistics from package 'ggplot2' we gain additional control on the design.
ggplot(gap.mspct$spct.1, unit.out = "photon") + geom_line(linetype = "dashed")
In the case of spectral objects containing a time series of spectra, the index variable
UTC containing time and date in universal time coordinates ("UTC") can be used to select and/or highlight individual spectra.
autoplot(subset(sun_hourly_august.spct, UTC %in% ymd_hms(c("2014-08-21 06:30:00", "2014-08-21 09:30:00", "2014-08-21 12:30:00"))), unit.out = "photon") + aes(linetype = factor(UTC)) + labs(linetype = "Day and time (UTC)")
source_spct is a class derived from
source_spct is derived from
tibble::tible which is a compatible reimplementation of
data can be used very easily with any R function.
with also work as expected.
attach(gap.mspct) q_response(spct.1, Red()) detach(gap.mspct)
attach(gap.mspct) with(spct.1, max(w.length)) detach(gap.mspct)
with(gap.mspct, q_response(spct.1, Red()))
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.