|
| 1 | + |
| 2 | +## Hyperspectral Data |
| 3 | + |
| 4 | +### Calibration Targets |
| 5 | + |
| 6 | +These were collected on April 15 2017 every ~15 minutes |
| 7 | + |
| 8 | + |
| 9 | +```{r get-vnir-calibration, eval=FALSE} |
| 10 | +library(ncdf4) |
| 11 | +library(dplyr) |
| 12 | +
|
| 13 | +hsi_calibration_dir <- '/data/terraref/sites/ua-mac/Level_1/hyperspectral/2017-04-15' |
| 14 | +hsi_calibration_files <- dir(hsi_calibration_dir, |
| 15 | + recursive = TRUE, |
| 16 | + full.names = TRUE) |
| 17 | +
|
| 18 | +fileinfo <- bind_rows(lapply(hsi_calibration_files, file.info)) %>% |
| 19 | + mutate(size_gb = size/1073741824) |
| 20 | +
|
| 21 | +calibration_nc <- nc_open(hsi_calibration_files[200]) |
| 22 | +a <- calibration_nc$var$rfl_img |
| 23 | +
|
| 24 | +
|
| 25 | +#calibration_nc$dim$x$len 1600 |
| 26 | +#calibration_nc$dim$y$len |
| 27 | +x_length <- round(calibration_nc$dim$x$len / 10) |
| 28 | +y_length <- round(calibration_nc$dim$y$len * 3/4) |
| 29 | +
|
| 30 | +xstart <- ceiling(calibration_nc$dim$x$len / 2) - floor(x_length / 2) + 1 |
| 31 | +
|
| 32 | +ystart <- ceiling(calibration_nc$dim$y$len / 2) - floor(y_length / 2) + 1 |
| 33 | +
|
| 34 | +rfl <- ncvar_get(calibration_nc, 'rfl_img', |
| 35 | + #start = c(1, xstart, ystart), |
| 36 | + #count = c(955, x_length, y_length) |
| 37 | + start = c(2, 2, 2), |
| 38 | + count = c(1320, 10, 954) |
| 39 | + ) |
| 40 | +x <- ncvar_get(calibration_nc, 'x', start = 100, count = 160) |
| 41 | +y <- ncvar_get(calibration_nc, 'y', start = 100, count = 1324) |
| 42 | +lambda <- calibration_nc$dim$wavelength$vals |
| 43 | +for(i in 1 + 0:10*95){ |
| 44 | + image(x = x, y = y, z = rfl[i,,], |
| 45 | + xlab = 'x (m)', ylab = 'y (m)', |
| 46 | + col = rainbow(n=100), |
| 47 | + main = paste('wavelength', |
| 48 | + udunits2::ud.convert(lambda[i],'m','nm'))) |
| 49 | +} |
| 50 | +
|
| 51 | +``` |
0 commit comments