knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
stop('Dont knit this.')

This vignette serves to archive some code I used to generate the remotely sensed data in FIA_plot_spectrals.Rda. The data is taken from all Landsat 7 scenes in a given year with maximum 10% cloud cover. Processing was done using Google Earth Engine. Measurements are NDVI, NDMI, RGI, and MIR. The scripts used to generate them are in /GEE_Scripts. They're identical except for how the measurement is calculated.

The scripts use a Google Fusion Table that gets generated by a function here:

library(RSFIA)
RSFIA::MakeFusionTable("C:/Users/Brandon/Desktop")

After you make the fusion table, it needs to be uploaded to Google Drive so the scripts can use it. Once you've made all the data you want, this code pulls it together and saves it as a .Rmd in the package development directory:

# Put coordinates into GEE, get outputs:
key <- read.csv('C:/Users/Brandon/Desktop/FIA_Plot_Coords.csv')
fl_dir <- 'C:/Users/Brandon/Documents/docs/PHD/RSFIA_project/GEE_outputs/NDVI'
NDVI_df <- RSFIA::ReadEarthEngineOutputs(key, fl_dir)
NDVI_df <- NDVI_df[, -1]

# Again for NDMI:
fl_dir <- 'C:/Users/Brandon/Documents/docs/PHD/RSFIA_project/GEE_outputs/NDMI'
NDMI_df <- RSFIA::ReadEarthEngineOutputs(key, fl_dir)
NDMI_df <- NDMI_df[, -1]

# RGI
fl_dir <- 'C:/Users/Brandon/Documents/docs/PHD/RSFIA_project/GEE_outputs/RGI'
RGI_df <- RSFIA::ReadEarthEngineOutputs(key, fl_dir)
RGI_df <- RGI_df[, -1]

# MIR
fl_dir <- 'C:/Users/Brandon/Documents/docs/PHD/RSFIA_project/GEE_outputs/MIR'
MIR_df <- RSFIA::ReadEarthEngineOutputs(key, fl_dir)
MIR_df <- MIR_df[, -1]

# And save it all:
FIA_plot_spectrals <- dplyr::full_join(NDVI_df, NDMI_df, by = c('lat', 'lon'))
FIA_plot_spectrals <- dplyr::full_join(FIA_plot_spectrals, RGI_df, by = c('lat', 'lon'))
FIA_plot_spectrals <- dplyr::full_join(FIA_plot_spectrals, MIR_df, by = c('lat', 'lon'))
devtools::use_data(FIA_plot_spectrals, overwrite = F)

The object generated by this script has 14443 coordinates and 17 variables.



bmcnellis/RSFIA documentation built on June 1, 2019, 7:40 a.m.