Read header lines with non-spectroscopic information of OceanView (version 1.5.2) file.

read.OceanView.header(
  file = NULL,
  dec = ".",
  n = 17,
  software = "OceanView",
  version_ = "1.5.2",
  software_info = paste(software, version_),
  last_headerline_text = ">>>>>Begin Spectral Data<<<<<",
  text
)

Arguments

file

(string) A name of OcenView file .

dec

("." | ",") The character used in the file for decimal points , e.g. period (".") or comma (",").

n

(integer) Number of header lines to be scanned . Default is 17. These lines include the header line indicated in last_headerline_text.

software

("OceanView" | "OOIBase32") Name of software, that created the file.

version_

("1.5.2" | "1.5.0" | string) A version of OceanView file. Curently supported versions are "1.5.2" (or newer) and "1.5.0".

software_info

(string) A combination of software and its version_.

last_headerline_text

(string) A string, that indicates the last header line. Default is ">>>>>Begin Spectral Data<<<<<".

text

(strings) Text of header as if it was read with function readLines. If text is provided, file is ignored.

Value

A dataframe with information, extracted from headerlines.

Author

Vilmantas Gegzna

Examples


# Read from file: -------------------------------------------

# \donttest{
if (FALSE) {
 read.OceanView.header("MySpectra.txt")
}# }

# Read as text: ---------------------------------------------
header <- c(
     "Data from MySpectra.txt Node",
     "",
     "Date: Fri Jan 15 16:15:16 GMT 2014",
     "User: Scientist_1",
     "Spectrometer: USB2E2321",
     "Trigger mode: 4",
     "Integration Time (sec): 1.000000E1",
     "Scans to average: 1",
     "Electric dark correction enabled: true",
     "Nonlinearity correction enabled: true",
     "Boxcar width: 0",
     "XAxis mode: Wavelengths",
     "Number of Pixels in Spectrum: 2048",
     ">>>>>Begin Spectral Data<<<<<"
)

DF <- read.OceanView.header(text = header)

class(DF)
#> [1] "data.frame"
print(DF)
#>          User Spectrometer                         Date Trigger_mode
#> 1 Scientist_1    USB2E2321 Fri Jan 15 16:15:16 GMT 2014            4
#>   Integration_time Integration_time_Units Scans_averaged
#> 1               10                    sec              1
#>   Electric_dark_correction Nonlinearity_correction Boxcar_width  XAxis_mode
#> 1                     TRUE                    TRUE            0 Wavelengths
#>   n_pixels_in_spectrum     Data_from last_headerline   software_info
#> 1                 2048 MySpectra.txt              14 OceanView 1.5.2


# Examples of file headerline formats: -----------------------

## An example of header lines in OcenView 1.5.2:

#    Data from MySpectra.txt Node
#
#    Date: Fri Jan 15 16:15:16 GMT 2014
#    User: Scientist_1
#    Spectrometer: USB2E2321
#    Trigger mode: 4
#    Integration Time (sec): 1.000000E1
#    Scans to average: 1
#    Electric dark correction enabled: true
#    Nonlinearity correction enabled: true
#    Boxcar width: 0
#    XAxis mode: Wavelengths
#    Number of Pixels in Spectrum: 2048
#    >>>>>Begin Spectral Data<<<<<

## An example of header lines in OcenView 1.5.0:

#    Data from MySpectra.txt Node
#
#    Date: Fri Jan 15 16:15:16 GMT 2016
#    User: Scientist_1
#    Spectrometer: USB2E2321
#    Autoset integration time: false
#    Trigger mode: 4
#    Integration Time (sec): 1.000000E1
#    Scans to average: 1
#    Electric dark correction enabled: true
#    Nonlinearity correction enabled: true
#    Boxcar width: 0
#    XAxis mode: Wavelengths
#    Stop averaging: false
#    Number of Pixels in Spectrum: 2048
#    >>>>>Begin Spectral Data<<<<<