Skip to content

Commit

Permalink
#66
Browse files Browse the repository at this point in the history
  • Loading branch information
gisma committed May 17, 2024
1 parent dc0f70c commit ca31727
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 94 deletions.
4 changes: 2 additions & 2 deletions R/initProj.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ initProj <- function(root_folder = ".",
folders = NULL,
init_git = NULL,
init_renv = NULL,
code_subfolder = c("src", "src/functions", "src/config"),
code_subfolder = c("src", "src/functions", "src/configs"),
global = FALSE,
openproject = NULL, newsession = TRUE,
standard_setup = "baseSpatial",
Expand Down Expand Up @@ -226,7 +226,7 @@ initProj <- function(root_folder = ".",
brew::brew(system.file(sprintf("templates/%s.brew", "pre-processing"), package = "link2GI"), file.path(dirs$src, "pre-processing.R"))
brew::brew(system.file(sprintf("templates/%s.brew", "processing"), package = "link2GI"), file.path(dirs$src, "10-processing.R"))
brew::brew(system.file(sprintf("templates/%s.brew", "post-processing"), package = "link2GI"), file.path(dirs$src, "post-processing.R"))
brew::brew(system.file(sprintf("templates/%s.brew", "config-master-yml"), package = "link2GI"), file.path(dirs$src, "config-master-yml"))
brew::brew(system.file(sprintf("templates/%s.brew", "config-master-yml"), package = "link2GI"), file.path(dirs$config, "config-master.yml"))
brew::brew(system.file(sprintf("templates/%s.brew", standard_setup), package = "link2GI"),file.path(dirs$functions, "000_setup.R"))
brew::brew(system.file(sprintf("templates/%s.brew", "yml"), package = "link2GI"),file.path(dirs$config, "pre-processing.yml"))
brew::brew(system.file(sprintf("templates/%s.brew", "yml"), package = "link2GI"),file.path(dirs$config, "processing.yml"))
Expand Down
46 changes: 2 additions & 44 deletions inst/templates/advancedSpatial.brew
Original file line number Diff line number Diff line change
Expand Up @@ -27,53 +27,11 @@ if (!exists("root_folder")) {
stop("variable root_folder is NOT defined, You must define a root folder!")
}


root_folder = envimaR::alternativeEnvi(root_folder = root_folder,
alt_env_id = alt_env_id,
alt_env_value = alt_env_value,
alt_env_root_folder = alt_env_root_folder)

# mandantory folder structure
projectDirList = c("data/", # data folders the following are default but you may add more
"run/", # folder for runtime data as used by the API calls
paste0("data/",config_master$loc_name,"/data_lev0/"), # folder for level 0 data (raw or source data)
paste0("data/",config_master$loc_name,"/data_lev1/"), # folder for level 1 data (clean data)
paste0("data/",config_master$loc_name,"/data_lev2/"), # folder for level 2 data (final data)
paste0("data/",config_master$loc_name,"/auxdata/"), # folder for auxilliay data
"src/", # all scripts
"src/functions/", # all functions
"src/configs/", # all yaml configuration files
"tmp/", # all temp stuff
"doc/", # documentation and markdown
"doc/figures/") # documentation all figures etc

# append additional folders if defined by calling script
if (exists("appendProjectDirList") && appendProjectDirList[[1]] != "")
{
projectDirList = append(projectDirList,appendProjectDirList)
}

# call central function
envrmt = link2GI::setupProj(root_folder = root_folder,
dirs = link2GI::setupProj(root_folder = root_folder,
folders = projectDirList,
fcts_folder = "src/functions/",
path_prefix = NULL,
libs = libs,
create_folders = TRUE)


ndvi.col = function(n) {
rev(colorspace::sequential_hcl(n, "Green-Yellow"))
}

ano.col = colorspace::diverging_hcl(7, palette = "Red-Green", register = "rg")


## set temp path to speed up raster package operations
raster::rasterOptions(tmpdir = dirs$path_tmp)
fcts_folder = code_subfolders)

# Define more variables

# Load more data


45 changes: 2 additions & 43 deletions inst/templates/base.brew
Original file line number Diff line number Diff line change
Expand Up @@ -28,52 +28,11 @@ if (!exists("root_folder")) {
}


root_folder = envimaR::alternativeEnvi(root_folder = root_folder,
alt_env_id = alt_env_id,
alt_env_value = alt_env_value,
alt_env_root_folder = alt_env_root_folder)

# mandantory folder structure
projectDirList = c("data/", # data folders the following are default but you may add more
"run/", # folder for runtime data as used by the API calls
paste0("data/",config_master$loc_name,"/data_lev0/"), # folder for level 0 data (raw or source data)
paste0("data/",config_master$loc_name,"/data_lev1/"), # folder for level 1 data (clean data)
paste0("data/",config_master$loc_name,"/data_lev2/"), # folder for level 2 data (final data)
paste0("data/",config_master$loc_name,"/auxdata/"), # folder for auxilliay data
"src/", # all scripts
"src/functions/", # all functions
"src/configs/", # all yaml configuration files
"tmp/", # all temp stuff
"doc/", # documentation and markdown
"doc/figures/") # documentation all figures etc

# append additional folders if defined by calling script
if (exists("appendProjectDirList") && appendProjectDirList[[1]] != "")
{
projectDirList = append(projectDirList,appendProjectDirList)
}

# call central function
envrmt = link2GI::setupProj(root_folder = root_folder,
dirs = link2GI::setupProj(root_folder = root_folder,
folders = projectDirList,
fcts_folder = "src/functions/",
path_prefix = NULL,
libs = libs,
create_folders = TRUE)


ndvi.col = function(n) {
rev(colorspace::sequential_hcl(n, "Green-Yellow"))
}

ano.col = colorspace::diverging_hcl(7, palette = "Red-Green", register = "rg")


## set temp path to speed up raster package operations
raster::rasterOptions(tmpdir = dirs$path_tmp)
fcts_folder = code_subfolders)

# Define more variables

# Load more data


6 changes: 3 additions & 3 deletions inst/templates/config-default-projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ base:
tmpFolder: ["tmp"]
init_git: true
init_renv: true
code_subfolder: ["src", "src/functions" , "src/config"]
code_subfolder: ["src", "src/functions" , "src/configs"]
global: false
libs: ""
create_folders: true
Expand All @@ -13,7 +13,7 @@ baseSpatial:
dataFolder: ["level0", "level1", "level2", "run" ,"aux"]
docsFolder: [ "figures"]
tmpFolder: ["tmp"]
code_subfolder: ["src", "src/functions" , "src/config"]
code_subfolder: ["src", "src/functions" , "src/configs"]
init_git: true
init_renv: true
global: false
Expand All @@ -24,7 +24,7 @@ advancedSpatial:
dataFolder: ["level0", "level1", "level2", "run"]
docsFolder: [ "figures"]
tmpFolder: ["tmp"]
code_subfolder: ["src", "src/functions" , "src/config"]
code_subfolder: ["src", "src/functions" , "src/configs"]
init_git: true
init_renv: true
global: false
Expand Down
2 changes: 1 addition & 1 deletion inst/templates/readme.brew
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ In order to have the standard packages and the project structure available, the

It automatically sources the file `000_setup.R`, which contains the basic settings for the selected setup type.

These can of course be extended manually and adapted to the respective requirements. The paths to the directories are stored in the `envrmt` list
These can of course be extended manually and adapted to the respective requirements. The paths to the directories are stored in the dir` list
2 changes: 1 addition & 1 deletion man/initProj.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ca31727

Please sign in to comment.