read_fmi_cum: Read daily cummulated solar spectrum data file(s).

View source: R/read-fmi-cum.R

read_fmi_cumR Documentation

Read daily cummulated solar spectrum data file(s).

Description

Read one or more cumulated daily spectral irradiance file as output by Anders Lindors' model based on libRadTrans. Dates are read from the file header and parsed with the function suplied as date.f.

Usage

read_fmi_cum(
  file,
  date = NULL,
  geocode = NULL,
  label = NULL,
  tz = "UTC",
  locale = readr::default_locale(),
  .skip = 3,
  .n_max = -1,
  .date.f = lubridate::ymd
)

read_m_fmi_cum(
  files,
  date = NULL,
  geocode = NULL,
  label = NULL,
  tz = "UTC",
  .skip = 3,
  .n_max = -1,
  .date.f = lubridate::ymd
)

Arguments

file

Either a path to a file, a connection, or literal data (either a single string or a raw vector).

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.

.skip

Number of lines to skip before reading data—i.e. the number of rows in the header.

.n_max

Maximum number of records to read.

.date.f

A function for extracting a date-time from the file header passed as charecter sring to its first argument and which returns a POSIXct object.

files

list or vector of paths each one with the same requirements as described for argument file.

Value

read_fmi_cum() returns a source_spct object with time.unit attribute set to "day" and when.measured attribute set to the date-time extracted from the header at the top of the read file.

read_m_fmi_cum returns a source_mspct containing one source_spct object for each one of the multiple files read.

Note

See read_table for details of acceptable values for file.

Examples


file.name <- system.file("extdata", "2014-08-21_cum.hel", 
                         package = "photobiologyInOut", mustWork = TRUE)
fmi.spct <- read_fmi_cum(file = file.name)
  

photobiologyInOut documentation built on July 26, 2023, 5:15 p.m.