Skip to contents

Import spectral irradiance data saved to a text by LI-COR's LI-180 spectroradiometer into a source_spct object.

Usage

read_li180_txt(
  file,
  date = NULL,
  geocode = NULL,
  label = NULL,
  tz = NULL,
  locale = readr::default_locale(),
  s.qty = "s.e.irrad"
)

read_m_li180_txt(
  files,
  date = NULL,
  geocode = NULL,
  label = NULL,
  tz = Sys.timezone(),
  locale = readr::default_locale(),
  s.qty = NULL
)

Arguments

file

Path to file as a character string.

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 used to set attribute "where.measured".

label

character string, but if NULL the value of file is used, and if NA the "what.measured" attribute is not set.

tz

character Time zone used for interpreting times saved in the file header.

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.

s.qty

character The name of the spectral quantity to be read. One of "s.e.irrad" or "s.q.irrad".

files

A list or vector of character strings.

Value

read_li180_txt() returns a source_spct object with time.unit attribute set to "second" and when.measured attribute set to the date-time extracted from the file header, or supplied by the user. Spectrometer model, serial number and integration time are stored in attributes. The whole file header is saved as attribute file.header while the footer is discarded.

Function read_m_licor_espd() returns a source_mspct object containing one spectrum per file read.

Details

Function read_li180_txt() reads and parses the header of a data file as output by the LI-180 spectrometer to extract the whole header remark field and also decode whether data is in photon or energy based units.

The LI-180 spectroradiometer stores little information about the instrument and its settings, possibly because they cannot be altered by the user or configured. The length of the file header does not seem to be fixed, so the start of the spectral data is detected by searching for "380nm", the shortest wavelength in the data.

The LI-COR LI-180 is a modern array-detector-based instrument released in year 2020 distinct from the LI-COR LI-1800 scanning spectrometer released in the 1980's (see read_li1800_prn().

Function read_m_licor_espd() calls red_licor_espd() for each file in files. See read.table for a description of valid arguments for files.

Warning!

This function has been tested only with files saved by a LI-180 with a specific firmware version. Use with extreme care as there is no warranty that the data saved from your own instrument will be imported correctly.

References

LI-COR Biosciences, Environmental. https://www.licor.com/env/

Examples


  file.name <- 
    system.file("extdata", "licor-li180-irrad.txt", 
                package = "photobiologyInOut", mustWork = TRUE)
                
  licor180.spct <- read_li180_txt(file = file.name)
  
  licor180.spct
#> Object: source_spct [401 x 2]
#> Wavelength range 380-780 nm, step 1 nm 
#> Label: File: licor-li180-irrad.txt 
#> Measured on 2021-03-02 09:24:26 UTC 
#> Variables:
#>  w.length: Wavelength [nm]
#>  s.e.irrad: Spectral energy irradiance [W m-2 nm-1] 
#> --
#> # A tibble: 401 × 2
#>    w.length s.e.irrad
#>       <dbl>     <dbl>
#>  1      380    0.0275
#>  2      381    0.0280
#>  3      382    0.0285
#>  4      383    0.0287
#>  5      384    0.0289
#>  6      385    0.0298
#>  7      386    0.0306
#>  8      387    0.0311
#>  9      388    0.0318
#> 10      389    0.0326
#> # ℹ 391 more rows
  getWhenMeasured(licor180.spct)
#> [1] "2021-03-02 09:24:26 UTC"
  getWhatMeasured(licor180.spct)
#> [1] "File: licor-li180-irrad.txt"
  cat(comment(licor180.spct))
#> LICOR LI-180 file 'licor-li180-irrad.txt' imported on 2026-11-29 13:39:14.74536 UTC