Reads and parses the header of a processed data file as output by the PC program to extract the time and date fields and a user label if present, and then imports wavelengths and spectral energy irradiance values.
Usage
read_macam_dta(
file,
date = NULL,
geocode = NULL,
label = NULL,
tz = NULL,
locale = readr::default_locale()
)Arguments
- file
character string
- date
a
POSIXctobject to use to set the"when.measured"attribute. IfNULL, the default, the date is extracted from the file header.- geocode
A data frame with columns
lonandlatused to set attribute"where.measured".- label
character string, but if
NULLthe value offileis used, and ifNAthe "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
localeto create your own locale that controls things like the default time zone, encoding, decimal mark, big mark, and day/month names.
Examples
file.name <-
system.file("extdata", "spectrum.DTA",
package = "photobiologyInOut", mustWork = TRUE)
macam.spct <- read_macam_dta(file = file.name)
macam.spct
#> Object: source_spct [151 x 2]
#> Wavelength range 250-400 nm, step 1 nm
#> Label: File: spectrum.DTA
#> Measured on 1997-05-19 17:44:58 UTC
#> Variables:
#> w.length: Wavelength [nm]
#> s.e.irrad: Spectral energy irradiance [W m-2 nm-1]
#> --
#> # A tibble: 151 × 2
#> w.length s.e.irrad
#> <dbl> <dbl>
#> 1 250 0
#> 2 251 0
#> 3 252 0
#> 4 253 0
#> 5 254 0
#> 6 255 0
#> 7 256 0
#> 8 257 0
#> 9 258 0
#> 10 259 0
#> # ℹ 141 more rows
getWhenMeasured(macam.spct)
#> [1] "1997-05-19 17:44:58 UTC"
getWhatMeasured(macam.spct)
#> [1] "File: spectrum.DTA"
cat(comment(macam.spct))
#> MACAM file 'spectrum.DTA' imported on 2025-10-02 21:42:53.710159 UTC
#> @19/5/1997
#> @17:44:58
#> #No
#> Title
