Skip to content
Snippets Groups Projects
Commit f9ffacf5 authored by Francesco Sabatini's avatar Francesco Sabatini
Browse files

Fixed minor bugs for submitting array jobs

parent 9539a520
No related branches found
No related tags found
No related merge requests found
......@@ -7,11 +7,14 @@ PredExtr <- function(x.shp, myfunction=NA, output,
require(doParallel)
require(raster)
require(rgeos)
require(rgdal)
print(paste("Loading", typp, "data :", toextract))
if(typp=="raster"){ mypredictor <- raster(toextract)} else
mypredictor <- readOGR(toextract)
header.shp <-readOGR(x.shp)
crs(mypredictor) <- crs(header.shp) #should be verified beforehand!
## Divide in chunks if requested
if(chunkn>1 & !is.na(chunk.i)){
print(paste("divide in chunks and run on chunk n.", chunk.i))
......@@ -41,6 +44,8 @@ PredExtr <- function(x.shp, myfunction=NA, output,
} else {
out <- sp::over(x=header.shp, y=mypredictor)
toassign <- header.shp[which(is.na(out[,1])),]
print(paste(length(toassign), "plots not matched directely - seek for NN"))
nearest <- foreach(i=1:length(toassign), .packages=c('raster'), .combine=rbind) %dopar% {
nearest.tmp <- geosphere::dist2Line(toassign[i,], mypredictor)
......
......@@ -30,7 +30,7 @@ options <- list (
metavar = "4"
),
make_option(
opt_str = c("-c", "--chunkn"),
opt_str = c("-n", "--chunkn"),
dest = "chunkn",
type = "integer",
default = 1,
......
......@@ -7,9 +7,9 @@
#$ -j y
#$ -l h_rt=00:30:00:00
#$ -l h_vmem=3G
#$ -l h_vmem=1G
#$ -pe smp 4-32
#$ -pe smp 8-32
#$ -cwd
......@@ -26,10 +26,10 @@ output=/work/$USER/output_pred/$(basename $filename .shp).csv
Rscript \
cli_A98.r \
--cores ${NSLOTS:-1} \
--typp \
--typp "shp" \
--chunk.i $SGE_TASK_ID \
--chunkn 99 \
/data/splot/_data/header.shp.RData \
/data/splot/_data_splot3/header.shp.shp \
robust.mean \
"$output" \
"$filename"
\ No newline at end of file
"$filename"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment