-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprepare_rasters.Rd
60 lines (54 loc) · 2.05 KB
/
prepare_rasters.Rd
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_important_rasters.R
\name{prepare_rasters}
\alias{prepare_rasters}
\title{Script to extract raster data for all sampling localities
and find the most important features.}
\usage{
prepare_rasters(
raster.dir,
sample.file,
header = TRUE,
bb.buffer = 10,
plotDIR = "./plots",
showPLOTS = FALSE
)
}
\arguments{
\item{raster.dir}{Directory of rasters to load and crop}
\item{sample.file}{CSV file with sample information (sampleID,popID,lat,lon)}
\item{header}{Boolean; Does sample.file have a header line?}
\item{bb.buffer}{Integer; Buffer around sample bounding box.
bb.buffer = bb.buffer * resolution (in arc-seconds)}
\item{plotDIR}{Directory to save plots to}
\item{showPLOTS}{Boolean; Whether to print plots to screen}
}
\value{
List with cropped rasters and other info
}
\description{
This script takes as input a directory of rasters, crops them to the
sampling extent, finds the raster values at each sample locality,
and uses MAXENT and ENMeval to determine the most important raster
layers (i.e. features).
}
\details{
Function to load in and crop the raster layers to the sampling extent
This function takes as input a directory of rasters. Only the desired
rasters should be included in raster.dir. You also will need a
comma-delimited sample.file that has four columns in a specific order:
(sampleIDs,populationIDs,latitude,longitude). You can choose if a header
line is present. The rasters will all be put into a stack and cropped to
the extent of the sample localities + bb.buffer.
}
\examples{
envList <- prepare_rasters(raster.dir = "uncroppedLayers",
sample.file = file.path("exampleData",
"ENMeval_bioclim",
"localityInfo",
"sample_localities_maxent_southeast_noNA.csv"),
header = TRUE,
bb.buffer = 10,
plotDIR = "./plots",
showPLOTS = TRUE)
}