Type: | Package |
Title: | Reading ASD Binary Files in R |
Version: | 0.1-3 |
Date: | 2017-09-13 |
Description: | A simple driver that reads binary data created by the ASD Inc. portable spectrometer instruments, such as the FieldSpec (for more information, see http://www.asdi.com/products/fieldspec-spectroradiometers). Spectral data can be extracted from the ASD files as raw (DN), white reference, radiance, or reflectance. Additionally, the metadata information contained in the ASD file header can also be accessed. |
URL: | http://github.com/pierreroudier/asdreader |
BugReports: | http://github.com/pierreroudier/asdreader/issues |
Depends: | R (≥ 3.0) |
License: | GPL-3 |
LazyData: | TRUE |
Collate: | 'get-metadata.r' 'get-spectrum.r' 'asdreader.r' 'data.r' |
RoxygenNote: | 6.0.1 |
NeedsCompilation: | no |
Packaged: | 2017-09-13 02:22:03 UTC; pierre |
Author: | Pierre Roudier [aut, cre], Etienne Lalibert'{e} [ctb] |
Maintainer: | Pierre Roudier <roudierp@landcareresearch.co.nz> |
Repository: | CRAN |
Date/Publication: | 2017-09-13 03:36:36 UTC |
Reads ASD Binary Files in R.
Description
asdreader
implements a simple reader to read spectroscopy data collected using ASD (now PAN Analytics, Inc.) visible near-infrared spectrometers, and stored using the ASD format (which is documented here: http://support.asdi.com/Document/Documents.aspx.
The spectra can be extracted from the ASD file as raw (DN), white reference, radiance, or reflectance. Additionally, the metadata information contained in the ASD file header can also be accessed.
Author(s)
Pierre Roudier
Get location of a sample ASD file
Description
Utility function that retrieves the location of the sample ASD binary file on disc.
Usage
asd_file()
Value
a character vector storing the location of the sample ASD file
Examples
fn <- asd_file()
fn
Reads metadata header from ASD file
Description
Retrieves the ASD file metadata and stores it in a list.
Usage
get_metadata(f)
Arguments
f |
character, path to ASD file |
Value
a list storing the metadata information in the ASD header, as per http://support.asdi.com/Document/Documents.aspx.
Author(s)
Pierre Roudier
Examples
asd_fn <- asd_file()
md <- get_metadata(asd_fn)
names(md)
Reads ASD files
Description
Reads either the reflectance, raw DN, or white reference data stored in one or more ASD files.
Usage
get_spectra(f, type = "reflectance")
Arguments
f |
a vector of paths to ASD file(s) |
type |
a character vector, which type of spectra to return. |
Value
a matrix of the spectrum contained in the ASD file(s)
Author(s)
Pierre Roudier
Examples
# Get the path to the demo file
asd_fn <- asd_file()
print(asd_fn)
# Example with one file name
m1 <- get_spectra(asd_fn)
matplot(t(m1), type = 'l')
# Example with a vector of file names
asd_fns <- rep(asd_fn, times = 4)
print(asd_fns) # (in this case, 4 times the same file)
m2 <- get_spectra(asd_fns)
matplot(t(m2), type = 'l')
Sample ASD file containing a soil spectrum
Description
Sample ASD binary file. See Details section for more information.
Format
A binary ASD file
Details
The spectrum contained in this ASD file was collected on a soil sample from New Zealand using the ASD FieldSpec 3 spectrometer. The file version is ASD 8.0.
Examples
# Access the location of the ASD file using the following command
fn <- asd_file()
fn
# This function is actually just a shorthand for
fn <- system.file("extdata", "soil.asd", package = "asdreader")
fn