Skip to content

Commit

Permalink
minor: all dataPath changed to dPath in comment (keep dataPath usage …
Browse files Browse the repository at this point in the history
…to SpaDES::dataPath() for consistency)
  • Loading branch information
CeresBarros committed Nov 15, 2018
1 parent 8445995 commit 80c619e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions R/loadkNNSpeciesLayers.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
## Defaults to 1
## url: is the source url for the data, passed to prepInputs.

loadkNNSpeciesLayers <- function(dataPath, rasterToMatch, studyArea,
loadkNNSpeciesLayers <- function(dPath, rasterToMatch, studyArea,
speciesList = NULL, thresh = 1, url, cachePath, ...) {


Expand All @@ -38,20 +38,20 @@ loadkNNSpeciesLayers <- function(dataPath, rasterToMatch, studyArea,

species1 <- Cache(loadFun, url = url, spp = speciesList, #[, "speciesNamesRaw"],
#loadFun,
dataPath = dataPath,
dPath = dPath,
suffix = suffix,
studyArea = studyArea, rasterToMatch = rasterToMatch,
userTags = "kNN_SppLoad")
# species1 <- Cache(lapply, seq_len(NROW(speciesList)),
# spp = speciesList, #[, "speciesNamesRaw"],
# loadFun, url = url, dataPath = dataPath,
# loadFun, url = url, dPath = dPath,
# suffix = suffix,
# studyArea = studyArea, rasterToMatch = rasterToMatch,
# userTags = "kNN_SppLoad")

## get all kNN species
if (FALSE) { #TODO This no longer does all species }
allSpp <- Cache(untar, tarfile = file.path(dataPath, "kNN-Species.tar"), list = TRUE)
allSpp <- Cache(untar, tarfile = file.path(dPath, "kNN-Species.tar"), list = TRUE)
allSpp <- allSpp %>%
grep(".zip", ., value = TRUE) %>%
sub("_v0.zip", "", .) %>%
Expand Down Expand Up @@ -83,7 +83,7 @@ loadkNNSpeciesLayers <- function(dataPath, rasterToMatch, studyArea,
sumSpecies <- spp2sum[[i]]
newLayerName <- names(spp2sum)[i]

fname <- .suffix(file.path(dataPath, paste0("KNN", newLayerName, ".tif")), suffix)
fname <- .suffix(file.path(dPath, paste0("KNN", newLayerName, ".tif")), suffix)
a <- Cache(sumRastersBySpecies,
speciesLayers = species1[sumSpecies],
newLayerName = newLayerName,
Expand Down Expand Up @@ -135,7 +135,7 @@ sumRastersBySpecies <- function(speciesLayers, layersToSum,
ras_out # Work around for Cache
}

loadFun <- function(speciesListIndex, spp, suffix, url, dataPath,
loadFun <- function(speciesListIndex, spp, suffix, url, dPath,
studyArea, rasterToMatch) {

if (is.null(spp)) {
Expand Down Expand Up @@ -173,7 +173,7 @@ loadFun <- function(speciesListIndex, spp, suffix, url, dataPath,
targetFile = targetFile,
url = url,
archive = archive,
destinationPath = asPath(dataPath),
destinationPath = asPath(dPath),
fun = "raster::raster")#,
#studyArea = studyArea,
#rasterToMatch = rasterToMatch,
Expand Down Expand Up @@ -203,7 +203,7 @@ loadFun <- function(speciesListIndex, spp, suffix, url, dataPath,
species1 <- Map(targetFile = targetFiles, archive = archives,
filename2 = postProcessedFilenames,
MoreArgs = list(url = url,
destinationPath = asPath(dataPath),
destinationPath = asPath(dPath),
fun = "raster::raster",
studyArea = studyArea,
rasterToMatch = rasterToMatch,
Expand All @@ -216,7 +216,7 @@ loadFun <- function(speciesListIndex, spp, suffix, url, dataPath,
# targetFile = targetFile,
# url = url,
# archive = archive,
# destinationPath = asPath(dataPath),
# destinationPath = asPath(dPath),
# fun = "raster::raster",
# studyArea = studyArea,
# rasterToMatch = rasterToMatch,
Expand Down

0 comments on commit 80c619e

Please sign in to comment.