Title: | Reading ASD Binary Files in R |
---|---|
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. |
Authors: | Pierre Roudier [aut, cre], Etienne Lalibert'{e} [ctb] |
Maintainer: | Pierre Roudier <[email protected]> |
License: | GPL-3 |
Version: | 0.1.2.9000 |
Built: | 2024-10-31 22:07:52 UTC |
Source: | https://github.com/pierreroudier/asdreader |
Utility function that retrieves the location of the sample ASD binary file on disc.
asd_file()
asd_file()
a character vector storing the location of the sample ASD file
fn <- asd_file() fn
fn <- asd_file() fn
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/Viewer.aspx?id=95.
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.
Pierre Roudier
Retrieves the ASD file metadata and stores it in a list.
get_metadata(f)
get_metadata(f)
f |
character, path to ASD file |
a list storing the metadata information in the ASD header, as documented here: http://support.asdi.com/Document/Viewer.aspx?id=95
Pierre Roudier
asd_fn <- asd_file() md <- get_metadata(asd_fn) names(md)
asd_fn <- asd_file() md <- get_metadata(asd_fn) names(md)
Reads either the reflectance, raw DN, or white reference data stored in one or more ASD files.
get_spectra(f, type = "reflectance")
get_spectra(f, type = "reflectance")
f |
a vector of paths to ASD file(s) |
type |
a character vector, which type of spectra to return. |
a matrix of the spectrum contained in the ASD file(s)
Pierre Roudier
# 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')
# 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 binary file. See Details section for more information.
A binary ASD file
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.
# 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
# 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