forked from EcoForecast/PhenologyForecast
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Hindcast.R
37 lines (28 loc) · 1.4 KB
/
Hindcast.R
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
# A high-level outline of forecasting structure
setwd("/home/dietze/PhenologyForecast/")
year = 2014
# All site information is read from the file "site_metadata.csv".
# Analysis will be performed on each site in that file.
num.sites = as.numeric(nrow(read.csv("site_metadata.csv")))
# For each site, we need to run a state-space model, and then the forecast model for the current year
for(site in 1:num.sites) {
source("check.for.complete.SS.model.R")
SS.complete <- check.for.complete.SS.model(site) # SS.complete is TRUE/FALSE
# If not, then create the state space model for that site:
if(!SS.complete) {
source("run.SS.model.R")
run.SS.model(site) # This should create some files which contain inputs for the forecast model
}
# Step 3: Check to see if the forecast model has been run (and has some output)
# "FM" means forecast model, the particle filter in this case
source("check.for.FM.model.R")
FM.complete <- check.for.FM.model(site,year) # FM.created is TRUE/FALSE
# If not, then create the forecast model for that site:
if(!FM.complete) {
source("create.FM.model.R")
create.FM.model(site,year) # This should create some files with forecasts and some other output
}
# Step 4: Check for new data not yet included in forecast model:
source("update.FM.model.R")
update.FM.model(site) # This should update the output from the forecast model for any new data
}