Skip to content
Snippets Groups Projects
Commit 8c6482a6 authored by mpotterf's avatar mpotterf
Browse files

included management regimes table

parent 6f0488a0
No related branches found
No related tags found
No related merge requests found
......@@ -15,13 +15,21 @@ library(tidyr)
library(dplyr)
### Load management regimes
# ---------------------------
# Management regimes and their abbreviation, they are merged to the data by the branching group (script loadDB.R)
regime <- read.csv(paste0(path, "/params/regimes.csv"),
sep = ",",
stringsAsFactors = FALSE)
# Variant 1: create a single dataframe for each SQL Database (selected columns of table UNIT)
# Dataframes are given the names of the DB and column "test" is added with the name of the DB
for (name in db_names){
#name = "simulated_without_MV_Korsnas_Wind_NO_1-15"
# name = "simulated_without_MV_Korsnas_Wind_three_286-300"
#db <- dbConnect(dbDriver("SQLite"), dbname = paste0(path,"input_data/simulated_", sim_variant, "_", name, "_rsu.db"))
db <- dbConnect(dbDriver("SQLite"),
dbname = paste(inputFolder,
......@@ -47,16 +55,23 @@ for (name in db_names){
### Rename set aside scenario if it considers deadwood extraction
if(sim_variant %in% all.variants) {
# Maybe now we can remove this????
#if(sim_variant %in% all.variants) {
rsl <- rsl %>% mutate(regime = ifelse(regime %in% "SA", "SA_DWextract", regime))
#rsl <- rsl %>% mutate(regime = ifelse(regime %in% "SA", "SA_DWextract", regime))
}
#}
# Create output name, Remove the 'simulated_'
outName <- gsub("simulated_", "", name)
# Export the final table
print(paste0("writing csv for ", name))
print(paste0("writing csv for ", outName))
write.table(rsl,
paste0(outputFolder, "/", name, ".csv" ),
paste0(outputFolder, "/", outName, ".csv" ),
sep = ";",
row.names = F,
col.names = TRUE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment