I have several thousand small glacier rasters (in rectangular shape) that need to be clipped to the glacier's extent. I have the glacier polygons stored in a large SpatialPolygonsDataFrame (matching in length and position).
I need parallel computing or else it would take forever, so I would like to use the rslurm
package.
My code so far (using the for-loop provided here: https://gis.stackexchange.com/a/342955/145570)
library(rslurm)
fun_clip_rslurm <- function(filelocations, filenames, glaciers){
for(i in 1:length(filelocations)){
r = raster(filelocations[i]) # get the ith file name
g = glaciers[i,] # get the i'th row of `glaciers`.
r = crop(r, g) # crop
writeRaster(r, file.path("/data/.../RGI60-13_crop/", filenames[i]))
}
}
params <- list(filelocations, filenames, glaciers)
names(params) <- c("filelocations", "filenames", "glaciers")
slurm_call(fun_clip_rslurm, params, jobname = "my_crop",
slurm_options = list(time="1-00:00:00", share =TRUE),
submit = TRUE)
If I run this, I get the following error message:
sbatch: error: Batch job submission failed: Invalid account or account/partition combination specified
$jobname
[1] "my_crop"
$nodes
[1] 1
attr(,"class")
[1] "slurm_job"
So now I have two questions:
Do I have to give rslurm
some kind of permission to run the batch-script on the cluster?
And how can I specify the number of nodes on which to run the calculation?