Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
berthetclement committed Jun 4, 2024
1 parent b35be90 commit 8979d09
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
6 changes: 3 additions & 3 deletions R/readInputClusters.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ readInputThermal <- function(areas = "all",

res <- list() # Object the function will return

# ThermalAvailabilities processing
# ThermalAvailabilities processing (/series)
if (thermalAvailabilities){
thermalTS <- as.data.table(ldply(clusters, function(cl) {
areas <- allAreasClusters_filtered[cluster == cl]$area
Expand Down Expand Up @@ -119,7 +119,7 @@ readInputThermal <- function(areas = "all",
if (nrow(thermalTS) > 0) res$thermalAvailabilities <- thermalTS
}

# thermalModulation processing
# thermalModulation processing (/prepro/.../.../modulation.txt)
if (thermalModulation){
thermalMod <- as.data.table(ldply(areas, .importThermalModulation, opts = opts, timeStep = timeStep))
thermalMod <- thermalMod[cluster %in% clusters]
Expand All @@ -128,7 +128,7 @@ readInputThermal <- function(areas = "all",
if (nrow(thermalMod) > 0) res$thermalModulation <- thermalMod
}

# thermalData processing
# thermalData processing (/prepro/.../.../data.txt)
if (thermalData){
thermalDat <- as.data.table(ldply(areas, .importThermalData, opts = opts, timeStep = timeStep))
thermalDat <- thermalDat[cluster %in% clusters]
Expand Down
17 changes: 16 additions & 1 deletion tests/testthat/test-readInputClusters.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ sapply(studyPathS, function(studyPath){
if(!isH5Opts(opts)){

test_that("Thermal availabilities importation works", {
# read /series files (default)
input <- readInputThermal(clusters = "peak_must_run_partial", showProgress = FALSE)
expect_is(input, "antaresDataTable")
expect_gt(nrow(input), 0)
Expand All @@ -24,7 +25,7 @@ sapply(studyPathS, function(studyPath){
})

test_that("Thermal data importation works", {
input <- readInputThermal(clusters = "peak_must_run_partial", thermalModulation = TRUE, showProgress = FALSE)
input <- readInputThermal(clusters = "peak_must_run_partial", thermalData = TRUE, showProgress = FALSE, timeStep = 'daily')
expect_is(input, "antaresDataList")
expect_is(input$thermalModulation, "antaresDataTable")
expect_gt(nrow(input$thermalModulation), 0)
Expand All @@ -48,3 +49,17 @@ sapply(studyPathS, function(studyPath){

}
})

# >= v870 ----
## RES ----
test_that("test reading TS RES", {

# read latest version study
path_study_test <- grep(pattern = "87", x = studyPathSV8, value = TRUE)
setSimulationPath(path_study_test, simulation = "input")

toto= readInputRES(clusters = "at_res_1")

toto = readInputThermal(clusters = "at_gas")

})

0 comments on commit 8979d09

Please sign in to comment.