Skip to content
Snippets Groups Projects
Commit fa2807f0 authored by matrivi's avatar matrivi
Browse files

Add UNIT_2 (Scenic_beauty)

parent bfbc1735
No related branches found
No related tags found
Loading
#####
#
# Restructer the SIMO output in the SQLite database (final "UNIT" table)
# Restructer the SIMO output in the SQLite database (final "UNIT_2" table)
#
# !!! ONLY FOR SetAside simulations
#
......@@ -78,7 +78,9 @@ create_table_UNIT <- 'Create Table UNIT AS SELECT u.*,
ORDER BY u.id, l.branch, l.data_date'
create_table_UNIT_2 <- 'Create Table UNIT_2 AS SELECT u.*,
(4.471+0.0645*u.D_gm - 0.0001745*u.N + 0.006439*u.V_pine*(CASE WHEN u.H_dom >= 10 THEN 1 ELSE 0 END) + 0.005733*u.V_penbirch + u. V_pubbirch*(CASE WHEN u.H_dom >= 10 THEN 1 ELSE 0 END)) as Scenic_beauty
FROM UNIT u'
# -------------------
# Process: Run queries for SA
......@@ -92,7 +94,7 @@ db <- dbConnect(dbDriver("SQLite"),
# If the following tables already exist, for which the query is defined, remove them
tab_to_delete <- c("OPERS2", "OPERS3", "max_v", "UNIT")
tab_to_delete <- c("OPERS2", "OPERS3", "max_v", "UNIT", "UNIT_2")
# Remove the tables if already exist
......@@ -100,9 +102,9 @@ for(i in tab_to_delete){
if(dbExistsTable(db, i)) {dbRemoveTable(db, i)}
}
# Run the Queries and create the final table "UNIT",
# Run the Queries and create the final table "UNIT_2",
# which contains the development of all stands and indicators under the simulated management regimes
query_to_run <- c(create_table_max_v, create_table_UNIT)
query_to_run <- c(create_table_max_v, create_table_UNIT, create_table_UNIT_2)
for(i in query_to_run){
dbExecute(db, i)
......
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