-
Notifications
You must be signed in to change notification settings - Fork 0
/
05_Uncertainty.R
31 lines (23 loc) · 1.06 KB
/
05_Uncertainty.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#Read all the prediction rasters save a stack as an rds file
####Select depending on which computer are you####
# for mario
basepath_ <- 'C:/Users/mfaj1435/OneDrive - The University of Sydney (Staff)/Molec_Eco/'
#for pinto
# basepath_ <- 'C:/Users/vpin5530/OneDrive - The University of Sydney (Staff)/Papers/My_articles/2nd_beta/'
#####
# get all predictions folders
folders_ <- c('Bacteria/UMAP1',
'Bacteria/UMAP2',
'Bacteria/UMAP3',
'ITS/UMAP1',
'ITS/UMAP2',
'ITS/UMAP3')
lapply(folders_, function(folder){
# browser()
name_pred <- gsub('/','',folder,perl = T)
predictions_ <- raster::stack(dir(paste0('R:/PRJ-Biodiversity/Transects/BiodiversityMaps/PredictionsARTEMIS/',folder),
pattern = 'cubistMap', full.names = T))
raster::writeRaster(predictions_[[1]],'check.tif',overwrite=TRUE)
uncertainty <- raster::calc(predictions_, sd)
raster::writeRaster(uncertainty,paste0(basepath_,'/plots_uncertainty/',name_pred,'.tif'))
})