Generate slurm script for curating probability distributions from extracted ALFRESCO data.

alf_prep_slurm(out_dir = alfdef()$alf_slurm_dir, file = "alf_prep.R",
  inputs = NULL, outputs = NULL, project = NULL, period = NULL,
  reps = NULL, email = "mfleonawicz@alaska.edu", exclusive = TRUE,
  copy_rscript = TRUE)

Arguments

out_dir

the directory containing file. This is where the slurm script is to be saved and executed from.

file

the R script to be called by Rscript when the generated slurm script is executed. May be similarly generated by this function. See copy_rscript below.

inputs

override the default directory where input .rds files containing extracted data are stored.

outputs

override the default directory where distributions .rds files are output.

project

character, a (new) project name for extracted data. It need not match any directory names pertaining to the raw ALFRESCO outputs.

period

character, "historical" or "projected".

reps

numeric vector of ALFRESCO simulation replicates for data extraction, e.g. 1:200.

email

defaults to the author/maintainer/user.

exclusive

logical, put CPUs on an Atlas compute node into exclusive use for the job when the generated slurm script is executed. Defaults to TRUE.

copy_rscript

logical, also copy template R script from alfresco package along with the generated slurm script. Defaults to TRUE.

Details

This function is used for generating a slurm script that is used for curating probability distributions of random variables previously extracted from ALFRESCO geotiff map outputs. The distributions are stored in data frames in .rds files for subsequent analyses in various projects. The generated slurm script is used to call an R script with Rscript, e.g., that created by alf_prep_rscript.

Formal SLURM job arguments are passed by exclusive and email. General script setup arguments include out_dir, file and copy_rscript. All other arguments refer to those passed to the Rscript call within the slurm script. These include inputs, outputs, project, period and reps. If NULL, they are ignored. Provide non-NULL arguments to override alfresco package defaults for inputs and outputs. It is assumed that any of these four arguments will be passed as name-value pairs (in any order) at the command line by the user when the generated slurm script is executed. Any of these arguments that are not NULL are hardcoded into the string of arguments listed after Rscript.

This provides flexible generality when generating ALFRESCO data prep slurm scripts. Note that the number of non-null arguments among these decreases the number of available general arguments available at the command line when the script is executed. For example, if three of five arguments available to Rscript are hardcoded into the slurm script by passing them to alf_prep_slurm explicitly, then the generated script will show only an additional $1 $2 after the fixed arguments rather than $1 $2 $3 $4 $5.

Note that this function is intended to be run on the Atlas cluster. If you make a bash script like this on Windows, you may have to run a command line utility like dos2unix on the file.

Examples

# NOT RUN {
alf_prep_slurm(project = "JFSP", reps = 1:32)
# }