Skip to content

Commit

Permalink
fix writing results, fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa committed Jul 26, 2023
1 parent 0ab24e1 commit 45f05fa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ Imports:
MASS,
methods,
aws.s3,
Metrics
Metrics,
scales
License: GPL-3 | file LICENSE
BugReports: https://github.com/ncsu-landscape-dynamics/rpops/issues
URL: http://www.github.com/ncsu-landscape-dynamics/rpops
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ importFrom(sp,SpatialPointsDataFrame)
importFrom(sp,spTransform)
importFrom(stats,cov)
importFrom(stats,median)
importFrom(stats,quantile)
importFrom(stats,rnorm)
importFrom(stats,runif)
importFrom(stats,sd)
importFrom(stats,setNames)
importFrom(stats,weighted.mean)
importFrom(terra,app)
importFrom(terra,as.matrix)
importFrom(terra,as.points)
Expand Down
6 changes: 4 additions & 2 deletions R/optimize.R
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,9 @@ filter_particles <- function(points, weight_column, iteration, percentile) {
#' @param filter_percentile Lower value removes fewer pixels from the pool,
#' resulting in more iterations and lower acceptance rate, but potentially better results.
#' @param threshold_percentile Determines threshold for next iteration.
#' @param output_frequency Default is final_step, no need for yearly output

#' @importFrom stats quantile setNames weighted.mean
#' @useDynLib PoPS, .registration = TRUE
#' @return results
#' @export
Expand Down Expand Up @@ -469,6 +471,7 @@ optimize <- function(infestation_potential_file,
pesticide_efficacy = 1.0,
random_seed = NULL,
output_frequency = "final_step",
output_frequency_n = 1,
movements_file = "",
use_movements = FALSE,
start_exposed = FALSE,
Expand All @@ -479,7 +482,6 @@ optimize <- function(infestation_potential_file,
establishment_probability = 0.5,
dispersal_percentage = 0.99,
quarantine_areas_file = "",
quarantine_directions = "",
use_quarantine = FALSE,
use_spreadrates = FALSE,
use_overpopulation_movements = FALSE,
Expand Down Expand Up @@ -664,7 +666,7 @@ optimize <- function(infestation_potential_file,
file_name <- file.path(output_folder_path, "best_treatment.tif")
terra::writeRaster(results$best$treatment, file_name, overwrite = TRUE)
file_name <- file.path(output_folder_path, "best_guess_candidate.gpkg")
terra::writeVector(best_guess$result$candidate, file_name, overwrite = TRUE)
terra::writeVector(best_guess$candidate, file_name, overwrite = TRUE)
file_name <- file.path(output_folder_path, "output.rdata")
save(output, file = file_name)
}
Expand Down
6 changes: 2 additions & 4 deletions man/optimize.Rd

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

0 comments on commit 45f05fa

Please sign in to comment.