diff --git a/1- DataPreparationJRC.R b/1- DataPreparationJRC.R new file mode 100644 index 0000000000000000000000000000000000000000..8aee23162b5086b9e6d22e67db85b175036b485f --- /dev/null +++ b/1- DataPreparationJRC.R @@ -0,0 +1,35 @@ +library(sf) +library(terra) +library(ggplot2) +library(dplyr) +library(tidyr) +library(clhs) +library(viridis) +library(tmap) + +# 1 Data preparation ----- + +setwd("~/serena/data/sml/europe/") +stacka <- rast(c("FR_OC.tif", "FR_pH.tif" , "FR_TXT.tif","FR_N.tif","FR_P.tif", + "FR_CEC.tif","FR_BD010.tif") ) + +stackb <- rast(c("FR_CLC.tif", "FR_NUTS2.tif","FR_NUTS1.tif")) +stack = c(stacka,stackb) + +change = FALSE # set true to resample rasters + +if(change) { + # Change resolution + stac500a <- terra::aggregate(stacka, 5, fun=mean) + stac500b <- terra::aggregate(stackb, 5, fun=modal) + stack500 = c(stac500a,stac500b) + + terra::writeRaster(stack500,filename = "~/serena/data/sml/europe/stack500.tiff", + overwrite = TRUE) + +} else { + stack500 = rast("~/serena/data/sml/europe/stack500.tiff") + +} + + diff --git a/1-SMLFilltableJRCTests.R b/2-SMLFilltableJRCTests.R similarity index 100% rename from 1-SMLFilltableJRCTests.R rename to 2-SMLFilltableJRCTests.R diff --git a/README.md b/README.md index 81fb8026d2874ff0af57ff629cd370fd828df2fc..bbbce66ad16d67479d4b2248e93c293d53ba87f9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ this project to share the statistical work on sampling exercise # code -use smltest.R to run the optimisation algorithm +use 2-SMLFilltableJRCTests.R to run different tests required. +use 1-DataPreparationJRC.R to prepare the rasters from JRC sharepoint # Questions