Skip to content

Commit

Permalink
Unzip forecasts files in resources.
Browse files Browse the repository at this point in the history
setup_production() creates a resource dir with a forecast dir
  • Loading branch information
henrykironde committed Dec 13, 2023
1 parent 7907852 commit 5220f6f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions R/fill_dir.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ fill_resources <- function (main = ".") {

update_directory_configuration(main = main)

# unzip the resource forecast zipped files
resource_forecasts = file.path(main, settings$subdirectories$resources, settings$repository, settings$subdirectories$forecasts)
resource_forecasts = normalizePath(resource_forecasts, mustWork = FALSE)
if (file.exists(resource_forecasts)) {
zip_unzip("unzip", forecast_path = resource_forecasts)
}
invisible( )

}
Expand Down Expand Up @@ -237,14 +243,17 @@ fill_forecasts <- function (main = ".") {
messageq(paste0(" Located ", length(files), " forecast file(s) in resources to be moved to directory ..."), quiet = settings$quiet)
messageq(" ... moving ... ", quiet = settings$quiet)

# zip the forecast files before copying them back
zip_unzip("zip", forecast_path = forecasts_path(main = main))

copied <- file.copy(from = files,
to = forecasts_path(main = main),
recursive = TRUE)

messageq(paste0(" ... ", sum(copied), " files moved. "), quiet = settings$quiet)

# unzip the forecast zipped files
zip_unzip("unzip", forecast_path = forecasts_path(main = main))
# zip the forecast zipped files
zip_unzip("zip", forecast_path = forecasts_path(main = main))
invisible( )

}
Expand Down

0 comments on commit 5220f6f

Please sign in to comment.