Skip to content
Snippets Groups Projects
Commit dcfddc80 authored by clblatte's avatar clblatte
Browse files

define "sim_variant": output and saved csv

parent 175973b7
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,10 @@ regime <- read.csv(paste0(path, "params/regimes.csv"), sep = ",", stringsAsFacto ...@@ -16,7 +16,10 @@ regime <- read.csv(paste0(path, "params/regimes.csv"), sep = ",", stringsAsFacto
### Simulation variant ### Simulation variant
sim_variant <- "without" # specify which one: "CC45", "CC85", "without" # specify which one: "CC45" climate change with RCP scenraio 4.5
# "CC85" climate change with RCP scenario 8.5
# "without" no climate change
sim_variant <- "without"
### Define the names of the SQL databases (SIMO-output) that will imported ### Define the names of the SQL databases (SIMO-output) that will imported
...@@ -67,9 +70,9 @@ columns <- paste0("id, ...@@ -67,9 +70,9 @@ columns <- paste0("id,
### !!! Needed if the DB is read/loaded for the first time, since dataframes are also stored as csv-file under "output/". !!! ### !!! Needed if the DB is read/loaded for the first time, since dataframes are also stored as csv-file under "output/". !!!
source(paste0(path, "loadDB.R")) # Afterwards, you can also exclude this line with: # # source(paste0(path, "loadDB.R")) # Afterwards, you can also exclude this line with: #
# ... and the single csv can later also be loaded into the R-environment with: # ... and the single csv can later also be loaded into the R-environment with:
# rslt <- read.csv(paste0(path, "output/rslt_all.csv"), sep = ";", header = TRUE, stringsAsFactors = FALSE) rslt <- read.csv(paste0(path, "output/rslt_", sim_variant, "_", "_all.csv" ), sep = ";", header = TRUE, stringsAsFactors = FALSE)
...@@ -29,7 +29,7 @@ for (name in db_names){ ...@@ -29,7 +29,7 @@ for (name in db_names){
rsl <- rsl %>% rsl <- rsl %>%
left_join(regime, by = "branching_group", all.x = TRUE) left_join(regime, by = "branching_group", all.x = TRUE)
write.table(rsl, paste0(path, "output/rsl_",name,".csv" ), sep = ";", row.names = F, col.names = TRUE) write.table(rsl, paste0(path, "output/rsl_",sim_variant,"_",name,".csv" ), sep = ";", row.names = F, col.names = TRUE)
assign( paste("rsl", name, sep="_"), rsl) assign( paste("rsl", name, sep="_"), rsl)
rm(db, rsl) rm(db, rsl)
...@@ -54,7 +54,7 @@ for (name in db_names){ ...@@ -54,7 +54,7 @@ for (name in db_names){
rslt <- rslt %>% rslt <- rslt %>%
left_join(regime, by= "branching_group", all.X = TRUE) left_join(regime, by= "branching_group", all.X = TRUE)
write.table(rslt, paste0(path, "output/rslt_all.csv" ), sep = ";", row.names = F, col.names = TRUE) write.table(rslt, paste0(path, "output/rslt_", sim_variant, "_", "_all.csv" ), sep = ";", row.names = F, col.names = TRUE)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
...@@ -22,7 +22,7 @@ library(ggplot2) ...@@ -22,7 +22,7 @@ library(ggplot2)
library(knitr) library(knitr)
library(kableExtra) library(kableExtra)
``` ```
### Simulated Climate Change: `r sim_variant `
### Names of the restructured GPKGs ### Names of the restructured GPKGs
```{r, echo=TRUE} ```{r, echo=TRUE}
...@@ -59,7 +59,7 @@ kable(stands) %>% kable_styling() ...@@ -59,7 +59,7 @@ kable(stands) %>% kable_styling()
### Development of average stand volume (m3/ha) for certain regimes ### Development of average stand volume (m3/ha) for certain regimes
```{r} ```{r}
meanV <- rslt[rslt$regime %in% c("BAU", "SA", "CCF") , ] %>% meanV <- rslt[rslt$regime %in% c("BAU", "SA", "CCF_1") , ] %>%
group_by(year, regime, gpkg) %>% group_by(year, regime, gpkg) %>%
summarise(meanV = mean(V)) %>% summarise(meanV = mean(V)) %>%
ggplot(aes(year, meanV)) + ggplot(aes(year, meanV)) +
...@@ -76,7 +76,7 @@ meanV <- rslt[rslt$regime %in% c("BAU", "SA", "CCF") , ] %>% ...@@ -76,7 +76,7 @@ meanV <- rslt[rslt$regime %in% c("BAU", "SA", "CCF") , ] %>%
Cash flow = The sum of all revenues and costs for a specific forest stand Cash flow = The sum of all revenues and costs for a specific forest stand
```{r} ```{r}
meanCash <- rslt[rslt$regime %in% c("BAU", "SA", "CCF") , ] %>% meanCash <- rslt[rslt$regime %in% c("BAU", "SA", "CCF_1") , ] %>%
group_by(year, regime, gpkg) %>% group_by(year, regime, gpkg) %>%
mutate(cash_flow = ifelse(is.na(cash_flow), 0, cash_flow)) %>% mutate(cash_flow = ifelse(is.na(cash_flow), 0, cash_flow)) %>%
summarise(meanCash = mean(cash_flow), na.rm = TRUE) %>% summarise(meanCash = mean(cash_flow), na.rm = TRUE) %>%
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment