Skip to content
Snippets Groups Projects
Commit fd5a8f80 authored by Maria Voigt's avatar Maria Voigt
Browse files

including alternative to have focal predictors and name suffixes

parent 7b9e5d1f
Branches
No related tags found
No related merge requests found
...@@ -106,6 +106,9 @@ print(paste("for year to predict" , year_to_predict)) ...@@ -106,6 +106,9 @@ print(paste("for year to predict" , year_to_predict))
exclude_year <- as.numeric(options$exclude_year) exclude_year <- as.numeric(options$exclude_year)
if(is_verbose){print(paste("exclude year", exclude_year))} if(is_verbose){print(paste("exclude year", exclude_year))}
focal_change_predictor <- options$focal_change_predictor
if(is_verbose){print(paste("focal_change_predictor", focal_change_predictor))}
if(is_verbose){print(paste(Sys.time(), "0. start run"))} if(is_verbose){print(paste(Sys.time(), "0. start run"))}
#------------------------# #------------------------#
# command line arguments # # command line arguments #
...@@ -116,10 +119,12 @@ indir_fun <- "~/orangutan_density_distribution/src/functions/" ...@@ -116,10 +119,12 @@ indir_fun <- "~/orangutan_density_distribution/src/functions/"
crs_aea <- "+proj=aea +lat_1=7 +lat_2=-32 +lat_0=-15 +lon_0=125 +x_0=0 crs_aea <- "+proj=aea +lat_1=7 +lat_2=-32 +lat_0=-15 +lon_0=125 +x_0=0
+y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" # final projection +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" # final projection
if (is.na(exclude_year)){ if (!is.na(exclude_year)){
name_suffix <- ""} else {
name_suffix <- paste0(exclude_year, "_") name_suffix <- paste0(exclude_year, "_")
} }else{
if (!is.na(focal_change_predictor)){
name_suffix <- paste0(focal_change_predictor, "_") }else{
name_suffix <- ""}}
#----------------# #----------------#
# Load functions # # Load functions #
...@@ -181,10 +186,15 @@ if(is_verbose){print(paste("this is predictors path", predictors_path))} ...@@ -181,10 +186,15 @@ if(is_verbose){print(paste("this is predictors path", predictors_path))}
predictors <- readRDS(predictors_path) predictors <- readRDS(predictors_path)
# import here the already z-transformed or not # import here the already z-transformed or not
if (!is.na(exclude_year)){
predictors_obs_path <- path.to.current(indir, predictors_obs_path <- path.to.current(indir,
paste0("predictors_observation_scaled_", paste0("predictors_observation_scaled_",
name_suffix), name_suffix),
"rds") "rds")} else{
predictors_obs_path <- path.to.current(indir, "predictors_observation_scaled_",
"rds")}
if(is_verbose){print(paste("this is predictors-obs path", predictors_obs_path))} if(is_verbose){print(paste("this is predictors-obs path", predictors_obs_path))}
predictors_obs <- readRDS(predictors_obs_path) predictors_obs <- readRDS(predictors_obs_path)
...@@ -227,7 +237,7 @@ if(!is.na(focal_change_predictor)){ ...@@ -227,7 +237,7 @@ if(!is.na(focal_change_predictor)){
# load 1999 value to add the values, but use the scaled table # load 1999 value to add the values, but use the scaled table
predictors_grid_1999_path <- path.to.current(indir, predictors_grid_1999_path <- path.to.current(indir,
paste0("predictors_grid_scaled_", paste0("predictors_grid_scaled_",
name_suffix, 1999), 1999),
"rds") "rds")
predictors_grid_1999 <- readRDS( predictors_grid_1999_path) predictors_grid_1999 <- readRDS( predictors_grid_1999_path)
change_predictors <- c("year", "peatswamp", change_predictors <- c("year", "peatswamp",
...@@ -298,11 +308,6 @@ print(paste(Sys.time(), ...@@ -298,11 +308,6 @@ print(paste(Sys.time(),
sum(pred_per_cell$abundance_pred > 10))) sum(pred_per_cell$abundance_pred > 10)))
if (is.na(exclude_year)){
name_suffix <- ""} else {
name_suffix <- paste0(exclude_year, "_")
}
saveRDS(pred_per_cell, saveRDS(pred_per_cell,
file = file.path(outdir, file = file.path(outdir,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment