Reads and parses the header of processed data text files output by Jaz instruments extracting the spectral data from the body of the file and the metadata, including time and date of measurement from the header. Jaz modular spectrometers were manufactured by Ocean Optics.
Usage
read_oo_jazirrad(
file,
date = NULL,
geocode = NULL,
label = NULL,
tz = NULL,
locale = readr::default_locale(),
unit.in = "energy"
)
read_oo_jazpc(
file,
qty.in = "Tpc",
Tfr.type = c("total", "internal"),
Rfr.type = c("total", "specular"),
date = NULL,
geocode = NULL,
label = NULL,
tz = NULL,
locale = readr::default_locale()
)
read_oo_jazdata(
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
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
lonandlat, and optionallyaddressused to set attribute"where.measured".- label
character string to which to set the
"what.measured"attribute. IfNULLthe value ofbasename(file)is used, and ifNAthe"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
localeto 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.- unit.in
character One of "energy", "photon" (or "quantum"), for data in uW cm-2 nm-1 and umol cm-2 nm-1.
- qty.in
character string, one of "Tpc" (spectral transmittance, %), "A" (spectral absorbance), or "Rpc" (spectral reflectance, %).
- Tfr.type
character string, either "total" or "internal".
- Rfr.type
character string, either "total" or "specular".
Details
Function read_oo_jazirrad can read processed irradiance
output files. Function read_oo_jazpc can read processed transmittance
and reflectance output files (expressed as %s). Function
read_oo_jazdata can read raw-counts data.
Note
Although the parameter is called date a date time is accepted
and expected. Time resolution is < 1 s if seconds are entered with a
decimal fraction, such as "2021-10-05 10:10:10.1234".
Examples
file.name <-
system.file("extdata", "spectrum.jaz",
package = "photobiologyInOut", mustWork = TRUE)
jaz.filter_spct <- read_oo_jazpc(file = file.name)
#> Found 127/2048 off-range 'Tfr' values [-47.00..47.00] instead of [0..1]
jaz.filter_spct
#> Object: filter_spct [2,048 x 2]
#> Wavelength range 190.3139-892.61151 nm, step 0.296936-0.381607 nm
#> Label: File: spectrum.jaz
#> Measured on 2016-04-25 12:49:02 UTC
#> Rfr (/1): NA, thickness (mm): NA, attenuation mode: NA.
#> Variables:
#> w.length: Wavelength [nm]
#> Tfr: Total spectral transmittance [/1]
#> --
#> # A tibble: 2,048 × 2
#> w.length Tfr
#> <dbl> <dbl>
#> 1 190. 0
#> 2 191. 0
#> 3 191. 4.00
#> 4 191. -2.11
#> 5 192. -3
#> 6 192. -47.0
#> 7 193. 0.400
#> 8 193. -0.0714
#> 9 193. -0.533
#> 10 194. 0.361
#> # ℹ 2,038 more rows
getWhenMeasured(jaz.filter_spct)
#> [1] "2016-04-25 12:49:02 UTC"
getWhatMeasured(jaz.filter_spct)
#> [1] "File: spectrum.jaz"
cat(comment(jaz.filter_spct))
#> Ocean Optics Jaz file 'spectrum.jaz' imported as Tpc on 2025-10-02 21:42:54.127852 UTC
#> Jaz Data File
#> ++++++++++++++++++++++++++++++++++++
#> Date: Mon Apr 25 12:49:02 2016
#> User: jaz
#> Dark Spectrum Present: Yes
#> Reference Spectrum Present: Yes
#> Processed Spectrum Present: Yes
#> Spectrometers: JAZA3098
#> Integration Time (usec): 748000 (JAZA3098)
#> Spectra Averaged: 1 (JAZA3098)
#> Boxcar Smoothing: 0 (JAZA3098)
#> Correct for Electrical Dark: No (JAZA3098)
#> Strobe/Lamp Enabled: Yes (JAZA3098)
#> Correct for Detector Non-linearity: No (JAZA3098)
#> Correct for Stray Light: No (JAZA3098)
#> Number of Pixels in Processed Spectrum: 2048
file.name <-
system.file("extdata", "spectrum.JazIrrad",
package = "photobiologyInOut", mustWork = TRUE)
jaz.source_spct <- read_oo_jazirrad(file = file.name, unit.in = "energy")
jaz.source_spct
#> Object: source_spct [2,048 x 2]
#> Wavelength range 188.82523-1033.1483 nm, step 0.357056-0.459625 nm
#> Label: File: spectrum.JazIrrad
#> Measured on 2015-02-03 09:44:41 UTC
#> Variables:
#> w.length: Wavelength [nm]
#> s.e.irrad: Spectral energy irradiance [W m-2 nm-1]
#> --
#> # A tibble: 2,048 × 2
#> w.length s.e.irrad
#> <dbl> <dbl>
#> 1 189. 0
#> 2 189. 0
#> 3 190. 0
#> 4 190. 0
#> 5 191. 0
#> 6 191. 0
#> 7 192. 0
#> 8 192. 0
#> 9 193. 0
#> 10 193. 0
#> # ℹ 2,038 more rows
getWhenMeasured(jaz.source_spct)
#> [1] "2015-02-03 09:44:41 UTC"
getWhatMeasured(jaz.source_spct)
#> [1] "File: spectrum.JazIrrad"
cat(comment(jaz.source_spct))
#> Ocean Optics Jaz irradiance file 'spectrum.JazIrrad' imported on 2025-10-02 21:42:54.171912 UTC
#> Jaz Absolute Irradiance File
#> ++++++++++++++++++++++++++++++++++++
#> Date: Tue Feb 03 09:44:41 2015
#> User: jaz
#> Dark Spectrum Present: Yes
#> Processed Spectrum Present: Yes
#> Spectrometers: JAZA1065
#> Integration Time (usec): 193000 (JAZA1065)
#> Spectra Averaged: 3 (JAZA1065)
#> Boxcar Smoothing: 5 (JAZA1065)
#> Correct for Electrical Dark: Yes (JAZA1065)
#> Strobe/Lamp Enabled: No (JAZA1065)
#> Correct for Detector Non-linearity: Yes (JAZA1065)
#> Correct for Stray Light: No (JAZA1065)
#> Number of Pixels in Processed Spectrum: 2048
#> Fiber (micron): 3900
#> Collection Area: 0.119459
#> Int. Sphere: No
q_irrad(jaz.source_spct, waveband(c(400, 700)), scale.factor = 1e6) # mol -> umol
#> Q_range.400.700
#> 47.42623
#> attr(,"time.unit")
#> [1] "second"
#> attr(,"radiation.unit")
#> [1] "total photon irradiance"
