knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(NTLlakeloads) library(tidyverse)
devtools::load_all(".")
# Load NTL datasets LTERtemp = loadLTERtemp() # Download NTL LTER data from EDI LTERnutrients = loadLTERnutrients() # Download NTL LTER data from EDI LTERions = loadLTERions() # Download NTL LTER data from EDI LTERsecchi = loadLTERsecchi() # Download NTL LTER data from EDI
# Available variables availableVars() # Available variables that are not depth-discrete. Used with weeklyInterpolate.1D. availableVars.1D()
# printFigs = TRUE to output series of interpolated profiles (but slower) # See help file for parameter descripts df.ME = weeklyInterpolate(lakeAbr = 'ME', var = 'totpuf_sloh', dataset = LTERnutrients, maxdepth = 24, constrainMethod = 'zero', setThreshold = 0.1, printFigs = F)
plotTimeseries(df.interpolated = df.ME$weeklyInterpolated, var = 'totpuf_sloh')
# With observations plotTimeseries.year(df.interpolated = df.ME$weeklyInterpolated, observations = df.ME$observations, var = 'totpuf_sloh', chooseYear = 2008) # Without observations, but adding legend title plotTimeseries.year(df.interpolated = df.ME$weeklyInterpolated, var = 'totpuf_sloh', chooseYear = 2008, legend.title = 'TP (µg/L)')
df.mass.annual = calcMass(df.ME$weeklyInterpolated,lakeAbr = 'ME', time.res = 'annual', conversion = 1e6)
library(ggplot2) ggplot(df.mass.annual, aes(x = year, y = mass)) + geom_path() + geom_point() + ylab('TP (kg)') + labs(title = 'Lake Mendota annual TP mass', caption = 'Calculated from NTLlakeloads') + theme_bw(base_size = 10) + theme(axis.title.x = element_blank())
df.mass = calcMass(df.ME$weeklyInterpolated,lakeAbr = 'ME', time.res = 'weekly', conversion = 1e6) decomposeTS(df.mass, lakeAbr = 'ME', var = 'totpuf_sloh')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.