# Load libraries ####
library(readr)
library(openair)
library(ggplot2)
library(tidyr)
# Quiet down warnings
oldw <- getOption("warn")
options(warn = -1)
# Paths and constants ####
# ODIN data folder
data_folder <- "~/data/ODIN_IDAHO/WSV.ODIN.April2018/"
# Load data ####
taplab <- read_csv("~/data/ODIN_data/TAPLAB/stream_42oZGezrNXHlE1KzMrjktvjMwQz.csv",
                   col_types = cols(timestamp = col_datetime(format = "%Y-%m-%dT%H:%M:%OSZ")))
names(taplab) <- c('PM1','PM10','PM2.5','RH','Temperature','date')
taplab$date <- taplab$date + 12*3600

# Some plots ####
## PM1
timePlot(taplab,pollutant = c('PM1','PM2.5','PM10'),group = TRUE,avg.time = '1 hour')

timeVariation(taplab,pollutant = c('PM1','PM2.5','PM10'))

## Temperature
timePlot(taplab,pollutant = c('Temperature'),group = TRUE,avg.time = '1 hour')

timeVariation(taplab, c('Temperature'))

## RH
timePlot(taplab,pollutant = c('RH'),group = TRUE,avg.time = '1 hour')

timeVariation(taplab, c('RH'))

#re-enable warnings to continue the session
options(warn = oldw)