Skip to content

Commit

Permalink
rename shpStudySubRegion --> shpStudyArea
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotmcintire committed Oct 23, 2018
1 parent 254ab18 commit 8be89e8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions Boreal_LBMRDataPrep.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ defineModule(sim, list(
expectsInput("seedingAlgorithm", "character",
desc = "choose which seeding algorithm will be used among noDispersal, universalDispersal,
and wardDispersal, default is wardDispersal"),
expectsInput("shpStudySubRegion", "SpatialPolygonsDataFrame",
expectsInput("shpStudyArea", "SpatialPolygonsDataFrame",
desc = "this shape file contains two informaton: Sub study area with fire return interval attribute",
sourceURL = NA), # i guess this is study area and fire return interval
expectsInput("shpStudyRegionFull", "SpatialPolygonsDataFrame",
Expand Down Expand Up @@ -416,17 +416,17 @@ Save <- function(sim) {
sim$shpStudyRegionFull <- SpaDES.tools::randomPolygon(x = polyCenter, hectares = 10000)
}

if (!suppliedElsewhere("shpStudySubRegion", sim)) {
message("'shpStudySubRegion' was not provided by user. Using the same as 'shpStudyRegionFull'")
sim$shpStudySubRegion <- sim$shpStudyRegionFull
if (!suppliedElsewhere("shpStudyArea", sim)) {
message("'shpStudyArea' was not provided by user. Using the same as 'shpStudyRegionFull'")
sim$shpStudyArea <- sim$shpStudyRegionFull
}

if (!identical(crsUsed, crs(sim$shpStudyRegionFull))) {
sim$shpStudyRegionFull <- spTransform(sim$shpStudyRegionFull, crsUsed) #faster without Cache
}

if (!identical(crsUsed, crs(sim$shpStudySubRegion))) {
sim$shpStudySubRegion <- spTransform(sim$shpStudySubRegion, crsUsed) #faster without Cache
if (!identical(crsUsed, crs(sim$shpStudyArea))) {
sim$shpStudyArea <- spTransform(sim$shpStudyArea, crsUsed) #faster without Cache
}

cacheTags = c(currentModule(sim), "function:.inputObjects", "function:spades")
Expand All @@ -438,7 +438,7 @@ Save <- function(sim) {
"NFI_MODIS250m_kNN_Structure_Biomass_TotalLiveAboveGround_v0.zip")),
url = extractURL("biomassMap"),
destinationPath = dPath,
studyArea = sim$shpStudySubRegion,
studyArea = sim$shpStudyArea,
useSAcrs = TRUE,
method = "bilinear",
datatype = "INT2U",
Expand All @@ -453,7 +453,7 @@ Save <- function(sim) {
archive = asPath("LandCoverOfCanada2005_V1_4.zip"),
url = extractURL("LCC2005"),
destinationPath = dPath,
studyArea = sim$shpStudySubRegion,
studyArea = sim$shpStudyArea,
rasterToMatch = sim$biomassMap,
method = "bilinear",
datatype = "INT2U",
Expand Down
2 changes: 1 addition & 1 deletion Boreal_LBMRDataPrep.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Plot(shpStudyAreaLarge, addTo = "canadaMap", col = "red")
times <- list(start = 0, end = 10)
modules <- list("Boreal_LBMRDataPrep")
objects <- if (handDrawMap) list("shpStudyAreaLarge" = shpStudyAreaLarge,
"shpStudySubRegion" = shpStudyAreaLarge) else list()
"shpStudyArea" = shpStudyAreaLarge) else list()
mySim <- simInit(times = times, params = parameters, modules = modules,
objects = objects)
Expand Down
2 changes: 1 addition & 1 deletion R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ fasterizeFromSp <- function(sp, raster, fieldName) {
fasterize::fasterize(tempSf, raster)
} else
fasterize::fasterize(tempSf, raster, field = fieldName)
}
}

0 comments on commit 8be89e8

Please sign in to comment.