Package 'asdreader'

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

Help Index


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 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/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.

Author(s)

Pierre Roudier


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 documented here: http://support.asdi.com/Document/Viewer.aspx?id=95

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. "reflectance", "raw", "white_reference" are currently supported

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