-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMain.R
More file actions
93 lines (81 loc) · 3.29 KB
/
Copy pathMain.R
File metadata and controls
93 lines (81 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
### Aquatic Forecast Workflow ###
#devtools::install_github("eco4cast/neon4cast")
library(tidyverse)
#library(neon4cast)
library(lubridate)
install.packages("daymetr")
install.packages("padr")
#install.packages("rMR")
#library(rMR)
forecast_date <- Sys.Date()
noaa_date <- Sys.Date() - days(1) #Need to use yesterday's NOAA forecast because today's is not available yet
#Step 0: Define team name and team members
team_info <- list(team_name = "AquaticEcosystems",
team_list = list(
list(individualName = list(givenName = "Sebastian",
surName = "Sanchez"),
organizationName = "Boston University",
electronicMailAddress = "bastian6@bu.edu"),
list(individualName = list(givenName = "Trenton",
surName = "Mulick"),
organizationName = "Boston University",
electronicMailAddress = "tmulick@bu.edu"),
list(individualName = list(givenName = "Jianrui",
surName = "Liu"),
organizationName = "Boston University",
electronicMailAddress = "jianrui@bu.edu"),
list(individualName = list(givenName = "Matthew",
surName = "Manberg"),
organizationName = "Boston University",
electronicMailAddress = "mmanber1@bu.edu"),
list(individualName = list(givenName = "Alejandro",
surName = "Diaz"),
organizationName = "Boston University",
electronicMailAddress = "alejdiaz@bu.edu"))
)
## Load required functions
if(file.exists("site_temp_oxygen_data.R")) source("site_temp_oxygen_data.R")
# if(file.exists("NOAA_Forecast_download.R")) source("NOAA_Forecast_download.R")
if(file.exists("DLM.R")) source("DLM.R")
if(file.exists("Forecast_Submit.R")) source("Forecast_Submit.R")
### Step 1: Download Required Data
download <- download_targets() ## Y variables
target <- download[[1]]
site_names <- download[[2]]
forecasts <- data.frame() # Empty data frame, will fill with each site's forecast
# DLM model
for(site in site_names){
dlm <- DLM_function(site) # Get prediction for the site
forecasts <- rbind(forecasts, dlm) # Add predictions to the data frame
}
site_data <- download_site_meta()
ox_temp <- filter_ox_temp(target)
target_oxygen <- ox_temp[[1]]
target_temp <- ox_temp[[2]]
# Plot oxygen and temperature for each site
# for(site in site_names){
# dates_oxygen <- target_oxygen |>
# filter(site_id == site) |>
# select(datetime)
# site_oxygen <- target_oxygen |>
# filter(site_id == site) |>
# select(observation)
#
# dates_temp <- target_temp |>
# filter(site_id == site) |>
# select(datetime)
# site_temp <- target_temp |>
# filter(site_id == site) |>
# select(observation)
#
# plot(dates_oxygen$datetime, site_oxygen$observation,
# xlab = "Date",
# ylab = "Oxygen",
# main = site,
# )
# plot(dates_temp$datetime, site_temp$observation,
# xlab = "Date",
# ylab = "Temperature",
# main = site,
# )
# }