Skip to contents

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()
)

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.

Value

A raw_spct object.

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.

Examples


 file.name <- 
   system.file("extdata", "spectrum.SSIrrad", 
               package = "photobiologyInOut", mustWork = TRUE)
                
 ooss.spct <- read_oo_ssirrad(file = file.name)
 
 ooss.spct
#> Object: source_spct [1,044 x 2]
#> Wavelength range 199.08-998.61 nm, step 0.72-0.81 nm 
#> Label: File: spectrum.SSIrrad 
#> Measured on 2013-05-06 15:13:40 UTC 
#> Variables:
#>  w.length: Wavelength [nm]
#>  s.e.irrad: Spectral energy irradiance [W m-2 nm-1] 
#> --
#> # A tibble: 1,044 × 2
#>    w.length s.e.irrad
#>       <dbl>     <dbl>
#>  1     199.     0    
#>  2     200.     0    
#>  3     201.     0    
#>  4     202.     1.37 
#>  5     202.     1.25 
#>  6     203.     1.13 
#>  7     204.     1.11 
#>  8     205.     1.09 
#>  9     206.     0.902
#> 10     206.     0.739
#> # ℹ 1,034 more rows
 getWhenMeasured(ooss.spct)
#> [1] "2013-05-06 15:13:40 UTC"
 getWhatMeasured(ooss.spct)
#> [1] "File: spectrum.SSIrrad"
 getHowMeasured(ooss.spct)
#> [1] "Measured by user User with Ocean Optics spectrometer with s.n. QEB1523 and SpectraSuite software."
 cat(comment(ooss.spct))
#> Ocean Optics SpectraSuite irradiance file 'spectrum.SSIrrad' imported on 2025-10-02 21:42:56 UTC with function 'read_oo_ssirrad()'.
#> R packages 'photobiologyInOut' 0.4.32.9000 and 'photobiology' 0.14.0 were used.