read_fmi2mspct {photobiologyInOut}R Documentation

Read multiple solar spectra from a data file.

Description

Read spectral irradiance file as output by Anders Lindors' model based on libRadTrans for hourly simulation, or measured data from FMI's Brewer spectrometer.

Usage

read_fmi2mspct(
  file,
  scale.factor = 0.001,
  geocode = NULL,
  what.measured = NULL,
  how.measured = NULL,
  date.field = 2L,
  time.field = 3L,
  date.format = "ymd",
  time.format = "hms",
  tz = NULL,
  time.shift.min = 0,
  locale = readr::default_locale(),
  .skip = 0,
  .n_max = -1
)

Arguments

file

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

scale.factor

numeric A multiplier to be applied to the spectral irradiance values.

geocode

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

what.measured

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

how.measured

character string, but if NULL or NA the "how.measured" attribute is not set.

date.field, time.field

integer. Word positions in the header line.

date.format

character string. One of "ymd", "ydm", "dmy", or "mdy".

time.format

character string. One of "hms", "hm".

tz

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

time.shift.min

numeric. Time shift with respect to TZ in minutes.

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.

.n_max

Maximum number of records to read.

Value

read_fmi2mspct() returns a source_mspct object containing source_spct objects as members, time.unit attribute set to "second" and when.measured attribute set to the date-time values extracted from the file body.

Note

See read_table for details of acceptable values for file. Individual spectra are names based on time and date in ISO format, at the time zone given by tz but the time shift subtracted. Say for times expressed in headers at UTC + 120 min, we use tz = UTC and time.shift.min = 120 to convert times to UTC. This is different from using tz = EET, which is not invariant through the course of the year because of daylight saving time. Local time zones is not necessarily consistent across years because of changes in legislation. In contrast UTC is more consistent, making it preferable for time series.


[Package photobiologyInOut version 0.4.27 Index]