Learn R Programming

photobiologyInOut (version 0.4.32)

read_oo_ssirrad: Read File Saved by Ocean Optics' SpectraSuite.

Description

Reads the spectral data and in addition parses the header of a energy irradiance data file as output by SpectraSuite. SpectraSuite is a program from Ocean Optics used to measure UV, visible and NIR radiation with array spectrometers from the same company. OceanView replaces the no longer supported SpectraSuite program.

Usage

read_oo_ssirrad(
  file,
  date = NULL,
  geocode = NULL,
  label = NULL,
  tz = NULL,
  locale = readr::default_locale(),
  range = NULL
)

read_oo_ssdata( file, date = NULL, geocode = NULL, label = NULL, tz = NULL, locale = readr::default_locale() )

Value

A raw_spct object.

Arguments

file

character string Path to the file to be read, following R's use of forward slashes as separator for folder names.

date

a POSIXct object to use to set the "when.measured" attribute. If NULL, the default, the date is extracted from the file header.

geocode

A data frame with columns lon and lat, and optionally address used to set attribute "where.measured".

label

character string to which to set the "what.measured" attribute. If NULL the value of basename(file) is used, and if NA the "what.measured" attribute is not set.

tz

character A time zone recognized by R. If NULL, the default, it is extracted from `locale`.

locale

The locale controls defaults that vary from place to place. The default locale is US-centric (like R), but you can use locale to create your own locale that controls things like the default time zone, encoding, decimal mark, big mark, and day/month names. Its value must match that used to write the imported file, which is not necessarily the default one or the local one.

range

a numeric vector of length two, or any other object for which function range() will return a range of wavelengths expressed in nanometres.

Details

The header of the file is first decoded and parsed to extract the time of data acquisition and serial number of the spectrometer, and to locate the start of the spectral data. The fields are located by name. The spectral irradiance is re-expressed in \(W m^{-2} nm^{-1}\) and returned as an object of class source_spct with metadata stored in attributes when.measured, what.measured, and how.measured set to values extracted from the header. The value stored in the how.measured attribute includes the User: and Serial Number: values extracted from the file header. If an argument is passed to parameter geocode, its value is saved in attribute where.measured. The file header in whole is copied to attribute file.header. The object's comment always gives a text that includes the file name, time of import, function name and the version of packages 'photobiology' and 'photobiologyInOut' used.

References

https://www.oceanoptics.com/

Examples

Run this code

 file.name <- 
   system.file("extdata", "spectrum.SSIrrad", 
               package = "photobiologyInOut", mustWork = TRUE)
                
 ooss.spct <- read_oo_ssirrad(file = file.name)
 
 ooss.spct
 getWhenMeasured(ooss.spct)
 getWhatMeasured(ooss.spct)
 getHowMeasured(ooss.spct)
 cat(comment(ooss.spct))

Run the code above in your browser using DataLab