Skip to content

Commit

Permalink
deplace code after check
Browse files Browse the repository at this point in the history
  • Loading branch information
MAHOUDI Abdallah (Externe) committed May 23, 2024
1 parent 6282c1b commit 8314bc9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
12 changes: 7 additions & 5 deletions R/createClusterST.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ createClusterST <- function(area,
##
assertthat::assert_that(inherits(storage_parameters, "list"))

if (storage_parameters$initiallevel != 0.5 & !storage_parameters$initialleveloptim) {
warning("`initiallevel` value will be replaced by 0.5 because `initialleveloptim` = FALSE.")
storage_parameters$initiallevel <- 0.5
}

# static name of list parameters
names_parameters <- names(storage_values_default())

Expand All @@ -150,6 +145,13 @@ createClusterST <- function(area,
# check values parameters
.st_mandatory_params(list_values = storage_parameters)

# check value for initiallevel

if (storage_parameters$initiallevel != 0.5 & !storage_parameters$initialleveloptim) {
warning("`initiallevel` value will be replaced by 0.5 because `initialleveloptim` = FALSE.")
storage_parameters$initiallevel <- 0.5
}


# DATA parameters : default value + name txt file
storage_value <- list(PMAX_injection = list(N=1, string = "PMAX-injection"),
Expand Down
11 changes: 6 additions & 5 deletions R/editClusterST.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ editClusterST <- function(area,

if(!is.null(storage_parameters)){
assertthat::assert_that(inherits(storage_parameters, "list"))

if (storage_parameters$initiallevel != 0.5 & !storage_parameters$initialleveloptim) {
warning("`initiallevel` value will be replaced by 0.5 because `initialleveloptim` = FALSE.")
storage_parameters$initiallevel <- 0.5
}

# static name of list parameters
names_parameters <- names(storage_values_default())
Expand All @@ -86,6 +81,12 @@ editClusterST <- function(area,
# check values parameters
.st_mandatory_params(list_values = storage_parameters)

# check value for initiallevel
if (storage_parameters$initiallevel != 0.5 & !storage_parameters$initialleveloptim) {
warning("`initiallevel` value will be replaced by 0.5 because `initialleveloptim` = FALSE.")
storage_parameters$initiallevel <- 0.5
}

# check list of parameters
params_cluster <- hyphenize_names(storage_parameters)
}
Expand Down

0 comments on commit 8314bc9

Please sign in to comment.