Skip to content

Commit

Permalink
update Occ_model_resultsv3
Browse files Browse the repository at this point in the history
  • Loading branch information
vicjulrin committed Jul 18, 2024
1 parent 93cc869 commit 41c97c9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion scripts/occ_model_resultsv3/occ_model_resultsv3.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,30 @@ occ_avg<- if(nrow(test_models)<=1){







##########
#Prediction
##########
# Load data of prediction surface
site_covs_Layers<- input$site_covs_Layers %>% setNames(basename(tools::file_path_sans_ext(.)))
site_covs_Layers<- lapply(input$site_covs_Layers, function(y) { text_ext<- tools::file_ext(y)
if(text_ext != ""){
if(file.exists(y)){y}else{NULL}
} else {
test_folder<- dir.exists(y)
if(test_folder){ list.files(y, full.names = T, recursive = F, pattern = "\\.tif$") %>% {.[!grepl("\\.tfw$|~$", .)]} } else { NULL }
}
}) %>% unlist() %>% setNames(basename(tools::file_path_sans_ext(.)))

spatial_pred_surface<- site_covs_Layers[ names(site_covs_Layers) %>% {.[. %in% site_covs]} ] %>% terra::rast() %>% setNames(site_covs)






id_cells<- terra::cells(spatial_pred_surface)
pred_surface <- spatial_pred_surface[id_cells]

Expand Down
2 changes: 1 addition & 1 deletion scripts/occ_model_resultsv3/occ_model_resultsv3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inputs:
label: site_covs_Layers
description: "List of site variables (site/landscape characteristics that influence species detection and occupancy). They can be specified by name or through the directory where they are stored in .tif format. Names must match the columns in camptrap_data or will be omitted."
type: image/tiff;application=geotiff[]
example: ["scripts/occ_model_resultsv3/input/"]
example: ["scripts/occ_model_resultsv3/input/dir_stack"]
obs_covs:
label: obs_covs
description: "List of observation variables (hour, lunar phase, climate) that must match columns in camptrap_data or will be omitted. As they can vary by event, they must be grouped/collapsed for the unmarked object. When they are factors, they are not rounded. Numeric variables are specified as eventTime|1, where 1 is the rounding value. For temporal variables, use eventTime|1|hour. Temporal units from lubridate::round_date are accepted."
Expand Down

0 comments on commit 41c97c9

Please sign in to comment.