-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDIO.Rmd
52 lines (38 loc) · 1.16 KB
/
DIO.Rmd
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
---
title: "Build DIO Model"
output:
md_document:
variant: gfm
params:
modelname: "DIOv2.0"
---
```{r setup, include=FALSE}
## Install useeior version with hybridization
#First check that devtools package is installed
#if (!"devtools"%in%installed.packages()[, "Package"]) {
# install.packages("devtools")
#}
library(devtools)
devtools::install_github("USEPA/useeior@v1.2.2")
# devtools::load_all("../useeior")
## Build the model using useeior
library(useeior)
library(logging)
# Identify the model specifications file for the selected DIO model
modelspec <- paste0(params$modelname, ".yml")
hybridspec <- "DIOProcesses.yml"
configpaths <- file.path("data", c(modelspec, hybridspec))
log_file <- "model/build_and_save_DIO_model.log"
if (file.exists(log_file)){
file.remove(log_file)
}
addHandler(writeToFile, file=log_file)
DIO <- useeior::buildModel(params$modelname, configpaths)
saveRDS(DIO, "model/DIO.rds")
```
Write the model to Excel and a log to a log file
```{r, include=FALSE}
# See Issue 7 (https://github.com/USEPA/DIO/issues/7)
# which will cause writing model to fail due to checkNamesandOrdering()
useeior::writeModeltoXLSX(DIO,"model")
```