getWindowCoords {nimbleSCR}R Documentation

Get lower and upper windows coordinates

Description

The getWindowCoords is an R utility function to create lower and upper habitat and observation windows coordinates, as well an habitat grid with cell ids. Those objects are necessary to run all point process (pp) functions. All input data should be scaled to the habitat grid using scaleCoordsToHabitatGrid. Note that we assume homogeneous window sizes.

Usage

getWindowCoords(
  scaledHabGridCenter = scaledHabGridCenter,
  scaledObsGridCenter = NULL,
  plot.check = TRUE
)

Arguments

scaledHabGridCenter

A matrix with the scaled "x" and "y" habitat windows grid cell centers (after using scaleCoordsToHabitatGrid).

scaledObsGridCenter

A matrix with the scaled "x" and "y" observation windows grid cell centers (afer using scaleCoordsToHabitatGrid). This is an optional argument and only necessary when modelling detection as a point process (e.g. dpoisppDetection_normal).

plot.check

A visualization option (if TRUE); displays habitat and detection windows.

Value

A list of objects :

Author(s)

Cyril Milleret

Examples

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))
       

[Package nimbleSCR version 0.2.1 Index]