Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing calibration hypercube data #6

Open
dlebauer opened this issue Jun 2, 2017 · 0 comments
Open

Accessing calibration hypercube data #6

dlebauer opened this issue Jun 2, 2017 · 0 comments

Comments

@dlebauer
Copy link

dlebauer commented Jun 2, 2017

On April 15 we captured hyperspectral images of target objects at 15 min intervals throughout the day. See also terraref/computing-pipeline#289

Here is a picture of the calibration targets:

image

This is how you can get started extracting data from the VNIR files:

(you will want to get some files close in time to where you have validation measurements)

library(ncdf4)
library(dplyr)

hsi_calibration_dir <- '/data/terraref/sites/ua-mac/Level_1/hyperspectral/2017-04-15'
hsi_calibration_files <- dir(hsi_calibration_dir, 
                             recursive = TRUE,
                             full.names = TRUE)

fileinfo <- bind_rows(lapply(hsi_calibration_files, file.info)) %>%
  mutate(size_gb = size/1073741824)

calibration_nc <- nc_open(hsi_calibration_files[200])
a <- calibration_nc$var$rfl_img


#calibration_nc$dim$x$len 1600
#calibration_nc$dim$y$len
x_length <- round(calibration_nc$dim$x$len / 10)
y_length <- round(calibration_nc$dim$y$len * 3/4)

xstart <- ceiling(calibration_nc$dim$x$len / 2) - floor(x_length / 2) + 1

ystart <- ceiling(calibration_nc$dim$y$len / 2) - floor(y_length / 2) + 1


rfl <- ncvar_get(calibration_nc, 'rfl_img', 
          #start = c(1, xstart, ystart), 
          #count = c(955, x_length, y_length)
          start = c(1, 100, 100),
          count = c(calibration_nc$dim$wavelength$len, 160, 1324)
          )
x <- ncvar_get(calibration_nc, 'x', start = 100, count = 160)
y <- ncvar_get(calibration_nc, 'y', start = 100, count = 1324)

lambda <- calibration_nc$dim$wavelength$vals
for(i in 1 + 0:10*95){
  image(rfl[i,,],
        xlab = 'x (m)', ylab = 'y (m)',
        col = rainbow(n=100),
        main = paste('wavelength', 
                      udunits2::ud.convert(lambda[i],'m','nm')))
} 
@dlebauer dlebauer changed the title Accessing calibration data Accessing calibration hypercube data Jun 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant