Retrieve the raw data from the ENVI file, simultaneously read the header file and build a Brick containing all the layers (spectral bands) of the hyperspectral image. Optionally, do pre-processing steps on row data, such as: radiometric correction using the Dark Object Subtraction (DOS) method, set up the spatial extents using the coordinates of a reference layer and inputs of the camera, convert the row values (digital numbers) to spectral features such as radiance or reflectance.

buildBrick(
  path,
  path_hdr = sub(".dat", ".hdr", path, fixed = TRUE),
  hFOV = NULL,
  vFOV = NULL,
  height = NULL,
  ref_layer = 1,
  spectral_feature = c("raw", "radiance", "reflectance"),
  reflectance_method = c("irradiance", "white_panel"),
  dark_path = NULL,
  dark_quantile = 0.25,
  white_path = NULL
)

Arguments

path

A character giving the path for the ENVI file (.dat).

path_hdr

(Optional, character) The path for the header file (.hdr).

hFOV

(Optional, numeric) The horizontal Field Of View (in degrees) of the camera. Note: this is used to calculate the spatial extent. See Details.

vFOV

(Optional, numeric) The vertical Field Of View (in degrees) of the camera. Note: this is used to calculate the spatial extent. See Details.

height

(Optional, numeric) The flight altitude (in meters). Note: this is be used to calculate the spatial extent. See Details.

ref_layer

(Optional, integer) The reference layer (spectral band) to be used to set up the geographic location of the image.

spectral_feature

A character giving the name of the spectral feature to be loaded. Must be one of the three: "raw" (digital numbers), "radiance", "reflectance". See Details.

reflectance_method

A character for selecting the method to calculate the reflectance values. It must be one of the following: "irradiance" or "white_panel". See Details.

dark_path

(Optional) A character giving the path for the ENVI file containing the dark reference raw values, a.k.a. noisy energy, for DOS calibration. See Details.

dark_quantile

A numeric value used to calculate the quantile of the dark reference raw values of each spectral band. Default is 0.25. This will be used for the DOS radiometric correction.

white_path

(Optional) A character giving the path for the ENVI file containing the white panel. See Details.

Value

A RasterBrick object (from the package raster).

Details

The geographical coordinates (xy) registered in the header file are automatically retrieved. If the arguments hFOV, vFOV and height are passed, buildBrick will automatically compute the UTM zone and the spatial extent, and set up the coordinate reference system.

"radiance" is obtained by multiplying the raw values of each spectral band by the respective "gain" values registered in the header file (if available).

If "reflectance" is passed as value for the argument spectral_feature, then the value of the next argument, reflectance_method, will be used to calculate the reflectance values. The "irradiance" method consists of using the solar irradiance values registered in the header file (if available) at each spectral band as reference for the radiance values reaching the camera sensor. If "white_panel" is chosen, then the path for the ENVI file containing the image of the white panel must be passed as value for the respective argument. Note that buildBrick will consider value of the white panel as the maximum.

Make sure that the header file (.hdr) has the same name as the ENVI (.dat) file when pointing them at the arguments dark_path or white_path.

See also

Examples

# Point to an ENVI data
path <- system.file('exdata', 'obory.dat', package = 'hyperbrick')
# First, let's check the header file
# There are 81 bands. First two are noisy.
# Irradiance is available.
path_hdr <- system.file('exdata', 'obory.hdr', package = 'hyperbrick')
readLines(path_hdr)
#>  [1] "ENVI"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
#>  [2] "description = package hyperbrick"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
#>  [3] "wavelength units = nm"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
#>  [4] "samples = 128"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
#>  [5] "lines = 128"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
#>  [6] "file type = ENVI"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
#>  [7] "interleave = BSQ"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
#>  [8] "byte order = 0"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
#>  [9] "data type = 3"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
#> [10] "bands = 81"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
#> [11] "acquisition mode = 12"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
#> [12] "acquisition time = 2025-11-14T23:10:19.283359000+02:00"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
#> [13] "wavelength = {500.0,505.0,510.0,515.0,520.0,525.0,530.0,535.0,540.0,545.0,550.0,555.0,560.0,565.0,570.0,575.0,580.0,585.0,590.0,595.0,600.0,605.0,610.0,615.0,620.0,625.0,630.0,635.0,640.0,645.0,650.0,655.0,660.0,665.0,670.0,675.0,680.0,685.0,690.0,695.0,700.0,705.0,710.0,715.0,720.0,725.0,730.0,735.0,740.0,745.0,750.0,755.0,760.0,765.0,770.0,775.0,780.0,785.0,790.0,795.0,800.0,805.0,810.0,815.0,820.0,825.0,830.0,835.0,840.0,845.0,850.0,855.0,860.0,865.0,870.0,875.0,880.0,885.0,890.0,895.0,900.0}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
#> [14] "fwhm = {0.0,0.0,8.0,8.0,9.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,9.0,9.0,9.0,9.0,8.0,10.0,8.0,11.0,8.0,8.0,9.0,8.0,8.0,9.0,8.0,8.0,8.0,8.0,6.0,6.0,6.0,6.0,6.0,6.0,6.0,6.0,6.0,6.0,6.0,6.0,6.0,6.0,6.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,11.0,11.0,11.0,11.0,11.0,11.0,11.0,11.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
#> [15] "data gain values = {0.000000,0.000000,0.001086,0.001104,0.001147,0.001175,0.001160,0.001120,0.001137,0.001155,0.001152,0.001147,0.001168,0.001207,0.001238,0.001248,0.001248,0.001277,0.001338,0.001372,0.001362,0.001349,0.001097,0.001131,0.001182,0.001253,0.001413,0.001726,0.001977,0.002439,0.001997,0.001656,0.001605,0.001633,0.001698,0.001758,0.001776,0.001768,0.001740,0.001717,0.002088,0.002225,0.002339,0.002429,0.002459,0.002431,0.002388,0.002362,0.002390,0.002473,0.002576,0.002645,0.002670,0.002656,0.002618,0.002066,0.002090,0.002145,0.002222,0.002324,0.002426,0.002511,0.002572,0.002586,0.001856,0.001868,0.001911,0.001993,0.002105,0.002230,0.002338,0.002419,0.002478,0.002522,0.002564,0.002600,0.002653,0.002728,0.002836,0.002964,0.003128}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
#> [16] "solar irradiance = {175.990097,175.990097,174.207916,174.207916,174.207916,174.801971,174.801971,174.801971,174.801971,174.801971,174.801971,174.801971,174.603958,174.603958,174.603958,174.603958,174.603958,174.603958,174.603958,174.603958,174.554443,174.554443,174.702957,174.702957,174.702957,174.702957,174.702957,174.702957,174.702957,174.702957,174.207916,174.207916,174.207916,174.207916,174.207916,174.207916,174.207916,174.207916,174.801971,174.801971,174.851471,174.851471,174.851471,174.851471,174.851471,174.851471,174.851471,174.851471,175.544540,175.544540,175.544540,175.544540,175.544540,175.544540,175.544540,174.603958,174.603958,174.554443,174.554443,174.554443,174.554443,174.554443,174.554443,174.554443,174.851471,174.851471,174.851471,174.851471,174.851471,174.851471,175.049500,175.049500,175.049500,175.049500,175.049500,175.049500,175.049500,175.049500,175.049500,175.049500,174.702957}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
#> [17] "geo points = {1.0000,1.0000,nan,nan}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
#> [18] "sequence order = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
#> [19] "order = {0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
#> [20] "timestamp = {0,9151000,893626000,920351000,946659000,987048000,1014019000,1040990000,1054476000,1067961000,1081446000,1094932000,1108417000,1121903000,1135388000,1148874000,1162359000,1175844000,1202815000,1229786000,1256757000,1297213000,734110000,760419000,773572000,786935000,800297000,813660000,827021000,840385000,853538000,866902000,880263000,893626000,906988000,933505000,960078000,973563000,1000534000,1027505000,1392310000,1405466000,1418827000,1432190000,1445551000,1458915000,1472276000,1485640000,1499001000,1512364000,1525726000,1539089000,1552451000,1565814000,1579175000,1189330000,1216301000,1243272000,1270243000,1283728000,1310699000,1324184000,1337670000,1351155000,520520000,533674000,547037000,560399000,573762000,587123000,600487000,613848000,627211000,640573000,653936000,667297000,680660000,694022000,707385000,720747000,747264000}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
#> [21] "frame counter = {14256,14257,14287,14289,14291,14294,14296,14298,14299,14300,14301,14302,14303,14304,14305,14306,14307,14308,14310,14312,14314,14317,14274,14276,14277,14278,14279,14280,14281,14282,14283,14284,14285,14286,14288,14290,14292,14293,14295,14297,14322,14323,14324,14325,14326,14327,14328,14329,14330,14331,14332,14333,14334,14335,14336,14309,14311,14313,14315,14316,14318,14319,14320,14321,14258,14259,14260,14261,14262,14263,14264,14265,14266,14267,14268,14269,14270,14271,14272,14273,14275}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
#> [22] "integration time = {8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
#> [23] "gps = {\"$GNRMC,111154,A,5204.5354,N,02111.1317,E,0.7529,339.131,291021,,*25\",\"$GNRMC,111154,A,5204.5354,N,02111.1317,E,0.7529,339.131,291021,,*25\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111154,A,5204.5354,N,02111.1317,E,0.7529,339.131,291021,,*25\",\"$GNRMC,111154,A,5204.5354,N,02111.1317,E,0.7529,339.131,291021,,*25\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\",\"$GNRMC,111158,A,5204.5354,N,02111.1317,E,0.0451,40.385,291021,,*10\"}"
#> [24] "acceleration = {\"0.154882,1.039324,-9.566206\",\"0.154882,1.039324,-9.566206\",\"-0.677534,-1.455532,-9.306076\",\"0.455078,3.305146,-9.096776\",\"0.455078,3.305146,-9.096776\",\"-0.913744,-0.420394,-9.022026\",\"-0.913744,-0.420394,-9.022026\",\"-0.913744,-0.420394,-9.022026\",\"-0.913744,-0.420394,-9.022026\",\"-0.273286,0.576472,-9.485476\",\"-0.273286,0.576472,-9.485476\",\"-0.273286,0.576472,-9.485476\",\"-0.273286,0.576472,-9.485476\",\"-0.273286,0.576472,-9.485476\",\"-0.273286,0.576472,-9.485476\",\"1.219322,2.292732,-10.122944\",\"1.219322,2.292732,-10.122944\",\"1.219322,2.292732,-10.122944\",\"1.219322,2.292732,-10.122944\",\"0.160862,0.669760,-9.301890\",\"0.160862,0.669760,-9.301890\",\"0.160862,0.669760,-9.301890\",\"-0.084318,-0.226642,-9.795838\",\"2.686216,5.575154,-10.353174\",\"2.686216,5.575154,-10.353174\",\"2.686216,5.575154,-10.353174\",\"2.686216,5.575154,-10.353174\",\"2.686216,5.575154,-10.353174\",\"2.686216,5.575154,-10.353174\",\"-0.677534,-1.455532,-9.306076\",\"-0.677534,-1.455532,-9.306076\",\"-0.677534,-1.455532,-9.306076\",\"-0.677534,-1.455532,-9.306076\",\"-0.677534,-1.455532,-9.306076\",\"-0.677534,-1.455532,-9.306076\",\"0.455078,3.305146,-9.096776\",\"0.455078,3.305146,-9.096776\",\"0.455078,3.305146,-9.096776\",\"-0.913744,-0.420394,-9.022026\",\"-0.913744,-0.420394,-9.022026\",\"-1.079390,-1.016002,-9.765340\",\"0.831220,1.953068,-10.296962\",\"0.831220,1.953068,-10.296962\",\"0.831220,1.953068,-10.296962\",\"0.831220,1.953068,-10.296962\",\"-0.939458,-0.458068,-10.042214\",\"-0.939458,-0.458068,-10.042214\",\"-0.939458,-0.458068,-10.042214\",\"-0.939458,-0.458068,-10.042214\",\"-0.939458,-0.458068,-10.042214\",\"-0.939458,-0.458068,-10.042214\",\"-1.040520,-1.313208,-10.254504\",\"-1.040520,-1.313208,-10.254504\",\"-1.040520,-1.313208,-10.254504\",\"-1.040520,-1.313208,-10.254504\",\"1.219322,2.292732,-10.122944\",\"1.219322,2.292732,-10.122944\",\"0.160862,0.669760,-9.301890\",\"0.160862,0.669760,-9.301890\",\"0.160862,0.669760,-9.301890\",\"-1.079390,-1.016002,-9.765340\",\"-1.079390,-1.016002,-9.765340\",\"-1.079390,-1.016002,-9.765340\",\"-1.079390,-1.016002,-9.765340\",\"0.507104,2.054130,-9.428068\",\"0.507104,2.054130,-9.428068\",\"0.998660,2.834520,-10.378290\",\"0.998660,2.834520,-10.378290\",\"0.998660,2.834520,-10.378290\",\"0.998660,2.834520,-10.378290\",\"0.817466,1.422044,-10.411180\",\"0.817466,1.422044,-10.411180\",\"0.817466,1.422044,-10.411180\",\"0.817466,1.422044,-10.411180\",\"0.817466,1.422044,-10.411180\",\"0.817466,1.422044,-10.411180\",\"-0.084318,-0.226642,-9.795838\",\"-0.084318,-0.226642,-9.795838\",\"-0.084318,-0.226642,-9.795838\",\"-0.084318,-0.226642,-9.795838\",\"-0.084318,-0.226642,-9.795838\"}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
#> [25] "gyroscope = {\"0.019584,-0.049572,0.059670\",\"0.019584,-0.049572,0.059670\",\"0.019737,-0.058752,0.052938\",\"0.016983,-0.057528,0.042687\",\"0.016983,-0.057528,0.042687\",\"0.017748,-0.047277,0.047430\",\"0.017748,-0.047277,0.047430\",\"0.017748,-0.047277,0.047430\",\"0.017748,-0.047277,0.047430\",\"0.009180,-0.061353,0.040392\",\"0.009180,-0.061353,0.040392\",\"0.009180,-0.061353,0.040392\",\"0.009180,-0.061353,0.040392\",\"0.009180,-0.061353,0.040392\",\"0.009180,-0.061353,0.040392\",\"0.029529,-0.052632,0.039474\",\"0.029529,-0.052632,0.039474\",\"0.029529,-0.052632,0.039474\",\"0.029529,-0.052632,0.039474\",\"0.013158,-0.055539,0.056916\",\"0.013158,-0.055539,0.056916\",\"0.013158,-0.055539,0.056916\",\"0.023409,-0.055998,0.044829\",\"0.019584,-0.043758,0.042993\",\"0.019584,-0.043758,0.042993\",\"0.019584,-0.043758,0.042993\",\"0.019584,-0.043758,0.042993\",\"0.019584,-0.043758,0.042993\",\"0.019584,-0.043758,0.042993\",\"0.019737,-0.058752,0.052938\",\"0.019737,-0.058752,0.052938\",\"0.019737,-0.058752,0.052938\",\"0.019737,-0.058752,0.052938\",\"0.019737,-0.058752,0.052938\",\"0.019737,-0.058752,0.052938\",\"0.016983,-0.057528,0.042687\",\"0.016983,-0.057528,0.042687\",\"0.016983,-0.057528,0.042687\",\"0.017748,-0.047277,0.047430\",\"0.017748,-0.047277,0.047430\",\"0.015147,-0.048960,0.033354\",\"0.017901,-0.054009,0.054774\",\"0.017901,-0.054009,0.054774\",\"0.017901,-0.054009,0.054774\",\"0.017901,-0.054009,0.054774\",\"0.018360,-0.054315,0.045594\",\"0.018360,-0.054315,0.045594\",\"0.018360,-0.054315,0.045594\",\"0.018360,-0.054315,0.045594\",\"0.018360,-0.054315,0.045594\",\"0.018360,-0.054315,0.045594\",\"0.017442,-0.043299,0.045135\",\"0.017442,-0.043299,0.045135\",\"0.017442,-0.043299,0.045135\",\"0.017442,-0.043299,0.045135\",\"0.029529,-0.052632,0.039474\",\"0.029529,-0.052632,0.039474\",\"0.013158,-0.055539,0.056916\",\"0.013158,-0.055539,0.056916\",\"0.013158,-0.055539,0.056916\",\"0.015147,-0.048960,0.033354\",\"0.015147,-0.048960,0.033354\",\"0.015147,-0.048960,0.033354\",\"0.015147,-0.048960,0.033354\",\"0.026775,-0.061659,0.045135\",\"0.026775,-0.061659,0.045135\",\"0.009486,-0.054774,0.030447\",\"0.009486,-0.054774,0.030447\",\"0.009486,-0.054774,0.030447\",\"0.009486,-0.054774,0.030447\",\"0.017748,-0.057681,0.049419\",\"0.017748,-0.057681,0.049419\",\"0.017748,-0.057681,0.049419\",\"0.017748,-0.057681,0.049419\",\"0.017748,-0.057681,0.049419\",\"0.017748,-0.057681,0.049419\",\"0.023409,-0.055998,0.044829\",\"0.023409,-0.055998,0.044829\",\"0.023409,-0.055998,0.044829\",\"0.023409,-0.055998,0.044829\",\"0.023409,-0.055998,0.044829\"}"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     

# Example 1 - raw values
path <- system.file('exdata', 'obory.dat', package = 'hyperbrick')
b <- buildBrick(path)
print(b)
#> class      : RasterBrick 
#> dimensions : 128, 128, 16384, 81  (nrow, ncol, ncell, nlayers)
#> resolution : 0.0078125, 0.0078125  (x, y)
#> extent     : 0, 1, 0, 1  (xmin, xmax, ymin, ymax)
#> crs        : NA 
#> source     : memory
#> names      :  b500,  b505,  b510,  b515,  b520,  b525,  b530,  b535,  b540,  b545,  b550,  b555,  b560,  b565,  b570, ... 
#> min values :  8823,  8925,  3589,  3668,  3869,  4100,  3744,  3941,  3833,  3834,  4065,  3941,  3814,  3745,  3885, ... 
#> max values : 65535, 65535, 61506, 61523, 61489, 60702, 60786, 61523, 60669, 60836, 59978, 60669, 60585, 60635, 60602, ... 
#> 
plot(b, 35)


# Example 2 - set up CRS and compute radiance
br <- buildBrick(path, hFOV = 36.8, vFOV = 36.8, height = 45,
                ref_layer = 35, spectral_feature = 'radiance')
print(br)
#> class      : RasterBrick 
#> dimensions : 128, 128, 16384, 81  (nrow, ncol, ncell, nlayers)
#> resolution : 0.2338986, 0.2338986  (x, y)
#> extent     : 512700.2, 512730.1, 5769447, 5769477  (xmin, xmax, ymin, ymax)
#> crs        : +proj=utm +zone=34 +datum=WGS84 +units=m +no_defs 
#> source     : memory
#> names      :      b500,      b505,      b510,      b515,      b520,      b525,      b530,      b535,      b540,      b545,      b550,      b555,      b560,      b565,      b570, ... 
#> min values :  0.000000,  0.000000,  3.897654,  4.049472,  4.437743,  4.817500,  4.343040,  4.413920,  4.358121,  4.428270,  4.682880,  4.520327,  4.454752,  4.520215,  4.809630, ... 
#> max values :   0.00000,   0.00000,  66.79552,  67.92139,  70.52788,  71.32485,  70.51176,  68.90576,  68.98065,  70.26558,  69.09466,  69.58734,  70.76328,  73.18644,  75.02528, ... 
#> 
plot(br, 35)


# Example 3 - DOS correction
dpath <- system.file('exdata', 'obory_dark.dat', package = 'hyperbrick')
brd <- buildBrick(path, hFOV = 36.8, vFOV = 36.8, height = 45,
                  ref_layer = 35, spectral_feature = 'radiance',
                  dark_path = dpath)
print(brd)
#> class      : RasterBrick 
#> dimensions : 128, 128, 16384, 81  (nrow, ncol, ncell, nlayers)
#> resolution : 0.2338986, 0.2338986  (x, y)
#> extent     : 512700.2, 512730.1, 5769447, 5769477  (xmin, xmax, ymin, ymax)
#> crs        : +proj=utm +zone=34 +datum=WGS84 +units=m +no_defs 
#> source     : memory
#> names      :     b500,     b505,     b510,     b515,     b520,     b525,     b530,     b535,     b540,     b545,     b550,     b555,     b560,     b565,     b570, ... 
#> min values : 0.000000, 0.000000, 2.585766, 2.698176, 3.072813, 3.356975, 2.944080, 3.060960, 2.966433, 3.053820, 3.254400, 3.122134, 3.044976, 3.042847, 3.336410, ... 
#> max values :  0.00000,  0.00000, 65.48363, 66.57010, 69.16295, 69.86433, 69.11280, 67.55280, 67.58897, 68.89113, 67.66618, 68.18915, 69.35350, 71.70908, 73.55206, ... 
#> 
plot(brd, 35)


# Example 4 - compute reflectance
bre <- buildBrick(path, hFOV = 36.8, vFOV = 36.8, height = 45,
                  ref_layer = 35, spectral_feature = 'reflectance',
                  reflectance_method = "irradiance",
                  dark_path = dpath)
print(bre)
#> class      : RasterBrick 
#> dimensions : 128, 128, 16384, 81  (nrow, ncol, ncell, nlayers)
#> resolution : 0.2338986, 0.2338986  (x, y)
#> extent     : 512700.2, 512730.1, 5769447, 5769477  (xmin, xmax, ymin, ymax)
#> crs        : +proj=utm +zone=34 +datum=WGS84 +units=m +no_defs 
#> source     : memory
#> names      :       b500,       b505,       b510,       b515,       b520,       b525,       b530,       b535,       b540,       b545,       b550,       b555,       b560,       b565,       b570, ... 
#> min values : 0.00000000, 0.00000000, 0.01484299, 0.01548825, 0.01763877, 0.01920445, 0.01684237, 0.01751102, 0.01697025, 0.01747017, 0.01861764, 0.01786098, 0.01743933, 0.01742714, 0.01910844, ... 
#> max values :  0.0000000,  0.0000000,  0.3758935,  0.3821301,  0.3970138,  0.3996770,  0.3953777,  0.3864533,  0.3866602,  0.3941096,  0.3871019,  0.3900937,  0.3972046,  0.4106956,  0.4212508, ... 
#> 
plot(bre, 35)


# Example 5 - there is a white-reference panel in this image
idmax <- which.max(bre[[35]])
plot(bre, 35, asp = 0)
points(xyFromCell(bre[[35]], idmax), pch = 3)


bre2 <- buildBrick(path, hFOV = 36.8, vFOV = 36.8, height = 45,
                   ref_layer = 35, spectral_feature = 'reflectance',
                   reflectance_method = "white_panel",
                   white_path = path, dark_path = dpath)
print(bre2)
#> class      : RasterBrick 
#> dimensions : 128, 128, 16384, 81  (nrow, ncol, ncell, nlayers)
#> resolution : 0.2338986, 0.2338986  (x, y)
#> extent     : 512700.2, 512730.1, 5769447, 5769477  (xmin, xmax, ymin, ymax)
#> crs        : +proj=utm +zone=34 +datum=WGS84 +units=m +no_defs 
#> source     : memory
#> names      :       b500,       b505,       b510,       b515,       b520,       b525,       b530,       b535,       b540,       b545,       b550,       b555,       b560,       b565,       b570, ... 
#> min values : 0.11789958, 0.12000622, 0.03948721, 0.04053135, 0.04442860, 0.04804992, 0.04259819, 0.04531211, 0.04388931, 0.04432820, 0.04809493, 0.04578638, 0.04390515, 0.04243322, 0.04536121, ... 
#> max values :          1,          1,          1,          1,          1,          1,          1,          1,          1,          1,          1,          1,          1,          1,          1, ... 
#> 
plot(bre2, 35)