Introduction

Analysis of variables from training samples used in the Rocky Mountain ecoregion wetland classification. Variables are derived from 2020 Sentinel-2 optical data and ALOS DEM derived topographic indices.

Data summary

Summary of the number of polygons of each class

library(dplyr)
library(ggplot2)
library(xgboost)
library(knitr)
library(plotly)
library(caret)
library(kableExtra)

setwd("C:/Users/user/OneDrive/ABMI/R_scripts")

d <- read.csv("Sampled_trainPoints_Feb12.csv")
d <- as.data.frame(d)


d <- d %>% dplyr::select(-system.index, -.geo)
d <- na.omit(d)
d <- d %>% filter(Class_2 != 8)

#summary of interpretation
#WC <- c("Marsh", "Swamp", "Open Water", "Upland")
summary <- d %>% group_by(Class) %>% summarize(n())
kable(summary) %>% kable_styling(bootstrap_options = "striped", font_size = 14)
Class n()
Conifer 1261
Decid 503
Fen 510
Marsh 206
Meadow 601
Swamp 565
Water 206

Violin plots - Band Means

This explores the class seperation of the means of bands, spectral indices and topo indices per segment. Based on Image collection median over 2020 growing season

RSvars <- c("B2_mean", "B3_mean", "B4_mean", "B5_mean","B6_mean", "B7_mean", "B8_mean", "B11_mean", "B12_mean", 
            "EVI_mean", "NARI_mean", "NDWI1_mean", "NDWI2_mean", 
            "SWI_mean", "TPI250_mean", "TPI750_mean", "VBF_mean")

for (i in 1:length(RSvars)){
  var <- RSvars[i]
  print(
  ggplot(d, aes_string(x = "Class", y = var, fill = "Class")) + 
    geom_violin() +
    #scale_fill_manual(name = "", values=c('#BF584B', '#CBE39B', '#FEE391', '#08306B', '#009474', "#006D2C")) +
    xlab("Class")
  )
}

Violin plots - Band standard deviations over space

This explores the class seperation of the standard deviations of bands, spectral indices and topo indices per segment IE. Variation of the values within segments. Based on Image collection median over 2020 growing season

RSvars <- c("B2_stdDev", "B3_stdDev", "B4_stdDev", "B5_stdDev","B6_stdDev", "B7_stdDev", "B8_stdDev", "B11_stdDev", "B12_stdDev", 
            "EVI_stdDev", "NARI_stdDev", "NDWI1_stdDev", "NDWI2_stdDev", "SWI_stdDev", "TPI250_stdDev", "TPI750_stdDev", "VBF_stdDev"
            )

for (i in 1:length(RSvars)){
  var <- RSvars[i]
  print(
  ggplot(d, aes_string(x = "Class", y = var, fill = "Class")) + 
    geom_violin() +
    #scale_fill_manual(name = "", values=c('#BF584B', '#CBE39B', '#FEE391', '#08306B', '#009474', "#006D2C")) +
    xlab("Class")
  )
}

`

Violin plots - Band Standard Deviations over time

For each segment, the mean of the standard deviation over the growing season Should capture tendency to vary thoughout the season

RSvars <- c("B2_stdDev_mean", "B5_stdDev_mean", "B7_stdDev_mean", "B8_stdDev_mean", "B11_stdDev_mean", "B12_stdDev_mean", 
            "EVI_stdDev_mean", "NARI_stdDev_mean",  "NDWI2_stdDev_mean"
            )


for (i in 1:length(RSvars)){
  var <- RSvars[i]
  print(
  ggplot(d, aes_string(x = "Class", y = var, fill = "Class")) + 
    geom_violin() +
    #scale_fill_manual(name = "", values=c('#BF584B', '#CBE39B', '#FEE391', '#08306B', '#009474', "#006D2C")) +
    xlab("Class")
  )
}

`

Violin plots - Standard deviations of Standard Deviations over time

For each segment, the standard deviation of the standard deviation over the growing season Should capture tendency for variation within a class in terms of how much it varies over the season

RSvars <- c("B2_stdDev_stdDev", "B5_stdDev_stdDev", "B7_stdDev_stdDev", "B8_stdDev_stdDev", "B11_stdDev_stdDev", "B12_stdDev_stdDev", 
            "EVI_stdDev_stdDev", "NARI_stdDev_stdDev",  "NDWI2_stdDev_stdDev"
            )


for (i in 1:length(RSvars)){
  var <- RSvars[i]
  print(
  ggplot(d, aes_string(x = "Class", y = var, fill = "Class")) + 
    geom_violin() +
    #scale_fill_manual(name = "", values=c('#BF584B', '#CBE39B', '#FEE391', '#08306B', '#009474', "#006D2C")) +
    xlab("Class")
  )
}

`

Violin plots - Difference over Growing Season

For each segment, the mean and sd of the difference between 10th and 90th percentile over growing season Should capture tendency for variation over the season, even though peaks may occurs at different times for different classes

RSvars <- c("diffB7_mean", "diffB7_stdDev", "diffB12_mean", "diffB12_stdDev", "diffNARI_mean", "diffNARI_stdDev", 
            "diffNDWI2_mean", "diffNDWI2_stdDev"
            )


for (i in 1:length(RSvars)){
  var <- RSvars[i]
  print(
  ggplot(d, aes_string(x = "Class", y = var, fill = "Class")) + 
    geom_violin() +
    #scale_fill_manual(name = "", values=c('#BF584B', '#CBE39B', '#FEE391', '#08306B', '#009474', "#006D2C")) +
    xlab("Class")
  )
}