read_ASTER_txt: Read File downloaded from ASTER data base.

View source: R/read-aster-file.r

read_ASTER_txtR Documentation

Read File downloaded from ASTER data base.

Description

Reads and parses the header of a test file as available through the ASTER reflectance database. The Name field is retrieved and copied to attribute "what.measured". The header of the file is preserved as a comment.

Usage

read_ASTER_txt(
  file,
  date = NULL,
  geocode = NULL,
  label = NULL,
  tz = NULL,
  locale = readr::default_locale(),
  npixels = Inf
)

Arguments

file

character string

date

a POSIXct object to use to set the "when.measured" attribute. If NULL, the default, the date is extracted from the file header.

geocode

A data frame with columns lon and lat used to set attribute "where.measured".

label

character string, but if NULL the value of file is used, and if NA the "what.measured" attribute is not set.

tz

character Ignored.

locale

The locale controls defaults that vary from place to place. The default locale is US-centric (like R), but you can use locale to create your own locale that controls things like the default time zone, encoding, decimal mark, big mark, and day/month names.

npixels

integer Number of pixels in spectral data.

Value

A raw_spct object.

Note

The header in these files has metadata information, but mostly on the origin of the data. For a date and/or geocode are to be added to the return object it must be supplied by the user. as well as the date-time. Some metadata is extracted and added as attributes, while the whole header is copied to the comment attribute.

References

https://speclib.jpl.nasa.gov

Baldridge, A.; Hook, S.; Grove, C. & Rivera, G. (2009) The ASTER spectral library version 2.0. Remote Sensing of Environment. 113, 711-715

Examples


 file.name <- 
   system.file("extdata", "drygrass-spectrum.txt", 
               package = "photobiologyInOut", mustWork = TRUE)
                
 fred.spct <- read_ASTER_txt(file = file.name, npixels = Inf)
 
 fred.spct
 getWhatMeasured(fred.spct)
 cat(comment(fred.spct))
 

photobiologyInOut documentation built on July 26, 2023, 5:15 p.m.