From 977db1c2e5d54d9d3655f26755ba916dc390b6ae Mon Sep 17 00:00:00 2001 From: Stefano Zaghi Date: Tue, 16 Mar 2021 14:35:58 +0100 Subject: [PATCH 1/2] updated config files --- LakeErken/run_lakeensemblr.R | 28 ++++++++++++++++++++++++++++ LakeGiles/run_lakeensemblr.R | 28 ++++++++++++++++++++++++++++ LakeMendota/run_lakeensemblr.R | 28 ++++++++++++++++++++++++++++ Langtjern/run_lakeensemblr.R | 28 ++++++++++++++++++++++++++++ LoughFeeagh/LakeEnsemblR.yaml | 2 +- LoughFeeagh/run_lakeensemblr.R | 28 ++++++++++++++++++++++++++++ 6 files changed, 141 insertions(+), 1 deletion(-) create mode 100755 LakeErken/run_lakeensemblr.R create mode 100755 LakeGiles/run_lakeensemblr.R create mode 100755 LakeMendota/run_lakeensemblr.R create mode 100755 Langtjern/run_lakeensemblr.R create mode 100755 LoughFeeagh/run_lakeensemblr.R diff --git a/LakeErken/run_lakeensemblr.R b/LakeErken/run_lakeensemblr.R new file mode 100755 index 0000000..23dadb4 --- /dev/null +++ b/LakeErken/run_lakeensemblr.R @@ -0,0 +1,28 @@ +#initial clean up +rm(list = ls()) +graphics.off() +cat("\f") + +# set working directory +setwd(dirname(rstudioapi::getSourceEditorContext()$path)) + + +library(LakeEnsemblR) + +# Set config file +config_file <- "LER_Erken_hourly.yaml" +model <- c("FLake", "GLM", "GOTM", "Simstrat", "MyLake") +# 1. Example - creates directories with all model setup +export_config(config_file = config_file, model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), + folder = ".") +# 2. Run ensemble lake models +run_ensemble(config_file = config_file, + model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), + return_list = FALSE, parallel = FALSE) + + +## Plot model output using gotmtools/ggplot2 +# Extract names of all the variables in netCDF +ncdf <- 'output/ensemble_output.nc' + +plot_heatmap(ncdf) \ No newline at end of file diff --git a/LakeGiles/run_lakeensemblr.R b/LakeGiles/run_lakeensemblr.R new file mode 100755 index 0000000..3ca0b1c --- /dev/null +++ b/LakeGiles/run_lakeensemblr.R @@ -0,0 +1,28 @@ +#initial clean up +rm(list = ls()) +graphics.off() +cat("\f") + +# set working directory +setwd(dirname(rstudioapi::getSourceEditorContext()$path)) + + +library(LakeEnsemblR) + +# Set config file +config_file <- "Giles_master_config.yaml" +model <- c("FLake", "GLM", "GOTM", "Simstrat", "MyLake") +# 1. Example - creates directories with all model setup +export_config(config_file = config_file, model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), + folder = ".") +# 2. Run ensemble lake models +run_ensemble(config_file = config_file, + model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), + return_list = FALSE, parallel = FALSE) + + +## Plot model output using gotmtools/ggplot2 +# Extract names of all the variables in netCDF +ncdf <- 'output/ensemble_output.nc' + +plot_heatmap(ncdf) \ No newline at end of file diff --git a/LakeMendota/run_lakeensemblr.R b/LakeMendota/run_lakeensemblr.R new file mode 100755 index 0000000..5cf8538 --- /dev/null +++ b/LakeMendota/run_lakeensemblr.R @@ -0,0 +1,28 @@ +#initial clean up +rm(list = ls()) +graphics.off() +cat("\f") + +# set working directory +setwd(dirname(rstudioapi::getSourceEditorContext()$path)) + + +library(LakeEnsemblR) + +# Set config file +config_file <- 'LER_Langtjern_1hour.yaml' +model <- c("FLake", "GLM", "GOTM", "Simstrat", "MyLake") +# 1. Example - creates directories with all model setup +export_config(config_file = config_file, model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), + folder = ".") +# 2. Run ensemble lake models +run_ensemble(config_file = config_file, + model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), + return_list = FALSE, parallel = FALSE) + + +## Plot model output using gotmtools/ggplot2 +# Extract names of all the variables in netCDF +ncdf <- 'output/ensemble_output.nc' + +plot_heatmap(ncdf) \ No newline at end of file diff --git a/Langtjern/run_lakeensemblr.R b/Langtjern/run_lakeensemblr.R new file mode 100755 index 0000000..5cf8538 --- /dev/null +++ b/Langtjern/run_lakeensemblr.R @@ -0,0 +1,28 @@ +#initial clean up +rm(list = ls()) +graphics.off() +cat("\f") + +# set working directory +setwd(dirname(rstudioapi::getSourceEditorContext()$path)) + + +library(LakeEnsemblR) + +# Set config file +config_file <- 'LER_Langtjern_1hour.yaml' +model <- c("FLake", "GLM", "GOTM", "Simstrat", "MyLake") +# 1. Example - creates directories with all model setup +export_config(config_file = config_file, model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), + folder = ".") +# 2. Run ensemble lake models +run_ensemble(config_file = config_file, + model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), + return_list = FALSE, parallel = FALSE) + + +## Plot model output using gotmtools/ggplot2 +# Extract names of all the variables in netCDF +ncdf <- 'output/ensemble_output.nc' + +plot_heatmap(ncdf) \ No newline at end of file diff --git a/LoughFeeagh/LakeEnsemblR.yaml b/LoughFeeagh/LakeEnsemblR.yaml index f8fb828..c18032c 100644 --- a/LoughFeeagh/LakeEnsemblR.yaml +++ b/LoughFeeagh/LakeEnsemblR.yaml @@ -34,7 +34,7 @@ inflows: use: false # use in- and outflows? [true/false] file: LakeEnsemblR_inflow_standard_round.csv # file with inflow data, with column headers according to LakeEnsemblR vocabulary [csv file; must be provided if inflows -> use is true] scale_param: 1.0 # scaling factor for discharge in inflow, for example to correct for the percentage of catchment area drained by the inflow - mass-balance: true # enforce pseudo mass-balance by adding an artifical outflow for every inflow [true/false] + mass-balance: false # enforce pseudo mass-balance by adding an artifical outflow for every inflow [true/false] output: file: ensemble_output # name of output file, excluding extension format: netcdf # format [text/netcdf] diff --git a/LoughFeeagh/run_lakeensemblr.R b/LoughFeeagh/run_lakeensemblr.R new file mode 100755 index 0000000..c5f8f31 --- /dev/null +++ b/LoughFeeagh/run_lakeensemblr.R @@ -0,0 +1,28 @@ +#initial clean up +rm(list = ls()) +graphics.off() +cat("\f") + +# set working directory +setwd(dirname(rstudioapi::getSourceEditorContext()$path)) + + +library(LakeEnsemblR) + +# Set config file +config_file <- 'LakeEnsemblR.yaml' +model <- c("FLake", "GLM", "GOTM", "Simstrat", "MyLake") +# 1. Example - creates directories with all model setup +export_config(config_file = config_file, model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), + folder = ".") +# 2. Run ensemble lake models +run_ensemble(config_file = config_file, + model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), + return_list = FALSE, parallel = FALSE) + + +## Plot model output using gotmtools/ggplot2 +# Extract names of all the variables in netCDF +ncdf <- 'output/ensemble_output.nc' + +plot_heatmap(ncdf) \ No newline at end of file From 226d521a1a205d17aba37c18886606ebc05e906b Mon Sep 17 00:00:00 2001 From: Stefano Zaghi Date: Tue, 16 Mar 2021 14:36:53 +0100 Subject: [PATCH 2/2] added R scripts to run the examples --- LakeErken/run_lakeensemblr.R | 11 +++++------ LakeGiles/run_lakeensemblr.R | 11 +++++------ LakeMendota/run_lakeensemblr.R | 13 ++++++------- Langtjern/run_lakeensemblr.R | 13 ++++++------- LoughFeeagh/run_lakeensemblr.R | 14 ++++++-------- 5 files changed, 28 insertions(+), 34 deletions(-) diff --git a/LakeErken/run_lakeensemblr.R b/LakeErken/run_lakeensemblr.R index 23dadb4..ed7e38e 100755 --- a/LakeErken/run_lakeensemblr.R +++ b/LakeErken/run_lakeensemblr.R @@ -6,7 +6,7 @@ cat("\f") # set working directory setwd(dirname(rstudioapi::getSourceEditorContext()$path)) - +# load library library(LakeEnsemblR) # Set config file @@ -21,8 +21,7 @@ run_ensemble(config_file = config_file, return_list = FALSE, parallel = FALSE) -## Plot model output using gotmtools/ggplot2 -# Extract names of all the variables in netCDF -ncdf <- 'output/ensemble_output.nc' - -plot_heatmap(ncdf) \ No newline at end of file +# name of the netcdf output file +ncdf <- "output/ensemble_output.nc" +# plot heatmap +plot_heatmap(ncdf) diff --git a/LakeGiles/run_lakeensemblr.R b/LakeGiles/run_lakeensemblr.R index 3ca0b1c..0fcac26 100755 --- a/LakeGiles/run_lakeensemblr.R +++ b/LakeGiles/run_lakeensemblr.R @@ -6,7 +6,7 @@ cat("\f") # set working directory setwd(dirname(rstudioapi::getSourceEditorContext()$path)) - +# load library library(LakeEnsemblR) # Set config file @@ -21,8 +21,7 @@ run_ensemble(config_file = config_file, return_list = FALSE, parallel = FALSE) -## Plot model output using gotmtools/ggplot2 -# Extract names of all the variables in netCDF -ncdf <- 'output/ensemble_output.nc' - -plot_heatmap(ncdf) \ No newline at end of file +# path of the output netcdf file +ncdf <- "output/ensemble_output.nc" +# plot heatmap +plot_heatmap(ncdf) diff --git a/LakeMendota/run_lakeensemblr.R b/LakeMendota/run_lakeensemblr.R index 5cf8538..a7ded36 100755 --- a/LakeMendota/run_lakeensemblr.R +++ b/LakeMendota/run_lakeensemblr.R @@ -6,11 +6,11 @@ cat("\f") # set working directory setwd(dirname(rstudioapi::getSourceEditorContext()$path)) - +# load library library(LakeEnsemblR) # Set config file -config_file <- 'LER_Langtjern_1hour.yaml' +config_file <- "LakeEnsemblR.yaml" model <- c("FLake", "GLM", "GOTM", "Simstrat", "MyLake") # 1. Example - creates directories with all model setup export_config(config_file = config_file, model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), @@ -21,8 +21,7 @@ run_ensemble(config_file = config_file, return_list = FALSE, parallel = FALSE) -## Plot model output using gotmtools/ggplot2 -# Extract names of all the variables in netCDF -ncdf <- 'output/ensemble_output.nc' - -plot_heatmap(ncdf) \ No newline at end of file +# path of the output netcdf file +ncdf <- "output/ensemble_output.nc" +# plot heatmap +plot_heatmap(ncdf) diff --git a/Langtjern/run_lakeensemblr.R b/Langtjern/run_lakeensemblr.R index 5cf8538..8fa247f 100755 --- a/Langtjern/run_lakeensemblr.R +++ b/Langtjern/run_lakeensemblr.R @@ -6,11 +6,11 @@ cat("\f") # set working directory setwd(dirname(rstudioapi::getSourceEditorContext()$path)) - +# load library library(LakeEnsemblR) # Set config file -config_file <- 'LER_Langtjern_1hour.yaml' +config_file <- "LER_Langtjern_1hour.yaml" model <- c("FLake", "GLM", "GOTM", "Simstrat", "MyLake") # 1. Example - creates directories with all model setup export_config(config_file = config_file, model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), @@ -21,8 +21,7 @@ run_ensemble(config_file = config_file, return_list = FALSE, parallel = FALSE) -## Plot model output using gotmtools/ggplot2 -# Extract names of all the variables in netCDF -ncdf <- 'output/ensemble_output.nc' - -plot_heatmap(ncdf) \ No newline at end of file +# path of the output netcdf file +ncdf <- "output/ensemble_output.nc" +# plot heatmap +plot_heatmap(ncdf) diff --git a/LoughFeeagh/run_lakeensemblr.R b/LoughFeeagh/run_lakeensemblr.R index c5f8f31..1992361 100755 --- a/LoughFeeagh/run_lakeensemblr.R +++ b/LoughFeeagh/run_lakeensemblr.R @@ -6,11 +6,11 @@ cat("\f") # set working directory setwd(dirname(rstudioapi::getSourceEditorContext()$path)) - +# load library library(LakeEnsemblR) # Set config file -config_file <- 'LakeEnsemblR.yaml' +config_file <- "LakeEnsemblR.yaml" model <- c("FLake", "GLM", "GOTM", "Simstrat", "MyLake") # 1. Example - creates directories with all model setup export_config(config_file = config_file, model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), @@ -20,9 +20,7 @@ run_ensemble(config_file = config_file, model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"), return_list = FALSE, parallel = FALSE) - -## Plot model output using gotmtools/ggplot2 -# Extract names of all the variables in netCDF -ncdf <- 'output/ensemble_output.nc' - -plot_heatmap(ncdf) \ No newline at end of file +# path of the output netcdf file +ncdf <- "output/ensemble_output.nc" +# plot heatmap +plot_heatmap(ncdf)