coordsGridCenter <- expand.grid(list(x = seq(50.5, 100, 1),
y = seq(100.5, 150, 1)))
coordsData <- expand.grid(list(x = seq(60, 90, 1),
y = seq(110, 140, 1)))
plot(coordsGridCenter[,2] ~ coordsGridCenter[,1])
points(coordsData[,2] ~ coordsData[,1], col="red")
scaled <- scaleCoordsToHabitatGrid(coordsData = coordsData
, coordsHabitatGridCenter = coordsGridCenter)
plot(scaled$coordsHabitatGridCenterScaled[,2] ~ scaled$coordsHabitatGridCenterScaled[,1])
points(scaled$coordsDataScaled[,2] ~ scaled$coordsDataScaled[,1], col="red")
LowerAndUpperCoords <- getWindowCoords(scaledHabGridCenter = scaled$coordsHabitatGridCenterScaled,
scaledObsGridCenter = scaled$coordsDataScaled)
# Plot habitat window cell centers and lower/upper coordinates
plot(scaled$coordsHabitatGridCenterScaled[,2] ~
scaled$coordsHabitatGridCenterScaled[,1],
pch=16, cex=0.3, col=grey(0.5))
points(LowerAndUpperCoords$lowerHabCoords[,2] ~
LowerAndUpperCoords$lowerHabCoords[,1],
pch=16, cex=0.3, col=grey(0.1))
points(LowerAndUpperCoords$upperHabCoords[,2] ~
LowerAndUpperCoords$upperHabCoords[,1],
pch=16, cex=0.3, col=grey(0.1))
# Plot observation window cells center and lower/upper coordinates
points(scaled$coordsDataScaled[,2]~scaled$coordsDataScaled[,1], pch=16,
cex=0.3, col = adjustcolor("red",alpha.f = 0.8))
points(LowerAndUpperCoords$lowerObsCoords[,2] ~
LowerAndUpperCoords$lowerObsCoords[,1],
pch=16, cex=0.3, col = adjustcolor("red", alpha.f = 0.8))
points(LowerAndUpperCoords$upperObsCoords[,2] ~
LowerAndUpperCoords$upperObsCoords[,1],
pch=16, cex=0.3, col = adjustcolor("red", alpha.f = 0.8))
Run the code above in your browser using DataLab