diff --git a/DESCRIPTION b/DESCRIPTION index d659ea02..4c345666 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 diff --git a/NAMESPACE b/NAMESPACE index a2c5b2c5..7dbcb530 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) diff --git a/R/optimize.R b/R/optimize.R index e2b7dd3d..272a9661 100644 --- a/R/optimize.R +++ b/R/optimize.R @@ -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 @@ -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, @@ -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, @@ -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) } diff --git a/man/optimize.Rd b/man/optimize.Rd index b9b4f04e..ead02f5b 100644 --- a/man/optimize.Rd +++ b/man/optimize.Rd @@ -53,7 +53,7 @@ optimize( pesticide_duration = 0, pesticide_efficacy = 1, random_seed = NULL, - output_frequency = "year", + output_frequency = "final_step", output_frequency_n = 1, movements_file = "", use_movements = FALSE, @@ -65,7 +65,6 @@ optimize( establishment_probability = 0.5, dispersal_percentage = 0.99, quarantine_areas_file = "", - quarantine_directions = "", use_quarantine = FALSE, use_spreadrates = FALSE, use_overpopulation_movements = FALSE, @@ -262,8 +261,7 @@ successfully treats 70 percent of the plants or animals)} \item{random_seed}{sets the random seed for the simulation used for reproducibility} -\item{output_frequency}{sets when outputs occur either ('year', 'month', -'week', 'day', 'time step', or 'every_n_steps')} +\item{output_frequency}{Default is final_step, no need for yearly output} \item{output_frequency_n}{sets number of units from output_frequency in which to export model results if mortality_frequency is 'every_n_steps'.